Mir

Merge lp:~vanvugt/mir/remove-unused-session-param into lp:mir

Proposed by Daniel van Vugt
Status: Work in progress
Proposed branch: lp:~vanvugt/mir/remove-unused-session-param
Merge into: lp:mir
Diff against target: 459 lines (+46/-58)
19 files modified
examples/demo-shell/fullscreen_placement_strategy.cpp (+2/-2)
examples/demo-shell/fullscreen_placement_strategy.h (+1/-1)
examples/render_surfaces.cpp (+0/-1)
include/server/mir/shell/placement_strategy.h (+1/-2)
include/server/mir/shell/surface_factory.h (+0/-1)
include/test/mir_test_doubles/mock_surface_factory.h (+1/-2)
src/server/scene/application_session.cpp (+1/-1)
src/server/scene/surface_source.cpp (+0/-1)
src/server/scene/surface_source.h (+0/-1)
src/server/shell/consuming_placement_strategy.cpp (+1/-2)
src/server/shell/consuming_placement_strategy.h (+1/-1)
src/server/shell/organising_surface_factory.cpp (+2/-3)
src/server/shell/organising_surface_factory.h (+0/-2)
tests/acceptance-tests/test_client_input.cpp (+9/-6)
tests/integration-tests/graphics/android/test_internal_client.cpp (+1/-1)
tests/unit-tests/scene/test_application_session.cpp (+11/-11)
tests/unit-tests/scene/test_session_manager.cpp (+4/-4)
tests/unit-tests/shell/test_consuming_placement_strategy.cpp (+3/-5)
tests/unit-tests/shell/test_organising_surface_factory.cpp (+8/-11)
To merge this branch: bzr merge lp:~vanvugt/mir/remove-unused-session-param
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Disapprove
Mir development team Pending
Michael Terry Pending
Review via email: mp+207092@code.launchpad.net

Commit message

Remove unused "session" parameters threaded throughout various classes,
but never used.

Description of the change

Update: This is now the first step on the road to tidying up the various SurfaceFactory interactions.

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
Alan Griffiths (alan-griffiths) wrote :

I think a reasonable PlacementStrategy implementation could make use of this parameter - it would be better to add an example that, e.g. divides the screen into areas (one for each session) - and places surfaces accordingly.

review: Disapprove
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I presently cannot imagine a use for for Session parameter myself. But regardless, we shouldn't keep unused logic. Parameters should only exist if they're presently used, or will be used in the immediate future.

1412. By Daniel van Vugt

Merge latest development-branch

1413. By Daniel van Vugt

Remove lots more unused Session parameters

1414. By Daniel van Vugt

Fix Android build too

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Now applied the same cleanup to SurfaceFactory, which never uses its "Session*" parameter either. Probably fortunately.

1415. By Daniel van Vugt

Remove another unused mention of Session

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yes, unity-mir will need fixing, but it doesn't appear to have a functional use for "session":

