Mir

Merge lp:~afrantzis/mir/base-stubs-on-null-platform into lp:~mir-team/mir/trunk

Proposed by Alexandros Frantzis
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 761
Proposed branch: lp:~afrantzis/mir/base-stubs-on-null-platform
Merge into: lp:~mir-team/mir/trunk
Diff against target: 492 lines (+37/-162)
10 files modified
include/test/mir_test_doubles/null_platform.h (+7/-7)
tests/integration-tests/graphics/gbm/test_buffer_integration.cpp (+4/-22)
tests/integration-tests/test_display_info.cpp (+4/-20)
tests/integration-tests/test_drm_auth_magic.cpp (+3/-24)
tests/integration-tests/test_surfaceloop.cpp (+7/-38)
tests/mir_test_framework/testing_server_options.cpp (+5/-22)
tests/unit-tests/frontend/test_session_mediator.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+3/-3)
tests/unit-tests/frontend/test_session_mediator_gbm.cpp (+3/-24)
tests/unit-tests/graphics/gbm/test_internal_client.cpp (+0/-1)
To merge this branch: bzr merge lp:~afrantzis/mir/base-stubs-on-null-platform
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Kevin DuBois (community) Approve
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+170550@code.launchpad.net

Commit message

tests: Base StubPlatforms on NullPlatform

Description of the change

tests: Base StubPlatforms on NullPlatform

Simplifies StubPlatform implementations and reduces churn when extending the Platform API.

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
Daniel van Vugt (vanvugt) wrote :

Appears sane.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

