Mir

Merge lp:~alan-griffiths/mir/refactor-surfaces-cleanup into lp:~mir-team/mir/trunk

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 504
Proposed branch: lp:~alan-griffiths/mir/refactor-surfaces-cleanup
Merge into: lp:~mir-team/mir/trunk
Prerequisite: lp:~alan-griffiths/mir/refactor-frontend-cleanup
Diff against target: 814 lines (+230/-239)
16 files modified
include/server/mir/default_server_configuration.h (+2/-2)
include/server/mir/shell/surface_controller.h (+9/-6)
src/server/default_server_configuration.cpp (+2/-2)
src/server/shell/CMakeLists.txt (+2/-0)
src/server/shell/application_session.cpp (+1/-1)
src/server/shell/surface.cpp (+31/-39)
src/server/shell/surface.h (+20/-29)
src/server/shell/surface_controller.cpp (+8/-5)
src/server/surfaces/CMakeLists.txt (+0/-2)
tests/integration-tests/frontend/test_session_manager.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator.cpp (+1/-1)
tests/unit-tests/shell/CMakeLists.txt (+1/-0)
tests/unit-tests/shell/test_application_session.cpp (+1/-1)
tests/unit-tests/shell/test_session_manager.cpp (+2/-2)
tests/unit-tests/shell/test_surface.cpp (+149/-147)
tests/unit-tests/surfaces/CMakeLists.txt (+0/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/refactor-surfaces-cleanup
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Alexandros Frantzis (community) Approve
Kevin DuBois (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+153431@code.launchpad.net

Commit message

surface, shell: Turn ProxySurface into shell::Surface

Description of the change

surface, shell: Turn ProxySurface into shell::Surface

This is the remaining part of the refactoring discussed on mir-devel

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

looks good.
493: setting expectations on a stub was off-putting on first glance, after reading a bit more, it looks ok

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> looks good.
> 493: setting expectations on a stub was off-putting on first glance, after
> reading a bit more, it looks ok

It was like that when I arrived. ;)

Yes, this is some of the misuse of mocks as stubs that I keep muttering about.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good overall.

The only thing that caught my eye is the need for a special deleter function:

296 + Surface(std::weak_ptr<mir::surfaces::Surface> const& surface, std::function<void(std::weak_ptr<mir::surfaces::Surface> const&)> const& deleter);

But since I haven't examined the situation properly I am going to provide a "weak" approval and revisit this later.

review: Approve
Revision history for this message
Robert Carr (robertcarr) wrote :

Like we talked about on IRC (Friday 11:05 am west coast time, maybe there are logs now that we use freenode?), the deleters are a little weird. I think it's a good step forward though as long as we work on the shell/surfaces interface next week.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/server/mir/default_server_configuration.h'
2--- include/server/mir/default_server_configuration.h 2013-03-15 14:51:20 +0000
3+++ include/server/mir/default_server_configuration.h 2013-03-15 14:51:20 +0000
4@@ -48,11 +48,11 @@
5 {
6 class SessionManager;
7 class SurfaceFactory;
8+class SurfaceController;
9 }
10 namespace surfaces
11 {
12 class BufferBundleFactory;
13-class SurfaceController;
14 class SurfaceStackModel;
15 class SurfaceStack;
16 }
17@@ -124,7 +124,7 @@
18 CachedPtr<graphics::Renderer> renderer;
19 CachedPtr<compositor::BufferBundleManager> buffer_bundle_manager;
20 CachedPtr<surfaces::SurfaceStack> surface_stack;
21- CachedPtr<surfaces::SurfaceController> surface_controller;
22+ CachedPtr<shell::SurfaceController> surface_controller;
23 CachedPtr<compositor::Compositor> compositor;
24 CachedPtr<logging::Logger> logger;
25 CachedPtr<graphics::DisplayReport> display_report;
26
27=== renamed file 'include/server/mir/surfaces/surface_controller.h' => 'include/server/mir/shell/surface_controller.h'
28--- include/server/mir/surfaces/surface_controller.h 2013-03-15 14:51:20 +0000
29+++ include/server/mir/shell/surface_controller.h 2013-03-15 14:51:20 +0000
30@@ -16,8 +16,8 @@
31 * Authored by: Thomas Voss <thomas.voss@canonical.com>
32 */
33
34-#ifndef MIR_SURFACES_SURFACE_CONTROLLER_H_
35-#define MIR_SURFACES_SURFACE_CONTROLLER_H_
36+#ifndef MIR_SHELL_SURFACE_CONTROLLER_H_
37+#define MIR_SHELL_SURFACE_CONTROLLER_H_
38
39 #include "mir/shell/surface_factory.h"
40
41@@ -31,11 +31,14 @@
42 namespace surfaces
43 {
44 class SurfaceStackModel;
45+}
46
47-class SurfaceController : public shell::SurfaceFactory
48+namespace shell
49+{
50+class SurfaceController : public SurfaceFactory
51 {
52 public:
53- explicit SurfaceController(std::shared_ptr<SurfaceStackModel> const& surface_stack);
54+ explicit SurfaceController(std::shared_ptr<surfaces::SurfaceStackModel> const& surface_stack);
55 virtual ~SurfaceController() {}
56
57 std::shared_ptr<frontend::Surface> create_surface(const frontend::SurfaceCreationParameters& params);
58@@ -45,10 +48,10 @@
59 SurfaceController& operator=(const SurfaceController&) = delete;
60
61 private:
62- std::shared_ptr<SurfaceStackModel> const surface_stack;
63+ std::shared_ptr<surfaces::SurfaceStackModel> const surface_stack;
64 };
65
66 }
67 }
68
69-#endif // MIR_SURFACES_SURFACE_CONTROLLER_H_
70+#endif // MIR_SHELL_SURFACE_CONTROLLER_H_
71
72=== modified file 'src/server/default_server_configuration.cpp'
73--- src/server/default_server_configuration.cpp 2013-03-15 14:51:20 +0000
74+++ src/server/default_server_configuration.cpp 2013-03-15 14:51:20 +0000
75@@ -45,7 +45,7 @@
76 #include "mir/logging/dumb_console_logger.h"
77 #include "mir/logging/session_mediator_report.h"
78 #include "mir/logging/display_report.h"
79-#include "mir/surfaces/surface_controller.h"
80+#include "mir/shell/surface_controller.h"
81 #include "mir/surfaces/surface_stack.h"
82
83 namespace mc = mir::compositor;
84@@ -329,7 +329,7 @@
85 return surface_controller(
86 [this]()
87 {
88- return std::make_shared<ms::SurfaceController>(the_surface_stack_model());
89+ return std::make_shared<msh::SurfaceController>(the_surface_stack_model());
90 });
91 }
92
93
94=== modified file 'src/server/shell/CMakeLists.txt'
95--- src/server/shell/CMakeLists.txt 2013-03-15 14:51:20 +0000
96+++ src/server/shell/CMakeLists.txt 2013-03-15 14:51:20 +0000
97@@ -8,6 +8,8 @@
98 single_visibility_focus_mechanism.cpp
99 consuming_placement_strategy.cpp
100 organising_surface_factory.cpp
101+ surface_controller.cpp
102+ surface.cpp
103 )
104
105 add_library(
106
107=== modified file 'src/server/shell/application_session.cpp'
108--- src/server/shell/application_session.cpp 2013-03-15 14:51:20 +0000
109+++ src/server/shell/application_session.cpp 2013-03-15 14:51:20 +0000
110@@ -19,7 +19,7 @@
111 #include "mir/shell/application_session.h"
112 #include "mir/frontend/surface.h"
113
114-#include "mir/surfaces/surface_controller.h"
115+#include "mir/shell/surface_controller.h"
116
117 #include <boost/throw_exception.hpp>
118
119
120=== renamed file 'src/server/surfaces/proxy_surface.cpp' => 'src/server/shell/surface.cpp'
121--- src/server/surfaces/proxy_surface.cpp 2013-03-15 14:51:20 +0000
122+++ src/server/shell/surface.cpp 2013-03-15 14:51:20 +0000
123@@ -16,7 +16,7 @@
124 * Authored by: Alan Griffiths <alan@octopull.co.uk>
125 */
126
127-#include "proxy_surface.h"
128+#include "surface.h"
129
130 #include "mir/surfaces/surface_stack_model.h"
131
132@@ -24,15 +24,30 @@
133
134 #include <stdexcept>
135
136-namespace ms = mir::surfaces;
137+namespace msh = mir::shell;
138 namespace mc = mir::compositor;
139
140-ms::BasicProxySurface::BasicProxySurface(std::weak_ptr<mir::surfaces::Surface> const& surface) :
141- surface(surface)
142-{
143-}
144-
145-void ms::BasicProxySurface::hide()
146+msh::Surface::Surface(std::weak_ptr<mir::surfaces::Surface> const& surface) :
147+ surface(surface),
148+ deleter([](std::weak_ptr<mir::surfaces::Surface> const&){})
149+{
150+}
151+
152+msh::Surface::Surface(
153+ std::weak_ptr<mir::surfaces::Surface> const& surface,
154+ std::function<void(std::weak_ptr<mir::surfaces::Surface> const&)> const& deleter)
155+:
156+ surface(surface),
157+ deleter(deleter)
158+{
159+}
160+
161+msh::Surface::~Surface()
162+{
163+ destroy();
164+}
165+
166+void msh::Surface::hide()
167 {
168 if (auto const& s = surface.lock())
169 {
170@@ -40,7 +55,7 @@
171 }
172 }
173
174-void ms::BasicProxySurface::show()
175+void msh::Surface::show()
176 {
177 if (auto const& s = surface.lock())
178 {
179@@ -48,11 +63,12 @@
180 }
181 }
182
183-void ms::BasicProxySurface::destroy()
184+void msh::Surface::destroy()
185 {
186+ deleter(surface);
187 }
188
189-void ms::BasicProxySurface::shutdown()
190+void msh::Surface::shutdown()
191 {
192 if (auto const& s = surface.lock())
193 {
194@@ -60,7 +76,7 @@
195 }
196 }
197
198-mir::geometry::Size ms::BasicProxySurface::size() const
199+mir::geometry::Size msh::Surface::size() const
200 {
201 if (auto const& s = surface.lock())
202 {
203@@ -72,7 +88,7 @@
204 }
205 }
206
207-mir::geometry::PixelFormat ms::BasicProxySurface::pixel_format() const
208+mir::geometry::PixelFormat msh::Surface::pixel_format() const
209 {
210 if (auto const& s = surface.lock())
211 {
212@@ -84,7 +100,7 @@
213 }
214 }
215
216-void ms::BasicProxySurface::advance_client_buffer()
217+void msh::Surface::advance_client_buffer()
218 {
219 if (auto const& s = surface.lock())
220 {
221@@ -92,7 +108,7 @@
222 }
223 }
224
225-std::shared_ptr<mc::Buffer> ms::BasicProxySurface::client_buffer() const
226+std::shared_ptr<mc::Buffer> msh::Surface::client_buffer() const
227 {
228 if (auto const& s = surface.lock())
229 {
230@@ -103,27 +119,3 @@
231 BOOST_THROW_EXCEPTION(std::runtime_error("Invalid surface"));
232 }
233 }
234-
235-void ms::BasicProxySurface::destroy_surface(SurfaceStackModel* const surface_stack) const
236-{
237- surface_stack->destroy_surface(surface);
238-}
239-
240-
241-ms::ProxySurface::ProxySurface(
242- SurfaceStackModel* const surface_stack_,
243- frontend::SurfaceCreationParameters const& params) :
244- BasicProxySurface(surface_stack_->create_surface(params)),
245- surface_stack(surface_stack_)
246-{
247-}
248-
249-void ms::ProxySurface::destroy()
250-{
251- destroy_surface(surface_stack);
252-}
253-
254-ms::ProxySurface::~ProxySurface()
255-{
256- destroy();
257-}
258
259=== renamed file 'src/server/surfaces/proxy_surface.h' => 'src/server/shell/surface.h'
260--- src/server/surfaces/proxy_surface.h 2013-03-15 14:51:20 +0000
261+++ src/server/shell/surface.h 2013-03-15 14:51:20 +0000
262@@ -17,12 +17,14 @@
263 */
264
265
266-#ifndef PROXY_SURFACE_H_
267-#define PROXY_SURFACE_H_
268+#ifndef MIR_SHELL_SURFACE_H_
269+#define MIR_SHELL_SURFACE_H_
270
271 #include "mir/frontend/surface.h"
272 #include "mir/surfaces/surface.h"
273
274+#include <functional>
275+
276 namespace mir
277 {
278 namespace frontend
279@@ -33,12 +35,18 @@
280 namespace surfaces
281 {
282 class SurfaceStackModel;
283-
284-class BasicProxySurface : public frontend::Surface
285+}
286+
287+namespace shell
288+{
289+
290+class Surface : public frontend::Surface
291 {
292 public:
293
294- explicit BasicProxySurface(std::weak_ptr<mir::surfaces::Surface> const& surface);
295+ explicit Surface(std::weak_ptr<mir::surfaces::Surface> const& surface);
296+ Surface(std::weak_ptr<mir::surfaces::Surface> const& surface, std::function<void(std::weak_ptr<mir::surfaces::Surface> const&)> const& deleter);
297+ ~Surface();
298
299 void hide();
300
301@@ -56,29 +64,12 @@
302
303 std::shared_ptr<compositor::Buffer> client_buffer() const;
304
305-protected:
306- void destroy_surface(SurfaceStackModel* const surface_stack) const;
307-
308 private:
309 std::weak_ptr<mir::surfaces::Surface> const surface;
310-};
311-
312-class ProxySurface : public BasicProxySurface
313-{
314-public:
315- ProxySurface(
316- SurfaceStackModel* const surface_stack_,
317- frontend::SurfaceCreationParameters const& params);
318-
319- void destroy();
320-
321- ~ProxySurface();
322-
323-private:
324- SurfaceStackModel* const surface_stack;
325-};
326-
327-}
328-}
329-
330-#endif /* PROXY_SURFACE_H_ */
331+ std::function<void(std::weak_ptr<mir::surfaces::Surface> const&)> const deleter;
332+};
333+
334+}
335+}
336+
337+#endif /* MIR_SHELL_SURFACE_H_ */
338
339=== renamed file 'src/server/surfaces/surface_controller.cpp' => 'src/server/shell/surface_controller.cpp'
340--- src/server/surfaces/surface_controller.cpp 2013-03-15 14:51:20 +0000
341+++ src/server/shell/surface_controller.cpp 2013-03-15 14:51:20 +0000
342@@ -16,23 +16,26 @@
343 * Authored by: Thomas Voss <thomas.voss@canonical.com>
344 */
345
346-#include "mir/surfaces/surface_controller.h"
347+#include "mir/shell/surface_controller.h"
348 #include "mir/surfaces/surface_stack_model.h"
349 #include "mir/frontend/surface.h"
350
351-#include "proxy_surface.h"
352+#include "surface.h"
353
354 #include <cassert>
355
356 namespace ms = mir::surfaces;
357+namespace msh = mir::shell;
358 namespace mf = mir::frontend;
359
360-ms::SurfaceController::SurfaceController(std::shared_ptr<SurfaceStackModel> const& surface_stack) : surface_stack(surface_stack)
361+msh::SurfaceController::SurfaceController(std::shared_ptr<ms::SurfaceStackModel> const& surface_stack) : surface_stack(surface_stack)
362 {
363 assert(surface_stack);
364 }
365
366-std::shared_ptr<mf::Surface> ms::SurfaceController::create_surface(const mf::SurfaceCreationParameters& params)
367+std::shared_ptr<mf::Surface> msh::SurfaceController::create_surface(const mf::SurfaceCreationParameters& params)
368 {
369- return std::make_shared<ProxySurface>(surface_stack.get(), params);
370+ return std::make_shared<Surface>(
371+ surface_stack->create_surface(params),
372+ [=] (std::weak_ptr<mir::surfaces::Surface> const& surface) { surface_stack->destroy_surface(surface); });
373 }
374
375=== modified file 'src/server/surfaces/CMakeLists.txt'
376--- src/server/surfaces/CMakeLists.txt 2013-03-07 08:04:05 +0000
377+++ src/server/surfaces/CMakeLists.txt 2013-03-15 14:51:20 +0000
378@@ -3,6 +3,4 @@
379
380 surface.cpp
381 surface_stack.cpp
382- surface_controller.cpp
383- proxy_surface.cpp
384 )
385
386=== modified file 'tests/integration-tests/frontend/test_session_manager.cpp'
387--- tests/integration-tests/frontend/test_session_manager.cpp 2013-03-15 14:51:20 +0000
388+++ tests/integration-tests/frontend/test_session_manager.cpp 2013-03-15 14:51:20 +0000
389@@ -18,7 +18,7 @@
390
391 #include "mir/shell/session_manager.h"
392 #include "mir/surfaces/buffer_bundle.h"
393-#include "mir/surfaces/surface_controller.h"
394+#include "mir/shell/surface_controller.h"
395 #include "mir/surfaces/surface_stack.h"
396 #include "mir/surfaces/surface.h"
397 #include "mir/compositor/buffer_swapper.h"
398
399=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
400--- tests/unit-tests/frontend/test_session_mediator.cpp 2013-03-15 14:51:20 +0000
401+++ tests/unit-tests/frontend/test_session_mediator.cpp 2013-03-15 14:51:20 +0000
402@@ -34,7 +34,7 @@
403 #include "mir_test_doubles/stub_session.h"
404 #include "mir_test/fake_shared.h"
405
406-#include "src/server/surfaces/proxy_surface.h"
407+#include "src/server/shell/surface.h"
408
409 #include <gtest/gtest.h>
410 #include <gmock/gmock.h>
411
412=== modified file 'tests/unit-tests/shell/CMakeLists.txt'
413--- tests/unit-tests/shell/CMakeLists.txt 2013-03-07 08:04:05 +0000
414+++ tests/unit-tests/shell/CMakeLists.txt 2013-03-15 14:51:20 +0000
415@@ -6,6 +6,7 @@
416 ${CMAKE_CURRENT_SOURCE_DIR}/test_single_visibility_focus_mechanism.cpp
417 ${CMAKE_CURRENT_SOURCE_DIR}/test_consuming_placement_strategy.cpp
418 ${CMAKE_CURRENT_SOURCE_DIR}/test_organising_surface_factory.cpp
419+ ${CMAKE_CURRENT_SOURCE_DIR}/test_surface.cpp
420 )
421
422 set(
423
424=== modified file 'tests/unit-tests/shell/test_application_session.cpp'
425--- tests/unit-tests/shell/test_application_session.cpp 2013-03-15 14:51:20 +0000
426+++ tests/unit-tests/shell/test_application_session.cpp 2013-03-15 14:51:20 +0000
427@@ -23,7 +23,7 @@
428 #include "mir_test_doubles/mock_surface_factory.h"
429 #include "mir_test_doubles/mock_surface.h"
430
431-#include "src/server/surfaces/proxy_surface.h"
432+#include "src/server/shell/surface.h"
433
434 #include <gmock/gmock.h>
435 #include <gtest/gtest.h>
436
437=== modified file 'tests/unit-tests/shell/test_session_manager.cpp'
438--- tests/unit-tests/shell/test_session_manager.cpp 2013-03-15 14:51:20 +0000
439+++ tests/unit-tests/shell/test_session_manager.cpp 2013-03-15 14:51:20 +0000
440@@ -29,7 +29,7 @@
441 #include "mir_test_doubles/mock_surface_factory.h"
442 #include "mir_test_doubles/null_buffer_bundle.h"
443
444-#include "src/server/surfaces/proxy_surface.h"
445+#include "src/server/shell/surface.h"
446
447 #include <gmock/gmock.h>
448 #include <gtest/gtest.h>
449@@ -111,7 +111,7 @@
450 mf::a_surface().name,
451 buffer_bundle));
452 ON_CALL(surface_factory, create_surface(_)).WillByDefault(
453- Return(std::make_shared<ms::BasicProxySurface>(dummy_surface)));
454+ Return(std::make_shared<msh::Surface>(dummy_surface)));
455
456 EXPECT_CALL(container, insert_session(_)).Times(1);
457 EXPECT_CALL(container, remove_session(_)).Times(1);
458
459=== renamed file 'tests/unit-tests/surfaces/test_proxy_surface.cpp' => 'tests/unit-tests/shell/test_surface.cpp'
460--- tests/unit-tests/surfaces/test_proxy_surface.cpp 2013-03-15 14:51:20 +0000
461+++ tests/unit-tests/shell/test_surface.cpp 2013-03-15 14:51:20 +0000
462@@ -16,7 +16,7 @@
463 * Authored by: Alan Griffiths <alan@octopull.co.uk>
464 */
465
466-#include "src/server/surfaces/proxy_surface.h"
467+#include "src/server/shell/surface.h"
468 #include "mir/surfaces/surface.h"
469 #include "mir/shell/surface_creation_parameters.h"
470 #include "mir/surfaces/surface_stack_model.h"
471@@ -30,6 +30,7 @@
472 #include <gtest/gtest.h>
473
474 namespace ms = mir::surfaces;
475+namespace msh = mir::shell;
476 namespace mf = mir::frontend;
477 namespace mc = mir::compositor;
478 namespace geom = mir::geometry;
479@@ -73,9 +74,24 @@
480
481 std::shared_ptr<ms::Surface> surface;
482 };
483+
484+struct ShellSurface : testing::Test
485+{
486+ std::shared_ptr<StubBufferBundle> buffer_bundle;
487+
488+ ShellSurface() :
489+ buffer_bundle(std::make_shared<StubBufferBundle>())
490+ {
491+ using namespace testing;
492+
493+ ON_CALL(*buffer_bundle, bundle_size()).WillByDefault(Return(geom::Size()));
494+ ON_CALL(*buffer_bundle, get_bundle_pixel_format()).WillByDefault(Return(geom::PixelFormat::abgr_8888));
495+ ON_CALL(*buffer_bundle, secure_client_buffer()).WillByDefault(Return(std::shared_ptr<mtd::StubBuffer>()));
496+ }
497+};
498 }
499
500-TEST(SurfaceProxy, creation_and_destruction)
501+TEST_F(ShellSurface, creation_and_destruction)
502 {
503 MockSurfaceStackModel surface_stack;
504 mf::SurfaceCreationParameters params;
505@@ -85,17 +101,21 @@
506 EXPECT_CALL(surface_stack, create_surface(_)).Times(1);
507 EXPECT_CALL(surface_stack, destroy_surface(_)).Times(1);
508
509- ms::ProxySurface test(&surface_stack, params);
510+ msh::Surface test(
511+ surface_stack.create_surface(params),
512+ [&](std::weak_ptr<mir::surfaces::Surface> const& s) {surface_stack.destroy_surface(s);});
513 }
514
515-TEST(SurfaceProxy, destroy)
516+TEST_F(ShellSurface, destroy)
517 {
518 using namespace testing;
519
520 NiceMock<MockSurfaceStackModel> surface_stack;
521 mf::SurfaceCreationParameters params;
522
523- ms::ProxySurface test(&surface_stack, params);
524+ msh::Surface test(
525+ surface_stack.create_surface(params),
526+ [&](std::weak_ptr<mir::surfaces::Surface> const& s) {surface_stack.destroy_surface(s);});
527
528 EXPECT_CALL(surface_stack, destroy_surface(_)).Times(1);
529
530@@ -104,148 +124,130 @@
531 Mock::VerifyAndClearExpectations(&surface_stack);
532 }
533
534-namespace
535-{
536-struct BasicSurfaceProxy : testing::Test
537-{
538- std::shared_ptr<StubBufferBundle> buffer_bundle;
539-
540- BasicSurfaceProxy() :
541- buffer_bundle(std::make_shared<StubBufferBundle>())
542- {
543- using namespace testing;
544-
545- ON_CALL(*buffer_bundle, bundle_size()).WillByDefault(Return(geom::Size()));
546- ON_CALL(*buffer_bundle, get_bundle_pixel_format()).WillByDefault(Return(geom::PixelFormat::abgr_8888));
547- ON_CALL(*buffer_bundle, secure_client_buffer()).WillByDefault(Return(std::shared_ptr<mtd::StubBuffer>()));
548- }
549-};
550-}
551-
552-TEST_F(BasicSurfaceProxy, client_buffer_throw_behavior)
553-{
554- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
555-
556- ms::BasicProxySurface proxy_surface(surface);
557-
558- EXPECT_NO_THROW({
559- proxy_surface.client_buffer();
560- });
561-
562- surface.reset();
563-
564- EXPECT_THROW({
565- proxy_surface.client_buffer();
566- }, std::runtime_error);
567-}
568-
569-TEST_F(BasicSurfaceProxy, size_throw_behavior)
570-{
571- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
572-
573- ms::BasicProxySurface proxy_surface(surface);
574-
575- EXPECT_NO_THROW({
576- proxy_surface.size();
577- });
578-
579- surface.reset();
580-
581- EXPECT_THROW({
582- proxy_surface.size();
583- }, std::runtime_error);
584-}
585-
586-TEST_F(BasicSurfaceProxy, pixel_format_throw_behavior)
587-{
588- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
589-
590- ms::BasicProxySurface proxy_surface(surface);
591-
592- EXPECT_NO_THROW({
593- proxy_surface.pixel_format();
594- });
595-
596- surface.reset();
597-
598- EXPECT_THROW({
599- proxy_surface.pixel_format();
600- }, std::runtime_error);
601-}
602-
603-TEST_F(BasicSurfaceProxy, hide_throw_behavior)
604-{
605- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
606-
607- ms::BasicProxySurface proxy_surface(surface);
608-
609- EXPECT_NO_THROW({
610- proxy_surface.hide();
611- });
612-
613- surface.reset();
614-
615- EXPECT_NO_THROW({
616- proxy_surface.hide();
617- });
618-}
619-
620-TEST_F(BasicSurfaceProxy, show_throw_behavior)
621-{
622- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
623-
624- ms::BasicProxySurface proxy_surface(surface);
625-
626- EXPECT_NO_THROW({
627- proxy_surface.show();
628- });
629-
630- surface.reset();
631-
632- EXPECT_NO_THROW({
633- proxy_surface.show();
634- });
635-}
636-
637-TEST_F(BasicSurfaceProxy, destroy_throw_behavior)
638-{
639- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
640-
641- ms::BasicProxySurface proxy_surface(surface);
642-
643- EXPECT_NO_THROW({
644- proxy_surface.destroy();
645- });
646-
647- surface.reset();
648-
649- EXPECT_NO_THROW({
650- proxy_surface.destroy();
651- });
652-}
653-
654-TEST_F(BasicSurfaceProxy, shutdown_throw_behavior)
655-{
656- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
657-
658- ms::BasicProxySurface proxy_surface(surface);
659-
660- EXPECT_NO_THROW({
661- proxy_surface.shutdown();
662- });
663-
664- surface.reset();
665-
666- EXPECT_NO_THROW({
667- proxy_surface.shutdown();
668- });
669-}
670-
671-TEST_F(BasicSurfaceProxy, advance_client_buffer_throw_behavior)
672-{
673- auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
674-
675- ms::BasicProxySurface proxy_surface(surface);
676+TEST_F(ShellSurface, client_buffer_throw_behavior)
677+{
678+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
679+
680+ msh::Surface proxy_surface(surface);
681+
682+ EXPECT_NO_THROW({
683+ proxy_surface.client_buffer();
684+ });
685+
686+ surface.reset();
687+
688+ EXPECT_THROW({
689+ proxy_surface.client_buffer();
690+ }, std::runtime_error);
691+}
692+
693+TEST_F(ShellSurface, size_throw_behavior)
694+{
695+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
696+
697+ msh::Surface proxy_surface(surface);
698+
699+ EXPECT_NO_THROW({
700+ proxy_surface.size();
701+ });
702+
703+ surface.reset();
704+
705+ EXPECT_THROW({
706+ proxy_surface.size();
707+ }, std::runtime_error);
708+}
709+
710+TEST_F(ShellSurface, pixel_format_throw_behavior)
711+{
712+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
713+
714+ msh::Surface proxy_surface(surface);
715+
716+ EXPECT_NO_THROW({
717+ proxy_surface.pixel_format();
718+ });
719+
720+ surface.reset();
721+
722+ EXPECT_THROW({
723+ proxy_surface.pixel_format();
724+ }, std::runtime_error);
725+}
726+
727+TEST_F(ShellSurface, hide_throw_behavior)
728+{
729+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
730+
731+ msh::Surface proxy_surface(surface);
732+
733+ EXPECT_NO_THROW({
734+ proxy_surface.hide();
735+ });
736+
737+ surface.reset();
738+
739+ EXPECT_NO_THROW({
740+ proxy_surface.hide();
741+ });
742+}
743+
744+TEST_F(ShellSurface, show_throw_behavior)
745+{
746+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
747+
748+ msh::Surface proxy_surface(surface);
749+
750+ EXPECT_NO_THROW({
751+ proxy_surface.show();
752+ });
753+
754+ surface.reset();
755+
756+ EXPECT_NO_THROW({
757+ proxy_surface.show();
758+ });
759+}
760+
761+TEST_F(ShellSurface, destroy_throw_behavior)
762+{
763+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
764+
765+ msh::Surface proxy_surface(surface);
766+
767+ EXPECT_NO_THROW({
768+ proxy_surface.destroy();
769+ });
770+
771+ surface.reset();
772+
773+ EXPECT_NO_THROW({
774+ proxy_surface.destroy();
775+ });
776+}
777+
778+TEST_F(ShellSurface, shutdown_throw_behavior)
779+{
780+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
781+
782+ msh::Surface proxy_surface(surface);
783+
784+ EXPECT_NO_THROW({
785+ proxy_surface.shutdown();
786+ });
787+
788+ surface.reset();
789+
790+ EXPECT_NO_THROW({
791+ proxy_surface.shutdown();
792+ });
793+}
794+
795+TEST_F(ShellSurface, advance_client_buffer_throw_behavior)
796+{
797+ auto surface = std::make_shared<ms::Surface>(__PRETTY_FUNCTION__, buffer_bundle);
798+
799+ msh::Surface proxy_surface(surface);
800
801 EXPECT_NO_THROW({
802 proxy_surface.advance_client_buffer();
803
804=== modified file 'tests/unit-tests/surfaces/CMakeLists.txt'
805--- tests/unit-tests/surfaces/CMakeLists.txt 2013-03-07 08:04:05 +0000
806+++ tests/unit-tests/surfaces/CMakeLists.txt 2013-03-15 14:51:20 +0000
807@@ -2,7 +2,6 @@
808 APPEND UNIT_TEST_SOURCES
809 ${CMAKE_CURRENT_SOURCE_DIR}/test_surface.cpp
810 ${CMAKE_CURRENT_SOURCE_DIR}/test_surface_stack.cpp
811- ${CMAKE_CURRENT_SOURCE_DIR}/test_proxy_surface.cpp
812 )
813
814 set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES} PARENT_SCOPE)

Subscribers

People subscribed via source and target branches