$ grep -r requestPlacementFor *
src/unity-mir/initialsurfaceplacementstrategy.cpp: Q_EMIT requestPlacementForSession(&session, x, y);
src/unity-mir/initialsurfaceplacementstrategy.h: void requestPlacementForSession(mir::shell::Session const* session, uint32_t &x, uint32_t &y);
src/modules/Unity/Application/application_manager.cpp: QObject::connect(m_mirServer->placementStrategy(), &InitialSurfacePlacementStrategy::requestPlacementForSession,

Unless it's in a different project?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

BTW, unity-mir will need modification for just about every server API cleanup I've attempted and envisioned of late. It's unfortunate, but will be worthwhile. We just have to check unity-mir regularly to ensure we at least have a plan for how unity-mir can and should be modified when Mir does.

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

> Unless it's in a different project?

We accepted an MP adding that parameter without any tests because Michael Terry submitted it. I assumed he needed it in unity8.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Requested a review from mterry. Maybe he can help identify why this code exists.

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
Michael Terry (mterry) wrote :

I want it for in-progress branch https://code.launchpad.net/~mterry/unity-system-compositor/greeter-depth/+merge/207549

The idea is that I can inspect surface name at surface creation time, to know whether the surface belongs to a greeter or user session, to be able to properly assign depth ID.

If there's now a better way to do such filtering, let me know. But the parameter *is* being used by me right now.

Revision history for this message
Michael Terry (mterry) wrote :

Typo: "The idea is that I can inspect *session* name at surface creation time"

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, well since the session attribute isn't functionally required anywhere within the Mir code, I suggest a different approach: surface.set_session(s);

So you can query the surface session, but it's more clear that it's not a required parameter for surface construction, which it obviously isn't. That would reduce constructor-coupling and allow us to keep most of the simplifications proposed here.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Although once again, to do that nicely we need to enable shells to override shell::Surface with their own class (to receive the virtual set_session call).

This proposal was meant to be a precursor to that feature, now the prerequisite is reversed :S

1416. By Daniel van Vugt

Merge latest development-branch

1417. By Daniel van Vugt

Merge latest development-branch

1418. By Daniel van Vugt

Merge latest development-branch

1419. By Daniel van Vugt

Fix build failure (soft conflict) from recent landings.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1420. By Daniel van Vugt

Merge latest development-branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

1420. By Daniel van Vugt

Merge latest development-branch.

1419. By Daniel van Vugt

Fix build failure (soft conflict) from recent landings.

1418. By Daniel van Vugt

Merge latest development-branch

1417. By Daniel van Vugt

Merge latest development-branch

1416. By Daniel van Vugt

Merge latest development-branch

1415. By Daniel van Vugt

Remove another unused mention of Session

1414. By Daniel van Vugt

Fix Android build too

1413. By Daniel van Vugt

Remove lots more unused Session parameters

1412. By Daniel van Vugt

Merge latest development-branch

1411. By Daniel van Vugt

Remove unused "session" parameter from PlacementStrategy::place().
Also make it const, while we can.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo-shell/fullscreen_placement_strategy.cpp'
2--- examples/demo-shell/fullscreen_placement_strategy.cpp 2013-08-28 03:41:48 +0000
3+++ examples/demo-shell/fullscreen_placement_strategy.cpp 2014-02-26 05:35:45 +0000
4@@ -31,8 +31,8 @@
5 {
6 }
7
8-msh::SurfaceCreationParameters me::FullscreenPlacementStrategy::place(msh::Session const& /* session */,
9- msh::SurfaceCreationParameters const& request_parameters)
10+msh::SurfaceCreationParameters me::FullscreenPlacementStrategy::place(
11+ msh::SurfaceCreationParameters const& request_parameters) const
12 {
13 auto placed_parameters = request_parameters;
14
15
16=== modified file 'examples/demo-shell/fullscreen_placement_strategy.h'
17--- examples/demo-shell/fullscreen_placement_strategy.h 2013-08-28 03:41:48 +0000
18+++ examples/demo-shell/fullscreen_placement_strategy.h 2014-02-26 05:35:45 +0000
19@@ -38,7 +38,7 @@
20 FullscreenPlacementStrategy(std::shared_ptr<shell::DisplayLayout> const& display_layout);
21 ~FullscreenPlacementStrategy() = default;
22
23- shell::SurfaceCreationParameters place(shell::Session const&, shell::SurfaceCreationParameters const& request_parameters);
24+ shell::SurfaceCreationParameters place(shell::SurfaceCreationParameters const& request_parameters) const override;
25
26 protected:
27 FullscreenPlacementStrategy(FullscreenPlacementStrategy const&) = delete;
28
29=== modified file 'examples/render_surfaces.cpp'
30--- examples/render_surfaces.cpp 2014-02-21 11:19:46 +0000
31+++ examples/render_surfaces.cpp 2014-02-26 05:35:45 +0000
32@@ -415,7 +415,6 @@
33 for (auto& m : moveables)
34 {
35 auto const s = surface_factory->create_surface(
36- nullptr,
37 msh::a_surface().of_size(surface_size)
38 .of_pixel_format(surface_pf)
39 .of_buffer_usage(mg::BufferUsage::hardware),
40
41=== modified file 'include/server/mir/shell/placement_strategy.h'
42--- include/server/mir/shell/placement_strategy.h 2013-08-28 03:41:48 +0000
43+++ include/server/mir/shell/placement_strategy.h 2014-02-26 05:35:45 +0000
44@@ -24,7 +24,6 @@
45
46 namespace shell
47 {
48-class Session;
49 struct SurfaceCreationParameters;
50
51 class PlacementStrategy
52@@ -33,7 +32,7 @@
53 virtual ~PlacementStrategy() {}
54 // TODO: It is strange to work in terms of SurfaceCreationParameters here,
55 // perhaps a new interface is needed.
56- virtual SurfaceCreationParameters place(shell::Session const& session, SurfaceCreationParameters const& request_parameters) = 0;
57+ virtual SurfaceCreationParameters place(SurfaceCreationParameters const& request_parameters) const = 0;
58
59
60 protected:
61
62=== modified file 'include/server/mir/shell/surface_factory.h'
63--- include/server/mir/shell/surface_factory.h 2013-08-28 03:41:48 +0000
64+++ include/server/mir/shell/surface_factory.h 2014-02-26 05:35:45 +0000
65@@ -38,7 +38,6 @@
66 {
67 public:
68 virtual std::shared_ptr<Surface> create_surface(
69- Session* session,
70 SurfaceCreationParameters const& params,
71 frontend::SurfaceId id,
72 std::shared_ptr<frontend::EventSink> const& sink) = 0;
73
74=== modified file 'include/test/mir_test_doubles/mock_surface_factory.h'
75--- include/test/mir_test_doubles/mock_surface_factory.h 2013-08-28 03:41:48 +0000
76+++ include/test/mir_test_doubles/mock_surface_factory.h 2014-02-26 05:35:45 +0000
77@@ -33,8 +33,7 @@
78
79 struct MockSurfaceFactory : public shell::SurfaceFactory
80 {
81- MOCK_METHOD4(create_surface, std::shared_ptr<shell::Surface>(
82- shell::Session*,
83+ MOCK_METHOD3(create_surface, std::shared_ptr<shell::Surface>(
84 const shell::SurfaceCreationParameters&,
85 frontend::SurfaceId,
86 std::shared_ptr<frontend::EventSink> const&));
87
88=== modified file 'src/server/scene/application_session.cpp'
89--- src/server/scene/application_session.cpp 2014-02-24 13:45:23 +0000
90+++ src/server/scene/application_session.cpp 2014-02-26 05:35:45 +0000
91@@ -70,7 +70,7 @@
92 mf::SurfaceId ms::ApplicationSession::create_surface(const msh::SurfaceCreationParameters& params)
93 {
94 auto const id = next_id();
95- auto surf = surface_factory->create_surface(this, params, id, event_sink);
96+ auto surf = surface_factory->create_surface(params, id, event_sink);
97
98 std::unique_lock<std::mutex> lock(surfaces_mutex);
99 surfaces[id] = surf;
100
101=== modified file 'src/server/scene/surface_source.cpp'
102--- src/server/scene/surface_source.cpp 2014-01-13 06:12:33 +0000
103+++ src/server/scene/surface_source.cpp 2014-02-26 05:35:45 +0000
104@@ -37,7 +37,6 @@
105 }
106
107 std::shared_ptr<msh::Surface> ms::SurfaceSource::create_surface(
108- msh::Session* /*session*/,
109 shell::SurfaceCreationParameters const& params,
110 frontend::SurfaceId id,
111 std::shared_ptr<mf::EventSink> const& sender)
112
113=== modified file 'src/server/scene/surface_source.h'
114--- src/server/scene/surface_source.h 2014-01-13 06:12:33 +0000
115+++ src/server/scene/surface_source.h 2014-02-26 05:35:45 +0000
116@@ -44,7 +44,6 @@
117 virtual ~SurfaceSource() {}
118
119 std::shared_ptr<shell::Surface> create_surface(
120- shell::Session* session,
121 shell::SurfaceCreationParameters const& params,
122 frontend::SurfaceId id,
123 std::shared_ptr<frontend::EventSink> const& sink);
124
125=== modified file 'src/server/shell/consuming_placement_strategy.cpp'
126--- src/server/shell/consuming_placement_strategy.cpp 2014-01-13 06:12:33 +0000
127+++ src/server/shell/consuming_placement_strategy.cpp 2014-02-26 05:35:45 +0000
128@@ -35,8 +35,7 @@
129 }
130
131 msh::SurfaceCreationParameters msh::ConsumingPlacementStrategy::place(
132- msh::Session const& /* session */,
133- msh::SurfaceCreationParameters const& request_parameters)
134+ msh::SurfaceCreationParameters const& request_parameters) const
135 {
136 mir::graphics::DisplayConfigurationOutputId const output_id_invalid{
137 mir_display_output_id_invalid};
138
139=== modified file 'src/server/shell/consuming_placement_strategy.h'
140--- src/server/shell/consuming_placement_strategy.h 2014-01-13 06:12:33 +0000
141+++ src/server/shell/consuming_placement_strategy.h 2014-02-26 05:35:45 +0000
142@@ -36,7 +36,7 @@
143 std::shared_ptr<DisplayLayout> const& display_layout);
144 virtual ~ConsumingPlacementStrategy() {}
145
146- virtual shell::SurfaceCreationParameters place(shell::Session const& session, shell::SurfaceCreationParameters const& request_parameters);
147+ virtual shell::SurfaceCreationParameters place(shell::SurfaceCreationParameters const& request_parameters) const override;
148
149 protected:
150 ConsumingPlacementStrategy(ConsumingPlacementStrategy const&) = delete;
151
152=== modified file 'src/server/shell/organising_surface_factory.cpp'
153--- src/server/shell/organising_surface_factory.cpp 2014-01-13 06:12:33 +0000
154+++ src/server/shell/organising_surface_factory.cpp 2014-02-26 05:35:45 +0000
155@@ -35,13 +35,12 @@
156 }
157
158 std::shared_ptr<msh::Surface> msh::OrganisingSurfaceFactory::create_surface(
159- Session* session,
160 shell::SurfaceCreationParameters const& params,
161 frontend::SurfaceId id,
162 std::shared_ptr<mf::EventSink> const& sender)
163 {
164- auto placed_params = placement_strategy->place(*session, params);
165+ auto placed_params = placement_strategy->place(params);
166
167- return underlying_factory->create_surface(session, placed_params, id, sender);
168+ return underlying_factory->create_surface(placed_params, id, sender);
169 }
170
171
172=== modified file 'src/server/shell/organising_surface_factory.h'
173--- src/server/shell/organising_surface_factory.h 2014-01-13 06:12:33 +0000
174+++ src/server/shell/organising_surface_factory.h 2014-02-26 05:35:45 +0000
175@@ -28,7 +28,6 @@
176 namespace shell
177 {
178 class PlacementStrategy;
179-class Session;
180
181 class OrganisingSurfaceFactory : public SurfaceFactory
182 {
183@@ -38,7 +37,6 @@
184 virtual ~OrganisingSurfaceFactory();
185
186 std::shared_ptr<Surface> create_surface(
187- Session* session,
188 shell::SurfaceCreationParameters const& params,
189 frontend::SurfaceId id,
190 std::shared_ptr<frontend::EventSink> const& sink) override;
191
192=== modified file 'tests/acceptance-tests/test_client_input.cpp'
193--- tests/acceptance-tests/test_client_input.cpp 2014-02-18 10:33:14 +0000
194+++ tests/acceptance-tests/test_client_input.cpp 2014-02-26 05:35:45 +0000
195@@ -84,7 +84,7 @@
196 {
197 }
198
199- msh::SurfaceCreationParameters place(msh::Session const& session, msh::SurfaceCreationParameters const& request_parameters)
200+ msh::SurfaceCreationParameters place(msh::SurfaceCreationParameters const& request_parameters) const override
201 {
202 auto placed = request_parameters;
203 auto const& name = request_parameters.name;
204@@ -98,9 +98,13 @@
205 }
206 else
207 {
208- placed = underlying_strategy->place(session, placed);
209+ placed = underlying_strategy->place(placed);
210 }
211- placed.depth = surface_depths_by_name[name];
212+
213+ // Use find instead of [] here as we're limited to const operations
214+ auto const d = surface_depths_by_name.find(name);
215+ if (d != surface_depths_by_name.end())
216+ placed.depth = d->second;
217
218 return placed;
219 }
220@@ -378,12 +382,11 @@
221 {
222 }
223
224- std::shared_ptr<msh::Surface> create_surface(msh::Session* session,
225- msh::SurfaceCreationParameters const& params,
226+ std::shared_ptr<msh::Surface> create_surface(msh::SurfaceCreationParameters const& params,
227 mf::SurfaceId id,
228 std::shared_ptr<mf::EventSink> const& sink)
229 {
230- auto surface = underlying_factory->create_surface(session, params, id, sink);
231+ auto surface = underlying_factory->create_surface(params, id, sink);
232
233 surface->set_input_region(input_rectangles);
234
235
236=== modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp'
237--- tests/integration-tests/graphics/android/test_internal_client.cpp 2014-02-17 22:35:23 +0000
238+++ tests/integration-tests/graphics/android/test_internal_client.cpp 2014-02-26 05:35:45 +0000
239@@ -100,7 +100,7 @@
240 auto ss = std::make_shared<ms::SurfaceStack>(surface_allocator, stub_input_registrar, scene_report);
241 auto surface_controller = std::make_shared<ms::SurfaceController>(ss);
242 auto surface_source = std::make_shared<ms::SurfaceSource>(surface_controller, std::make_shared<mtd::NullSurfaceConfigurator>());
243- auto surface = surface_source->create_surface(nullptr, params, id, std::shared_ptr<mf::EventSink>());
244+ auto surface = surface_source->create_surface(params, id, std::shared_ptr<mf::EventSink>());
245 surface->allow_framedropping(true);
246 auto mir_surface = as_internal_surface(surface);
247
248
249=== modified file 'tests/unit-tests/scene/test_application_session.cpp'
250--- tests/unit-tests/scene/test_application_session.cpp 2014-02-24 13:45:23 +0000
251+++ tests/unit-tests/scene/test_application_session.cpp 2014-02-26 05:35:45 +0000
252@@ -86,7 +86,7 @@
253 mtd::NullEventSink sender;
254 mtd::MockSurfaceFactory surface_factory;
255
256- EXPECT_CALL(surface_factory, create_surface(_, _, _, _))
257+ EXPECT_CALL(surface_factory, create_surface(_, _, _))
258 .WillOnce(Return(mock_surface));
259
260 mtd::MockSessionListener listener;
261@@ -117,9 +117,9 @@
262
263 mtd::NullEventSink sender;
264 mtd::MockSurfaceFactory surface_factory;
265- ON_CALL(surface_factory, create_surface(_,_,_,_)).WillByDefault(Return(mock_surface));
266+ ON_CALL(surface_factory, create_surface(_,_,_)).WillByDefault(Return(mock_surface));
267
268- EXPECT_CALL(surface_factory, create_surface(_, _, _, _));
269+ EXPECT_CALL(surface_factory, create_surface(_, _, _));
270
271 mtd::MockSessionListener listener;
272 EXPECT_CALL(listener, surface_created(_, _)).Times(1);
273@@ -148,11 +148,11 @@
274
275 {
276 InSequence seq;
277- EXPECT_CALL(surface_factory, create_surface(_, _, _, _)).Times(1)
278- .WillOnce(Return(make_mock_surface()));
279- EXPECT_CALL(surface_factory, create_surface(_, _, _, _)).Times(1)
280- .WillOnce(Return(make_mock_surface()));
281- EXPECT_CALL(surface_factory, create_surface(_, _, _, _)).Times(1)
282+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
283+ .WillOnce(Return(make_mock_surface()));
284+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
285+ .WillOnce(Return(make_mock_surface()));
286+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
287 .WillOnce(Return(make_mock_surface()));
288 }
289
290@@ -191,7 +191,7 @@
291 auto mock_surface = make_mock_surface();
292
293 mtd::MockSurfaceFactory surface_factory;
294- ON_CALL(surface_factory, create_surface(_, _, _, _)).WillByDefault(Return(mock_surface));
295+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(Return(mock_surface));
296
297 ms::ApplicationSession app_session(
298 mt::fake_shared(surface_factory),
299@@ -201,7 +201,7 @@
300 std::make_shared<msh::NullSessionListener>(),
301 mt::fake_shared(sender));
302
303- EXPECT_CALL(surface_factory, create_surface(_, _, _, _));
304+ EXPECT_CALL(surface_factory, create_surface(_, _, _));
305
306 {
307 InSequence seq;
308@@ -271,7 +271,7 @@
309 std::static_pointer_cast<msh::SurfaceBufferAccess>(default_surface);
310 auto const snapshot_strategy = std::make_shared<MockSnapshotStrategy>();
311
312- EXPECT_CALL(surface_factory, create_surface(_,_,_,_))
313+ EXPECT_CALL(surface_factory, create_surface(_,_,_))
314 .WillOnce(Return(default_surface));
315
316 EXPECT_CALL(*snapshot_strategy,
317
318=== modified file 'tests/unit-tests/scene/test_session_manager.cpp'
319--- tests/unit-tests/scene/test_session_manager.cpp 2014-02-07 12:54:45 +0000
320+++ tests/unit-tests/scene/test_session_manager.cpp 2014-02-26 05:35:45 +0000
321@@ -112,9 +112,9 @@
322 {
323 using namespace ::testing;
324
325- EXPECT_CALL(surface_factory, create_surface(_, _, _, _)).Times(1);
326+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1);
327
328- ON_CALL(surface_factory, create_surface(_, _, _, _)).WillByDefault(
329+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(
330 Return(std::make_shared<ms::SurfaceImpl>(
331 mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(),
332 msh::a_surface(),mf::SurfaceId{}, std::shared_ptr<mf::EventSink>())));
333@@ -147,7 +147,7 @@
334 TEST_F(SessionManagerSetup, create_surface_for_session_forwards_and_then_focuses_session)
335 {
336 using namespace ::testing;
337- ON_CALL(surface_factory, create_surface(_, _, _, _)).WillByDefault(
338+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(
339 Return(std::make_shared<ms::SurfaceImpl>(
340 mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(),
341 msh::a_surface(),mf::SurfaceId{}, std::shared_ptr<mf::EventSink>())));
342@@ -157,7 +157,7 @@
343 InSequence seq;
344
345 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Session creation
346- EXPECT_CALL(surface_factory, create_surface(_, _, _, _)).Times(1);
347+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1);
348 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Post Surface creation
349 }
350
351
352=== modified file 'tests/unit-tests/shell/test_consuming_placement_strategy.cpp'
353--- tests/unit-tests/shell/test_consuming_placement_strategy.cpp 2014-01-13 06:12:33 +0000
354+++ tests/unit-tests/shell/test_consuming_placement_strategy.cpp 2014-02-26 05:35:45 +0000
355@@ -17,7 +17,6 @@
356 */
357
358 #include "mir_test_doubles/mock_display_layout.h"
359-#include "mir_test_doubles/stub_shell_session.h"
360
361 #include "src/server/shell/consuming_placement_strategy.h"
362 #include "mir/shell/surface_creation_parameters.h"
363@@ -43,7 +42,6 @@
364 }
365
366 std::shared_ptr<mtd::MockDisplayLayout> display_layout;
367- mtd::StubShellSession session;
368 };
369 }
370
371@@ -59,7 +57,7 @@
372
373 msh::ConsumingPlacementStrategy placement_strategy(display_layout);
374
375- placement_strategy.place(session, input_params);
376+ placement_strategy.place(input_params);
377 }
378
379 TEST_F(ConsumingPlacementStrategySetup, parameters_with_geometry_are_clipped)
380@@ -74,7 +72,7 @@
381
382 msh::ConsumingPlacementStrategy placement_strategy(display_layout);
383
384- placement_strategy.place(session, input_params);
385+ placement_strategy.place(input_params);
386 }
387
388 TEST_F(ConsumingPlacementStrategySetup, parameters_with_output_id_are_placed_in_output)
389@@ -92,5 +90,5 @@
390
391 msh::ConsumingPlacementStrategy placement_strategy(display_layout);
392
393- placement_strategy.place(session, input_params);
394+ placement_strategy.place(input_params);
395 }
396
397=== modified file 'tests/unit-tests/shell/test_organising_surface_factory.cpp'
398--- tests/unit-tests/shell/test_organising_surface_factory.cpp 2014-01-13 06:12:33 +0000
399+++ tests/unit-tests/shell/test_organising_surface_factory.cpp 2014-02-26 05:35:45 +0000
400@@ -19,10 +19,8 @@
401 #include "src/server/shell/organising_surface_factory.h"
402 #include "mir/shell/placement_strategy.h"
403 #include "mir/shell/surface_creation_parameters.h"
404-#include "mir/shell/session.h"
405
406 #include "mir_test_doubles/mock_surface_factory.h"
407-#include "mir_test_doubles/stub_shell_session.h"
408 #include "mir_test_doubles/null_event_sink.h"
409
410 #include <gtest/gtest.h>
411@@ -38,7 +36,7 @@
412
413 struct MockPlacementStrategy : public msh::PlacementStrategy
414 {
415- MOCK_METHOD2(place, msh::SurfaceCreationParameters(msh::Session const&, msh::SurfaceCreationParameters const&));
416+ MOCK_CONST_METHOD1(place, msh::SurfaceCreationParameters(msh::SurfaceCreationParameters const&));
417 };
418
419 struct OrganisingSurfaceFactorySetup : public testing::Test
420@@ -48,7 +46,7 @@
421 using namespace ::testing;
422
423 underlying_surface_factory = std::make_shared<mtd::MockSurfaceFactory>();
424- ON_CALL(*underlying_surface_factory, create_surface(_, _, _, _)).WillByDefault(Return(null_surface));
425+ ON_CALL(*underlying_surface_factory, create_surface(_, _, _)).WillByDefault(Return(null_surface));
426
427 placement_strategy = std::make_shared<MockPlacementStrategy>();
428 }
429@@ -65,14 +63,13 @@
430
431 msh::OrganisingSurfaceFactory factory(underlying_surface_factory, placement_strategy);
432
433- mtd::StubShellSession session;
434- EXPECT_CALL(*underlying_surface_factory, create_surface(_, _, _, _)).Times(1);
435+ EXPECT_CALL(*underlying_surface_factory, create_surface(_, _, _)).Times(1);
436
437 auto params = msh::a_surface();
438- EXPECT_CALL(*placement_strategy, place(Ref(session), Ref(params))).Times(1)
439+ EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
440 .WillOnce(Return(msh::a_surface()));
441
442- factory.create_surface(&session, params, mf::SurfaceId(), std::make_shared<mtd::NullEventSink>());
443+ factory.create_surface(params, mf::SurfaceId(), std::make_shared<mtd::NullEventSink>());
444 }
445
446 TEST_F(OrganisingSurfaceFactorySetup, forwards_create_surface_parameters_from_placement_strategy_to_underlying_factory)
447@@ -86,9 +83,9 @@
448 auto placed_params = params;
449 placed_params.size.width = geom::Width{100};
450
451- EXPECT_CALL(*placement_strategy, place(_, Ref(params))).Times(1)
452+ EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
453 .WillOnce(Return(placed_params));
454- EXPECT_CALL(*underlying_surface_factory, create_surface(nullptr, placed_params, mf::SurfaceId(), sink));
455+ EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params, mf::SurfaceId(), sink));
456
457- factory.create_surface(nullptr, params, mf::SurfaceId(), sink);
458+ factory.create_surface(params, mf::SurfaceId(), sink);
459 }

Subscribers

People subscribed via source and target branches