looks good!

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

ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'include/test/mir_test_doubles/stub_platform.h' => 'include/test/mir_test_doubles/null_platform.h'
2--- include/test/mir_test_doubles/stub_platform.h 2013-05-17 18:18:20 +0000
3+++ include/test/mir_test_doubles/null_platform.h 2013-06-20 08:30:36 +0000
4@@ -16,8 +16,8 @@
5 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
6 */
7
8-#ifndef MIR_TEST_DOUBLES_STUB_PLATFORM_H_
9-#define MIR_TEST_DOUBLES_STUB_PLATFORM_H_
10+#ifndef MIR_TEST_DOUBLES_NULL_PLATFORM_H_
11+#define MIR_TEST_DOUBLES_NULL_PLATFORM_H_
12
13 #include "mir/graphics/platform.h"
14 #include "mir/graphics/platform_ipc_package.h"
15@@ -29,7 +29,7 @@
16 {
17 namespace doubles
18 {
19-class StubPlatform : public graphics::Platform
20+class NullPlatform : public graphics::Platform
21 {
22 public:
23 std::shared_ptr<compositor::GraphicBufferAllocator> create_buffer_allocator(
24@@ -47,12 +47,12 @@
25 {
26 return std::make_shared<graphics::PlatformIPCPackage>();
27 }
28-
29+
30 std::shared_ptr<graphics::InternalClient> create_internal_client()
31 {
32- return std::shared_ptr<graphics::InternalClient>();
33+ return std::shared_ptr<graphics::InternalClient>();
34 }
35-
36+
37 void fill_ipc_package(std::shared_ptr<compositor::BufferIPCPacker> const&,
38 std::shared_ptr<compositor::Buffer> const&) const
39 {
40@@ -62,4 +62,4 @@
41 }
42 } // namespace mir
43
44-#endif // MIR_TEST_DOUBLES_STUB_INPUT_LISTENER_H_
45+#endif // MIR_TEST_DOUBLES_NULL_PLATFORM_
46
47=== modified file 'tests/integration-tests/graphics/gbm/test_buffer_integration.cpp'
48--- tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-05-17 18:48:07 +0000
49+++ tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-06-20 08:30:36 +0000
50@@ -24,6 +24,7 @@
51 #include "mir/compositor/buffer_properties.h"
52 #include "mir/graphics/buffer_initializer.h"
53 #include "mir_test_doubles/stub_buffer.h"
54+#include "mir_test_doubles/null_platform.h"
55 #include "mir/graphics/null_display_report.h"
56
57 #include "mir_test_framework/testing_server_configuration.h"
58@@ -81,33 +82,14 @@
59 }
60 };
61
62-class StubGraphicPlatform : public mg::Platform
63+class StubGraphicPlatform : public mtd::NullPlatform
64 {
65 public:
66- virtual std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
67- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/)
68+ std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
69+ const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
70 {
71 return std::make_shared<StubGraphicBufferAllocator>();
72 }
73-
74- virtual std::shared_ptr<mg::Display> create_display()
75- {
76- return std::shared_ptr<mg::Display>();
77- }
78-
79- virtual std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
80- {
81- return std::shared_ptr<mg::PlatformIPCPackage>();
82- }
83-
84- std::shared_ptr<mg::InternalClient> create_internal_client()
85- {
86- return std::shared_ptr<mg::InternalClient>();
87- }
88-
89- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&, std::shared_ptr<mc::Buffer> const&) const
90- {
91- }
92 };
93
94 class GBMBufferIntegration : public ::testing::Test
95
96=== modified file 'tests/integration-tests/test_display_info.cpp'
97--- tests/integration-tests/test_display_info.cpp 2013-05-17 18:18:20 +0000
98+++ tests/integration-tests/test_display_info.cpp 2013-06-20 08:30:36 +0000
99@@ -17,14 +17,13 @@
100 */
101
102 #include "mir/graphics/display.h"
103-#include "mir/graphics/platform.h"
104-#include "mir/graphics/platform_ipc_package.h"
105 #include "mir/compositor/buffer.h"
106 #include "mir/compositor/graphic_buffer_allocator.h"
107
108 #include "mir_test_framework/display_server_test_fixture.h"
109 #include "mir_test_doubles/stub_buffer.h"
110 #include "mir_test_doubles/null_display.h"
111+#include "mir_test_doubles/null_platform.h"
112
113 #include "mir_toolkit/mir_client_library.h"
114
115@@ -85,34 +84,19 @@
116 geom::PixelFormat::xbgr_8888
117 };
118
119-class StubPlatform : public mg::Platform
120+class StubPlatform : public mtd::NullPlatform
121 {
122 public:
123 std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
124- std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/)
125+ std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/) override
126 {
127 return std::make_shared<StubGraphicBufferAllocator>();
128 }
129
130- std::shared_ptr<mg::Display> create_display()
131+ std::shared_ptr<mg::Display> create_display() override
132 {
133 return std::make_shared<StubDisplay>();
134 }
135-
136- std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
137- {
138- return std::make_shared<mg::PlatformIPCPackage>();
139- }
140-
141- std::shared_ptr<mg::InternalClient> create_internal_client()
142- {
143- return std::shared_ptr<mg::InternalClient>();
144- }
145-
146- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&,
147- std::shared_ptr<mc::Buffer> const&) const
148- {
149- }
150 };
151
152 void connection_callback(MirConnection* connection, void* context)
153
154=== modified file 'tests/integration-tests/test_drm_auth_magic.cpp'
155--- tests/integration-tests/test_drm_auth_magic.cpp 2013-05-30 03:50:54 +0000
156+++ tests/integration-tests/test_drm_auth_magic.cpp 2013-06-20 08:30:36 +0000
157@@ -18,7 +18,6 @@
158
159 #include "mir/graphics/display.h"
160 #include "mir/graphics/drm_authenticator.h"
161-#include "mir/graphics/platform.h"
162 #include "mir/graphics/platform_ipc_package.h"
163 #include "mir/compositor/buffer_basic.h"
164 #include "mir/compositor/graphic_buffer_allocator.h"
165@@ -27,7 +26,7 @@
166 #include <boost/throw_exception.hpp>
167
168 #include "mir_test_doubles/stub_buffer.h"
169-#include "mir_test_doubles/null_display.h"
170+#include "mir_test_doubles/null_platform.h"
171 #include "mir_test_framework/display_server_test_fixture.h"
172
173 #include "mir_toolkit/mir_client_library.h"
174@@ -60,35 +59,15 @@
175 }
176 };
177
178-class MockAuthenticatingPlatform : public mg::Platform, public mg::DRMAuthenticator
179+class MockAuthenticatingPlatform : public mtd::NullPlatform, public mg::DRMAuthenticator
180 {
181 public:
182 std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
183- std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/)
184+ std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/) override
185 {
186 return std::make_shared<StubGraphicBufferAllocator>();
187 }
188
189- std::shared_ptr<mg::Display> create_display()
190- {
191- return std::make_shared<mtd::NullDisplay>();
192- }
193-
194- std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
195- {
196- return std::make_shared<mg::PlatformIPCPackage>();
197- }
198-
199- std::shared_ptr<mg::InternalClient> create_internal_client()
200- {
201- return std::shared_ptr<mg::InternalClient>();
202- }
203-
204- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&,
205- std::shared_ptr<mc::Buffer> const&) const
206- {
207- }
208-
209 MOCK_METHOD1(drm_auth_magic, void(unsigned int));
210 };
211
212
213=== modified file 'tests/integration-tests/test_surfaceloop.cpp'
214--- tests/integration-tests/test_surfaceloop.cpp 2013-06-14 16:03:46 +0000
215+++ tests/integration-tests/test_surfaceloop.cpp 2013-06-20 08:30:36 +0000
216@@ -24,8 +24,6 @@
217 #include "mir/compositor/buffer_id.h"
218 #include "mir/compositor/buffer_basic.h"
219 #include "mir/graphics/display.h"
220-#include "mir/graphics/platform.h"
221-#include "mir/graphics/platform_ipc_package.h"
222
223 #include "mir_toolkit/mir_client_library.h"
224
225@@ -33,6 +31,7 @@
226 #include "mir_test_doubles/stub_buffer.h"
227 #include "mir_test_doubles/mock_swapper_factory.h"
228 #include "mir_test_doubles/null_gl_context.h"
229+#include "mir_test_doubles/null_platform.h"
230
231 #include <thread>
232 #include <atomic>
233@@ -327,11 +326,11 @@
234 */
235 struct ServerConfigAllocatesBuffersOnServer : TestingServerConfiguration
236 {
237- class StubPlatform : public mg::Platform
238+ class StubPlatform : public mtd::NullPlatform
239 {
240 public:
241 std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
242- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/)
243+ const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
244 {
245 using testing::AtLeast;
246
247@@ -340,25 +339,10 @@
248 return buffer_allocator;
249 }
250
251- std::shared_ptr<mg::Display> create_display()
252+ std::shared_ptr<mg::Display> create_display() override
253 {
254 return std::make_shared<StubDisplay>();
255 }
256-
257- std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
258- {
259- return std::make_shared<mg::PlatformIPCPackage>();
260- }
261-
262- std::shared_ptr<mg::InternalClient> create_internal_client()
263- {
264- return std::shared_ptr<mg::InternalClient>();
265- }
266-
267- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&,
268- std::shared_ptr<mc::Buffer> const&) const
269- {
270- }
271 };
272
273 std::shared_ptr<mg::Platform> the_graphics_platform()
274@@ -467,34 +451,19 @@
275 }
276 };
277
278- class StubPlatform : public mg::Platform
279+ class StubPlatform : public mtd::NullPlatform
280 {
281 public:
282 std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
283- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/)
284+ const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
285 {
286 return std::make_shared<StubGraphicBufferAllocator>();
287 }
288
289- std::shared_ptr<mg::Display> create_display()
290+ std::shared_ptr<mg::Display> create_display() override
291 {
292 return std::make_shared<StubDisplay>();
293 }
294-
295- std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
296- {
297- return std::make_shared<mg::PlatformIPCPackage>();
298- }
299-
300- std::shared_ptr<mg::InternalClient> create_internal_client()
301- {
302- return std::shared_ptr<mg::InternalClient>();
303- }
304-
305- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&,
306- std::shared_ptr<mc::Buffer> const&) const
307- {
308- }
309 };
310
311 std::shared_ptr<mg::Platform> the_graphics_platform()
312
313=== modified file 'tests/mir_test_framework/testing_server_options.cpp'
314--- tests/mir_test_framework/testing_server_options.cpp 2013-06-12 10:27:50 +0000
315+++ tests/mir_test_framework/testing_server_options.cpp 2013-06-20 08:30:36 +0000
316@@ -19,7 +19,6 @@
317 #include "mir_test_framework/testing_server_configuration.h"
318
319 #include "mir/graphics/display.h"
320-#include "mir/graphics/platform.h"
321 #include "mir/graphics/platform_ipc_package.h"
322 #include "mir/graphics/renderer.h"
323 #include "mir/graphics/renderable.h"
324@@ -32,8 +31,7 @@
325
326 #include "mir_test_doubles/stub_buffer.h"
327 #include "mir_test_doubles/stub_surface_builder.h"
328-#include "mir_test_doubles/null_display.h"
329-#include "mir_test_doubles/null_gl_context.h"
330+#include "mir_test_doubles/null_platform.h"
331
332 #include <gtest/gtest.h>
333 #include <thread>
334@@ -103,33 +101,18 @@
335 }
336 };
337
338-class StubGraphicPlatform : public mg::Platform
339+class StubGraphicPlatform : public mtd::NullPlatform
340 {
341- virtual std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
342- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/)
343+ std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
344+ const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
345 {
346 return std::make_shared<StubGraphicBufferAllocator>();
347 }
348
349- virtual std::shared_ptr<mg::Display> create_display()
350+ std::shared_ptr<mg::Display> create_display() override
351 {
352 return std::make_shared<StubDisplay>();
353 }
354-
355- virtual std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
356- {
357- return std::make_shared<mg::PlatformIPCPackage>();
358- }
359-
360- std::shared_ptr<mg::InternalClient> create_internal_client()
361- {
362- return std::shared_ptr<mg::InternalClient>();
363- }
364-
365- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&,
366- std::shared_ptr<mc::Buffer> const&) const
367- {
368- }
369 };
370
371 class StubRenderer : public mg::Renderer
372
373=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
374--- tests/unit-tests/frontend/test_session_mediator.cpp 2013-06-12 15:36:31 +0000
375+++ tests/unit-tests/frontend/test_session_mediator.cpp 2013-06-20 08:30:36 +0000
376@@ -25,6 +25,7 @@
377 #include "mir/graphics/display.h"
378 #include "mir/graphics/platform.h"
379 #include "mir/graphics/platform_ipc_package.h"
380+#include "mir/graphics/gl_context.h"
381 #include "mir/surfaces/surface.h"
382 #include "mir_test_doubles/null_display.h"
383 #include "mir_test_doubles/mock_shell.h"
384@@ -32,7 +33,6 @@
385 #include "mir_test_doubles/mock_buffer.h"
386 #include "mir_test_doubles/stub_session.h"
387 #include "mir_test_doubles/stub_surface_builder.h"
388-#include "mir_test_doubles/stub_platform.h"
389 #include "mir_test/fake_shared.h"
390 #include "mir/events/event_sink.h"
391 #include "mir/shell/surface.h"
392
393=== modified file 'tests/unit-tests/frontend/test_session_mediator_android.cpp'
394--- tests/unit-tests/frontend/test_session_mediator_android.cpp 2013-05-30 03:50:54 +0000
395+++ tests/unit-tests/frontend/test_session_mediator_android.cpp 2013-06-20 08:30:36 +0000
396@@ -30,7 +30,7 @@
397 #include "mir_test_doubles/null_display.h"
398 #include "mir_test_doubles/mock_session.h"
399 #include "mir_test_doubles/stub_shell.h"
400-#include "mir_test_doubles/stub_platform.h"
401+#include "mir_test_doubles/null_platform.h"
402
403 #include "mir/events/event_sink.h"
404
405@@ -73,7 +73,7 @@
406 {
407 SessionMediatorAndroidTest()
408 : shell{std::make_shared<mtd::StubShell>()},
409- graphics_platform{std::make_shared<mtd::StubPlatform>()},
410+ graphics_platform{std::make_shared<mtd::NullPlatform>()},
411 graphics_display{std::make_shared<mtd::NullDisplay>()},
412 buffer_allocator{std::make_shared<StubGraphicBufferAllocator>()},
413 report{std::make_shared<mf::NullSessionMediatorReport>()},
414@@ -87,7 +87,7 @@
415 }
416
417 std::shared_ptr<mtd::StubShell> const shell;
418- std::shared_ptr<mtd::StubPlatform> const graphics_platform;
419+ std::shared_ptr<mtd::NullPlatform> const graphics_platform;
420 std::shared_ptr<mg::Display> const graphics_display;
421 std::shared_ptr<mc::GraphicBufferAllocator> const buffer_allocator;
422 std::shared_ptr<mf::SessionMediatorReport> const report;
423
424=== modified file 'tests/unit-tests/frontend/test_session_mediator_gbm.cpp'
425--- tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-05-30 03:50:54 +0000
426+++ tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-06-20 08:30:36 +0000
427@@ -24,14 +24,13 @@
428 #include "mir/frontend/shell.h"
429 #include "mir/graphics/display.h"
430 #include "mir/graphics/drm_authenticator.h"
431-#include "mir/graphics/platform.h"
432-#include "mir/graphics/platform_ipc_package.h"
433 #include "mir/events/event_sink.h"
434
435 #include <boost/exception/errinfo_errno.hpp>
436 #include <boost/throw_exception.hpp>
437
438 #include "mir_test_doubles/null_display.h"
439+#include "mir_test_doubles/null_platform.h"
440 #include "mir_test_doubles/mock_session.h"
441 #include "mir_test_doubles/stub_shell.h"
442
443@@ -63,35 +62,15 @@
444 }
445 };
446
447-class MockAuthenticatingPlatform : public mg::Platform, public mg::DRMAuthenticator
448+class MockAuthenticatingPlatform : public mtd::NullPlatform, public mg::DRMAuthenticator
449 {
450 public:
451 std::shared_ptr<mc::GraphicBufferAllocator> create_buffer_allocator(
452- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/)
453+ const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
454 {
455 return std::shared_ptr<StubGraphicBufferAllocator>();
456 }
457
458- std::shared_ptr<mg::Display> create_display()
459- {
460- return std::make_shared<mtd::NullDisplay>();
461- }
462-
463- std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package()
464- {
465- return std::make_shared<mg::PlatformIPCPackage>();
466- }
467-
468- std::shared_ptr<mg::InternalClient> create_internal_client()
469- {
470- return std::shared_ptr<mg::InternalClient>();
471- }
472-
473- void fill_ipc_package(std::shared_ptr<mc::BufferIPCPacker> const&,
474- std::shared_ptr<mc::Buffer> const&) const
475- {
476- }
477-
478 MOCK_METHOD1(drm_auth_magic, void(drm_magic_t));
479 };
480
481
482=== modified file 'tests/unit-tests/graphics/gbm/test_internal_client.cpp'
483--- tests/unit-tests/graphics/gbm/test_internal_client.cpp 2013-06-13 23:21:00 +0000
484+++ tests/unit-tests/graphics/gbm/test_internal_client.cpp 2013-06-20 08:30:36 +0000
485@@ -20,7 +20,6 @@
486 #include "mir_toolkit/mesa/native_display.h"
487 #include "src/server/graphics/gbm/internal_client.h"
488 #include "src/server/graphics/gbm/internal_native_surface.h"
489-#include "mir_test_doubles/stub_platform.h"
490 #include "mir_test_doubles/stub_surface.h"
491
492 #include <gtest/gtest.h>

Subscribers

People subscribed via source and target branches