Mir

Merge lp:~alan-griffiths/mir/fix-1276704 into lp:mir

Proposed by Alan Griffiths on 2014-02-07
Status: Merged
Approved by: Daniel van Vugt on 2014-02-10
Approved revision: 1382
Merged at revision: 1381
Proposed branch: lp:~alan-griffiths/mir/fix-1276704
Merge into: lp:mir
Diff against target: 903 lines (+194/-91)
24 files modified
examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+4/-2)
include/server/mir/frontend/shell.h (+8/-2)
include/server/mir/shell/session.h (+6/-5)
include/test/mir_test_doubles/mock_shell.h (+6/-3)
include/test/mir_test_doubles/mock_shell_session.h (+2/-1)
include/test/mir_test_doubles/stub_ipc_factory.h (+2/-2)
include/test/mir_test_doubles/stub_shell.h (+1/-1)
include/test/mir_test_doubles/stub_shell_session.h (+6/-1)
src/server/frontend/default_configuration.cpp (+5/-2)
src/server/frontend/protobuf_ipc_factory.h (+7/-2)
src/server/frontend/protobuf_session_creator.cpp (+2/-2)
src/server/frontend/session_mediator.cpp (+4/-2)
src/server/frontend/session_mediator.h (+3/-1)
src/server/scene/application_session.cpp (+8/-1)
src/server/scene/application_session.h (+4/-1)
src/server/scene/session_manager.cpp (+6/-4)
src/server/scene/session_manager.h (+5/-2)
tests/integration-tests/test_session.cpp (+2/-1)
tests/integration-tests/test_session_manager.cpp (+6/-6)
tests/unit-tests/frontend/test_session_mediator.cpp (+5/-5)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+2/-2)
tests/unit-tests/scene/test_application_session.cpp (+91/-34)
tests/unit-tests/scene/test_session_manager.cpp (+8/-8)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1276704
Reviewer Review Type Date Requested Status
Gerry Boland (community) 2014-02-07 Approve on 2014-02-07
PS Jenkins bot (community) continuous-integration Approve on 2014-02-07
Review via email: mp+205357@code.launchpad.net

Commit message

frontend, shell: provide the client process ID in the shell::Session interface (LP: #1276704)

Description of the change

frontend, shell: provide the client process ID in the shell::Session interface

To post a comment you must log in.
lp:~alan-griffiths/mir/fix-1276704 updated on 2014-02-07
1382. By Alan Griffiths on 2014-02-07

Fix android FTBS

Gerry Boland (gerboland) wrote :

Gives me what I need, thanks!

review: Approve
Daniel van Vugt (vanvugt) wrote :

I haven't reviewed it, but it seems we're desperate to push this to archive, so top-approving.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp'
2--- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-01-13 06:12:33 +0000
3+++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-02-07 14:29:43 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright © 2013 Canonical Ltd.
7+ * Copyright © 2013-2014 Canonical Ltd.
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 3 as
11@@ -41,6 +41,8 @@
12
13 #include <xkbcommon/xkbcommon-keysyms.h>
14
15+#include <unistd.h>
16+
17 #include <functional>
18
19 #include <assert.h>
20@@ -93,7 +95,7 @@
21 .of_size(surface_size)
22 .of_buffer_usage(mg::BufferUsage::hardware)
23 .of_pixel_format(mir_pixel_format_argb_8888);
24- auto session = shell->open_session("Inprocess client", std::make_shared<NullEventSink>());
25+ auto session = shell->open_session(getpid(), "Inprocess client", std::make_shared<NullEventSink>());
26 // TODO: Why do we get an ID? ~racarr
27 auto surface = session->get_surface(shell->create_surface_for(session, params));
28
29
30=== modified file 'include/server/mir/frontend/shell.h'
31--- include/server/mir/frontend/shell.h 2014-01-13 06:12:33 +0000
32+++ include/server/mir/frontend/shell.h 2014-02-07 14:29:43 +0000
33@@ -1,5 +1,5 @@
34 /*
35- * Copyright © 2012 Canonical Ltd.
36+ * Copyright © 2012-2014 Canonical Ltd.
37 *
38 * This program is free software: you can redistribute it and/or modify it
39 * under the terms of the GNU General Public License version 3,
40@@ -20,6 +20,9 @@
41 #define MIR_FRONTEND_SHELL_H_
42
43 #include "mir/frontend/surface_id.h"
44+
45+#include <sys/types.h>
46+
47 #include <memory>
48
49 namespace mir
50@@ -39,7 +42,10 @@
51 virtual ~Shell() = default;
52
53 virtual std::shared_ptr<Session> open_session(
54- std::string const& name, std::shared_ptr<EventSink> const& sink) = 0;
55+ pid_t client_pid,
56+ std::string const& name,
57+ std::shared_ptr<EventSink> const& sink) = 0;
58+
59 virtual void close_session(std::shared_ptr<Session> const& session) = 0;
60
61 virtual SurfaceId create_surface_for(std::shared_ptr<Session> const& session,
62
63=== modified file 'include/server/mir/shell/session.h'
64--- include/server/mir/shell/session.h 2014-01-13 06:12:33 +0000
65+++ include/server/mir/shell/session.h 2014-02-07 14:29:43 +0000
66@@ -1,5 +1,5 @@
67 /*
68- * Copyright © 2012 Canonical Ltd.
69+ * Copyright © 2012-2014 Canonical Ltd.
70 *
71 * This program is free software: you can redistribute it and/or modify it
72 * under the terms of the GNU General Public License version 3,
73@@ -7,11 +7,11 @@
74 *
75 * This program is distributed in the hope that it will be useful,
76 * but WITHOUT ANY WARRANTY; without even the implied warranty of
77- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79 * GNU General Public License for more details.
80 *
81 * You should have received a copy of the GNU General Public License
82- * along with this program. If not, see <http://www.gnu.org/licenses/>.
83+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
84 *
85 * Authored By: Robert Carr <racarr@canonical.com>
86 */
87@@ -22,9 +22,10 @@
88 #include "mir/frontend/session.h"
89 #include "mir/shell/snapshot.h"
90
91+#include <sys/types.h>
92+
93 namespace mir
94 {
95-
96 namespace shell
97 {
98 class Surface;
99@@ -34,12 +35,12 @@
100 public:
101 virtual std::string name() const = 0;
102 virtual void force_requests_to_complete() = 0;
103+ virtual pid_t process_id() const = 0;
104
105 virtual void take_snapshot(SnapshotCallback const& snapshot_taken) = 0;
106 virtual std::shared_ptr<Surface> default_surface() const = 0;
107 virtual void set_lifecycle_state(MirLifecycleState state) = 0;
108 };
109-
110 }
111 }
112
113
114=== modified file 'include/test/mir_test_doubles/mock_shell.h'
115--- include/test/mir_test_doubles/mock_shell.h 2013-08-28 03:41:48 +0000
116+++ include/test/mir_test_doubles/mock_shell.h 2014-02-07 14:29:43 +0000
117@@ -1,5 +1,5 @@
118 /*
119- * Copyright © 2013 Canonical Ltd.
120+ * Copyright © 2013-2014 Canonical Ltd.
121 *
122 * This program is free software: you can redistribute it and/or modify
123 * it under the terms of the GNU General Public License version 3 as
124@@ -34,8 +34,11 @@
125
126 struct MockShell : public frontend::Shell
127 {
128- MOCK_METHOD2(open_session, std::shared_ptr<frontend::Session>(
129- std::string const&, std::shared_ptr<frontend::EventSink> const&));
130+ MOCK_METHOD3(open_session, std::shared_ptr<frontend::Session>(
131+ pid_t client_pid,
132+ std::string const&,
133+ std::shared_ptr<frontend::EventSink> const&));
134+
135 MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&));
136
137 MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, shell::SurfaceCreationParameters const&));
138
139=== modified file 'include/test/mir_test_doubles/mock_shell_session.h'
140--- include/test/mir_test_doubles/mock_shell_session.h 2014-01-13 06:12:33 +0000
141+++ include/test/mir_test_doubles/mock_shell_session.h 2014-02-07 14:29:43 +0000
142@@ -1,5 +1,5 @@
143 /*
144- * Copyright © 2013 Canonical Ltd.
145+ * Copyright © 2013-2014 Canonical Ltd.
146 *
147 * This program is free software: you can redistribute it and/or modify it
148 * under the terms of the GNU General Public License version 3,
149@@ -42,6 +42,7 @@
150 MOCK_CONST_METHOD0(default_surface, std::shared_ptr<shell::Surface>());
151
152 MOCK_CONST_METHOD0(name, std::string());
153+ MOCK_CONST_METHOD0(process_id, pid_t());
154 MOCK_METHOD0(force_requests_to_complete, void());
155
156 MOCK_METHOD0(hide, void());
157
158=== modified file 'include/test/mir_test_doubles/stub_ipc_factory.h'
159--- include/test/mir_test_doubles/stub_ipc_factory.h 2014-01-21 06:27:40 +0000
160+++ include/test/mir_test_doubles/stub_ipc_factory.h 2014-02-07 14:29:43 +0000
161@@ -1,5 +1,5 @@
162 /*
163- * Copyright © 2012 Canonical Ltd.
164+ * Copyright © 2012-2014 Canonical Ltd.
165 *
166 * This program is free software: you can redistribute it and/or modify it
167 * under the terms of the GNU General Public License version 3,
168@@ -41,7 +41,7 @@
169 }
170
171 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
172- std::shared_ptr<frontend::EventSink> const&, bool) override
173+ pid_t, std::shared_ptr<frontend::EventSink> const&, bool) override
174 {
175 return server;
176 }
177
178=== modified file 'include/test/mir_test_doubles/stub_shell.h'
179--- include/test/mir_test_doubles/stub_shell.h 2013-08-28 03:41:48 +0000
180+++ include/test/mir_test_doubles/stub_shell.h 2014-02-07 14:29:43 +0000
181@@ -34,7 +34,7 @@
182 StubShell() : stub_session(std::make_shared<StubSession>())
183 {
184 }
185- std::shared_ptr<frontend::Session> open_session(std::string const& /* name */, std::shared_ptr<frontend::EventSink> const& /* sink */) override
186+ std::shared_ptr<frontend::Session> open_session(pid_t, std::string const& /* name */, std::shared_ptr<frontend::EventSink> const& /* sink */) override
187 {
188 return stub_session;
189 }
190
191=== modified file 'include/test/mir_test_doubles/stub_shell_session.h'
192--- include/test/mir_test_doubles/stub_shell_session.h 2014-01-13 06:12:33 +0000
193+++ include/test/mir_test_doubles/stub_shell_session.h 2014-02-07 14:29:43 +0000
194@@ -1,5 +1,5 @@
195 /*
196- * Copyright © 2013 Canonical Ltd.
197+ * Copyright © 2013-2014 Canonical Ltd.
198 *
199 * This program is free software: you can redistribute it and/or modify it
200 * under the terms of the GNU General Public License version 3,
201@@ -45,6 +45,11 @@
202 {
203 return std::string();
204 }
205+ pid_t process_id() const override
206+ {
207+ return -1;
208+ }
209+
210 void force_requests_to_complete() override
211 {
212 }
213
214=== modified file 'src/server/frontend/default_configuration.cpp'
215--- src/server/frontend/default_configuration.cpp 2014-01-30 13:27:59 +0000
216+++ src/server/frontend/default_configuration.cpp 2014-02-07 14:29:43 +0000
217@@ -1,5 +1,5 @@
218 /*
219- * Copyright © 2012 Canonical Ltd.
220+ * Copyright © 2012-2014 Canonical Ltd.
221 *
222 * This program is free software: you can redistribute it and/or modify it
223 * under the terms of the GNU General Public License version 3,
224@@ -64,7 +64,9 @@
225 std::shared_ptr<mf::Screencast> const screencast;
226
227 virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server(
228- std::shared_ptr<mf::EventSink> const& sink, bool authorized_to_resize_display)
229+ pid_t client_pid,
230+ std::shared_ptr<mf::EventSink> const& sink,
231+ bool authorized_to_resize_display) override
232 {
233 std::shared_ptr<mf::DisplayChanger> changer;
234 if(authorized_to_resize_display)
235@@ -77,6 +79,7 @@
236 }
237
238 return std::make_shared<mf::SessionMediator>(
239+ client_pid,
240 shell,
241 graphics_platform,
242 changer,
243
244=== modified file 'src/server/frontend/protobuf_ipc_factory.h'
245--- src/server/frontend/protobuf_ipc_factory.h 2014-01-21 06:27:40 +0000
246+++ src/server/frontend/protobuf_ipc_factory.h 2014-02-07 14:29:43 +0000
247@@ -1,5 +1,5 @@
248 /*
249- * Copyright © 2012 Canonical Ltd.
250+ * Copyright © 2012-2014 Canonical Ltd.
251 *
252 * This program is free software: you can redistribute it and/or modify it
253 * under the terms of the GNU General Public License version 3,
254@@ -19,6 +19,8 @@
255 #ifndef MIR_FRONTEND_PROTOBUF_IPC_FACTORY_H_
256 #define MIR_FRONTEND_PROTOBUF_IPC_FACTORY_H_
257
258+#include <sys/types.h>
259+
260 #include <memory>
261
262 namespace mir
263@@ -37,7 +39,10 @@
264 {
265 public:
266 virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
267- std::shared_ptr<EventSink> const& sink, bool authorized_to_resize_display) = 0;
268+ pid_t client_pid,
269+ std::shared_ptr<EventSink> const& sink,
270+ bool authorized_to_resize_display) = 0;
271+
272 virtual std::shared_ptr<ResourceCache> resource_cache() = 0;
273
274 protected:
275
276=== modified file 'src/server/frontend/protobuf_session_creator.cpp'
277--- src/server/frontend/protobuf_session_creator.cpp 2014-01-22 15:54:11 +0000
278+++ src/server/frontend/protobuf_session_creator.cpp 2014-02-07 14:29:43 +0000
279@@ -1,5 +1,5 @@
280 /*
281- * Copyright © 2013 Canonical Ltd.
282+ * Copyright © 2013-2014 Canonical Ltd.
283 *
284 * This program is free software: you can redistribute it and/or modify it
285 * under the terms of the GNU General Public License version 3,
286@@ -69,7 +69,7 @@
287 auto const event_sink = std::make_shared<detail::EventSender>(messenger);
288 auto const msg_processor = create_processor(
289 message_sender,
290- ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display),
291+ ipc_factory->make_ipc_server(client_pid, event_sink, authorized_to_resize_display),
292 report);
293
294 const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor);
295
296=== modified file 'src/server/frontend/session_mediator.cpp'
297--- src/server/frontend/session_mediator.cpp 2014-02-06 09:51:46 +0000
298+++ src/server/frontend/session_mediator.cpp 2014-02-07 14:29:43 +0000
299@@ -1,5 +1,5 @@
300 /*
301- * Copyright © 2012 Canonical Ltd.
302+ * Copyright © 2012-2014 Canonical Ltd.
303 *
304 * This program is free software: you can redistribute it and/or modify it
305 * under the terms of the GNU General Public License version 3,
306@@ -56,6 +56,7 @@
307 namespace geom = mir::geometry;
308
309 mf::SessionMediator::SessionMediator(
310+ pid_t client_pid,
311 std::shared_ptr<frontend::Shell> const& shell,
312 std::shared_ptr<graphics::Platform> const & graphics_platform,
313 std::shared_ptr<mf::DisplayChanger> const& display_changer,
314@@ -64,6 +65,7 @@
315 std::shared_ptr<EventSink> const& sender,
316 std::shared_ptr<ResourceCache> const& resource_cache,
317 std::shared_ptr<Screencast> const& screencast) :
318+ client_pid(client_pid),
319 shell(shell),
320 graphics_platform(graphics_platform),
321 surface_pixel_formats(surface_pixel_formats),
322@@ -95,7 +97,7 @@
323
324 {
325 std::unique_lock<std::mutex> lock(session_mutex);
326- weak_session = shell->open_session(request->application_name(), event_sink);
327+ weak_session = shell->open_session(client_pid, request->application_name(), event_sink);
328 }
329
330 auto ipc_package = graphics_platform->get_ipc_package();
331
332=== modified file 'src/server/frontend/session_mediator.h'
333--- src/server/frontend/session_mediator.h 2014-02-06 09:51:46 +0000
334+++ src/server/frontend/session_mediator.h 2014-02-07 14:29:43 +0000
335@@ -1,5 +1,5 @@
336 /*
337- * Copyright © 2012 Canonical Ltd.
338+ * Copyright © 2012-2014 Canonical Ltd.
339 *
340 * This program is free software: you can redistribute it and/or modify it
341 * under the terms of the GNU General Public License version 3,
342@@ -60,6 +60,7 @@
343 {
344 public:
345 SessionMediator(
346+ pid_t client_pid,
347 std::shared_ptr<Shell> const& shell,
348 std::shared_ptr<graphics::Platform> const& graphics_platform,
349 std::shared_ptr<frontend::DisplayChanger> const& display_changer,
350@@ -135,6 +136,7 @@
351 bool need_full_ipc);
352
353 void advance_buffer(SurfaceId surf_id, Surface& surface, std::function<void(graphics::Buffer*, bool)> complete);
354+ pid_t client_pid;
355 std::shared_ptr<Shell> const shell;
356 std::shared_ptr<graphics::Platform> const graphics_platform;
357
358
359=== modified file 'src/server/scene/application_session.cpp'
360--- src/server/scene/application_session.cpp 2014-01-13 06:12:33 +0000
361+++ src/server/scene/application_session.cpp 2014-02-07 14:29:43 +0000
362@@ -1,5 +1,5 @@
363 /*
364- * Copyright © 2012 Canonical Ltd.
365+ * Copyright © 2012-2014 Canonical Ltd.
366 *
367 * This program is free software: you can redistribute it and/or modify it
368 * under the terms of the GNU General Public License version 3,
369@@ -37,11 +37,13 @@
370
371 ms::ApplicationSession::ApplicationSession(
372 std::shared_ptr<msh::SurfaceFactory> const& surface_factory,
373+ pid_t pid,
374 std::string const& session_name,
375 std::shared_ptr<SnapshotStrategy> const& snapshot_strategy,
376 std::shared_ptr<msh::SessionListener> const& session_listener,
377 std::shared_ptr<mf::EventSink> const& sink) :
378 surface_factory(surface_factory),
379+ pid(pid),
380 session_name(session_name),
381 snapshot_strategy(snapshot_strategy),
382 session_listener(session_listener),
383@@ -125,6 +127,11 @@
384 return session_name;
385 }
386
387+pid_t ms::ApplicationSession::process_id() const
388+{
389+ return pid;
390+}
391+
392 void ms::ApplicationSession::force_requests_to_complete()
393 {
394 std::unique_lock<std::mutex> lock(surfaces_mutex);
395
396=== modified file 'src/server/scene/application_session.h'
397--- src/server/scene/application_session.h 2014-01-13 06:12:33 +0000
398+++ src/server/scene/application_session.h 2014-02-07 14:29:43 +0000
399@@ -1,5 +1,5 @@
400 /*
401- * Copyright © 2013 Canonical Ltd.
402+ * Copyright © 2013-2014 Canonical Ltd.
403 *
404 * This program is free software: you can redistribute it and/or modify it
405 * under the terms of the GNU General Public License version 3,
406@@ -45,6 +45,7 @@
407 public:
408 ApplicationSession(
409 std::shared_ptr<shell::SurfaceFactory> const& surface_factory,
410+ pid_t pid,
411 std::string const& session_name,
412 std::shared_ptr<SnapshotStrategy> const& snapshot_strategy,
413 std::shared_ptr<shell::SessionListener> const& session_listener,
414@@ -60,6 +61,7 @@
415 std::shared_ptr<shell::Surface> default_surface() const;
416
417 std::string name() const;
418+ pid_t process_id() const override;
419
420 void force_requests_to_complete();
421
422@@ -77,6 +79,7 @@
423
424 private:
425 std::shared_ptr<shell::SurfaceFactory> const surface_factory;
426+ pid_t const pid;
427 std::string const session_name;
428 std::shared_ptr<SnapshotStrategy> const snapshot_strategy;
429 std::shared_ptr<shell::SessionListener> const session_listener;
430
431=== modified file 'src/server/scene/session_manager.cpp'
432--- src/server/scene/session_manager.cpp 2014-01-13 06:12:33 +0000
433+++ src/server/scene/session_manager.cpp 2014-02-07 14:29:43 +0000
434@@ -1,5 +1,5 @@
435 /*
436- * Copyright © 2012 Canonical Ltd.
437+ * Copyright © 2012-2014 Canonical Ltd.
438 *
439 * This program is free software: you can redistribute it and/or modify it
440 * under the terms of the GNU General Public License version 3,
441@@ -73,12 +73,14 @@
442 close_session(session);
443 }
444
445-std::shared_ptr<mf::Session> ms::SessionManager::open_session(std::string const& name,
446- std::shared_ptr<mf::EventSink> const& sender)
447+std::shared_ptr<mf::Session> ms::SessionManager::open_session(
448+ pid_t client_pid,
449+ std::string const& name,
450+ std::shared_ptr<mf::EventSink> const& sender)
451 {
452 std::shared_ptr<msh::Session> new_session =
453 std::make_shared<ApplicationSession>(
454- surface_factory, name, snapshot_strategy, session_listener, sender);
455+ surface_factory, client_pid, name, snapshot_strategy, session_listener, sender);
456
457 app_container->insert_session(new_session);
458
459
460=== modified file 'src/server/scene/session_manager.h'
461--- src/server/scene/session_manager.h 2014-01-13 06:12:33 +0000
462+++ src/server/scene/session_manager.h 2014-02-07 14:29:43 +0000
463@@ -1,5 +1,5 @@
464 /*
465- * Copyright © 2012 Canonical Ltd.
466+ * Copyright © 2012-2014 Canonical Ltd.
467 *
468 * This program is free software: you can redistribute it and/or modify it
469 * under the terms of the GNU General Public License version 3,
470@@ -55,7 +55,10 @@
471 virtual ~SessionManager();
472
473 virtual std::shared_ptr<frontend::Session> open_session(
474- std::string const& name, std::shared_ptr<frontend::EventSink> const& sink);
475+ pid_t client_pid,
476+ std::string const& name,
477+ std::shared_ptr<frontend::EventSink> const& sink);
478+
479 virtual void close_session(std::shared_ptr<frontend::Session> const& session);
480
481 frontend::SurfaceId create_surface_for(std::shared_ptr<frontend::Session> const& session,
482
483=== modified file 'tests/integration-tests/test_session.cpp'
484--- tests/integration-tests/test_session.cpp 2014-01-31 11:13:57 +0000
485+++ tests/integration-tests/test_session.cpp 2014-02-07 14:29:43 +0000
486@@ -1,5 +1,5 @@
487 /*
488- * Copyright © 2013 Canonical Ltd.
489+ * Copyright © 2013-2014 Canonical Ltd.
490 *
491 * This program is free software: you can redistribute it and/or modify
492 * it under the terms of the GNU General Public License version 3 as
493@@ -170,6 +170,7 @@
494
495 ms::ApplicationSession session{
496 conf.the_shell_surface_factory(),
497+ __LINE__,
498 "stress",
499 conf.the_snapshot_strategy(),
500 std::make_shared<msh::NullSessionListener>(),
501
502=== modified file 'tests/integration-tests/test_session_manager.cpp'
503--- tests/integration-tests/test_session_manager.cpp 2014-01-13 06:12:33 +0000
504+++ tests/integration-tests/test_session_manager.cpp 2014-02-07 14:29:43 +0000
505@@ -76,9 +76,9 @@
506
507 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3);
508
509- auto session1 = session_manager.open_session("Visual Basic Studio", std::make_shared<mtd::NullEventSink>());
510- auto session2 = session_manager.open_session("Microsoft Access", std::make_shared<mtd::NullEventSink>());
511- auto session3 = session_manager.open_session("WordPerfect", std::make_shared<mtd::NullEventSink>());
512+ auto session1 = session_manager.open_session(__LINE__, "Visual Basic Studio", std::make_shared<mtd::NullEventSink>());
513+ auto session2 = session_manager.open_session(__LINE__, "Microsoft Access", std::make_shared<mtd::NullEventSink>());
514+ auto session3 = session_manager.open_session(__LINE__, "WordPerfect", std::make_shared<mtd::NullEventSink>());
515
516 Mock::VerifyAndClearExpectations(&focus_setter);
517
518@@ -105,9 +105,9 @@
519
520 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3);
521
522- auto session1 = session_manager.open_session("Visual Basic Studio", std::make_shared<mtd::NullEventSink>());
523- auto session2 = session_manager.open_session("Microsoft Access", std::make_shared<mtd::NullEventSink>());
524- auto session3 = session_manager.open_session("WordPerfect", std::make_shared<mtd::NullEventSink>());
525+ auto session1 = session_manager.open_session(__LINE__, "Visual Basic Studio", std::make_shared<mtd::NullEventSink>());
526+ auto session2 = session_manager.open_session(__LINE__, "Microsoft Access", std::make_shared<mtd::NullEventSink>());
527+ auto session3 = session_manager.open_session(__LINE__, "WordPerfect", std::make_shared<mtd::NullEventSink>());
528
529 Mock::VerifyAndClearExpectations(&focus_setter);
530
531
532=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
533--- tests/unit-tests/frontend/test_session_mediator.cpp 2014-02-06 09:51:46 +0000
534+++ tests/unit-tests/frontend/test_session_mediator.cpp 2014-02-07 14:29:43 +0000
535@@ -1,5 +1,5 @@
536 /*
537- * Copyright © 2012 Canonical Ltd.
538+ * Copyright © 2012-2014 Canonical Ltd.
539 *
540 * This program is free software: you can redistribute it and/or modify
541 * it under the terms of the GNU General Public License version 3 as
542@@ -206,7 +206,7 @@
543 report{std::make_shared<mf::NullSessionMediatorReport>()},
544 resource_cache{std::make_shared<mf::ResourceCache>()},
545 stub_screencast{std::make_shared<StubScreencast>()},
546- mediator{shell, graphics_platform, graphics_changer,
547+ mediator{__LINE__, shell, graphics_platform, graphics_changer,
548 surface_pixel_formats, report,
549 std::make_shared<mtd::NullEventSink>(),
550 resource_cache, stub_screencast},
551@@ -215,7 +215,7 @@
552 {
553 using namespace ::testing;
554
555- ON_CALL(*shell, open_session(_, _)).WillByDefault(Return(stubbed_session));
556+ ON_CALL(*shell, open_session(_, _, _)).WillByDefault(Return(stubbed_session));
557 ON_CALL(*shell, create_surface_for(_, _))
558 .WillByDefault(WithArg<1>(Invoke(stubbed_session.get(), &StubbedSession::create_surface)));
559 }
560@@ -370,7 +370,7 @@
561 .Times(1)
562 .WillOnce(Return(mt::fake_shared(config)));
563 mf::SessionMediator mediator(
564- shell, graphics_platform, mock_display,
565+ __LINE__, shell, graphics_platform, mock_display,
566 surface_pixel_formats, report,
567 std::make_shared<mtd::NullEventSink>(),
568 resource_cache, std::make_shared<mtd::NullScreencast>());
569@@ -602,7 +602,7 @@
570 .WillOnce(Return(mt::fake_shared(stub_display_config)));
571
572 mf::SessionMediator session_mediator{
573- shell, graphics_platform, mock_display_selector,
574+ __LINE__, shell, graphics_platform, mock_display_selector,
575 surface_pixel_formats, report,
576 std::make_shared<mtd::NullEventSink>(), resource_cache,
577 std::make_shared<mtd::NullScreencast>()};
578
579=== modified file 'tests/unit-tests/frontend/test_session_mediator_android.cpp'
580--- tests/unit-tests/frontend/test_session_mediator_android.cpp 2014-01-29 18:02:33 +0000
581+++ tests/unit-tests/frontend/test_session_mediator_android.cpp 2014-02-07 14:29:43 +0000
582@@ -57,7 +57,7 @@
583 surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888},
584 report{std::make_shared<mf::NullSessionMediatorReport>()},
585 resource_cache{std::make_shared<mf::ResourceCache>()},
586- mediator{shell, graphics_platform, display_changer,
587+ mediator{__LINE__, shell, graphics_platform, display_changer,
588 surface_pixel_formats, report,
589 std::make_shared<mtd::NullEventSink>(),
590 resource_cache, std::make_shared<mtd::NullScreencast>()},
591
592=== modified file 'tests/unit-tests/frontend/test_session_mediator_mesa.cpp'
593--- tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-01-29 18:02:33 +0000
594+++ tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-02-07 14:29:43 +0000
595@@ -1,5 +1,5 @@
596 /*
597- * Copyright © 2012 Canonical Ltd.
598+ * Copyright © 2012-2014 Canonical Ltd.
599 *
600 * This program is free software: you can redistribute it and/or modify
601 * it under the terms of the GNU General Public License version 3 as
602@@ -70,7 +70,7 @@
603 surface_pixel_formats{mir_pixel_format_argb_8888, mir_pixel_format_xrgb_8888},
604 report{std::make_shared<mf::NullSessionMediatorReport>()},
605 resource_cache{std::make_shared<mf::ResourceCache>()},
606- mediator{shell, mock_platform, display_changer,
607+ mediator{__LINE__, shell, mock_platform, display_changer,
608 surface_pixel_formats, report,
609 std::make_shared<mtd::NullEventSink>(),
610 resource_cache, std::make_shared<mtd::NullScreencast>()},
611
612=== modified file 'tests/unit-tests/scene/test_application_session.cpp'
613--- tests/unit-tests/scene/test_application_session.cpp 2014-01-13 06:12:33 +0000
614+++ tests/unit-tests/scene/test_application_session.cpp 2014-02-07 14:29:43 +0000
615@@ -1,5 +1,5 @@
616 /*
617- * Copyright © 2012 Canonical Ltd.
618+ * Copyright © 2012-2014 Canonical Ltd.
619 *
620 * This program is free software: you can redistribute it and/or modify
621 * it under the terms of the GNU General Public License version 3 as
622@@ -69,10 +69,13 @@
623 EXPECT_CALL(listener, destroying_surface(_, _))
624 .Times(1);
625
626- ms::ApplicationSession session(mt::fake_shared(surface_factory), "Foo",
627- std::make_shared<mtd::NullSnapshotStrategy>(),
628- mt::fake_shared(listener),
629- mt::fake_shared(sender));
630+ ms::ApplicationSession session(
631+ mt::fake_shared(surface_factory),
632+ __LINE__,
633+ "Foo",
634+ std::make_shared<mtd::NullSnapshotStrategy>(),
635+ mt::fake_shared(listener),
636+ mt::fake_shared(sender));
637
638 msh::SurfaceCreationParameters params;
639 auto surf = session.create_surface(params);
640@@ -97,9 +100,13 @@
641 EXPECT_CALL(listener, destroying_surface(_, _)).Times(1);
642
643 {
644- ms::ApplicationSession session(mt::fake_shared(surface_factory), "Foo",
645- std::make_shared<mtd::NullSnapshotStrategy>(), mt::fake_shared(listener),
646- mt::fake_shared(sender));
647+ ms::ApplicationSession session(
648+ mt::fake_shared(surface_factory),
649+ __LINE__,
650+ "Foo",
651+ std::make_shared<mtd::NullSnapshotStrategy>(),
652+ mt::fake_shared(listener),
653+ mt::fake_shared(sender));
654
655 msh::SurfaceCreationParameters params;
656 session.create_surface(params);
657@@ -123,9 +130,13 @@
658 .WillOnce(Return(make_mock_surface()));
659 }
660
661- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
662- std::make_shared<mtd::NullSnapshotStrategy>(),
663- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
664+ ms::ApplicationSession app_session(
665+ mt::fake_shared(surface_factory),
666+ __LINE__,
667+ "Foo",
668+ std::make_shared<mtd::NullSnapshotStrategy>(),
669+ std::make_shared<msh::NullSessionListener>(),
670+ mt::fake_shared(sender));
671
672
673 msh::SurfaceCreationParameters params;
674@@ -156,9 +167,13 @@
675 mtd::MockSurfaceFactory surface_factory;
676 ON_CALL(surface_factory, create_surface(_, _, _, _)).WillByDefault(Return(mock_surface));
677
678- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
679- std::make_shared<mtd::NullSnapshotStrategy>(),
680- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
681+ ms::ApplicationSession app_session(
682+ mt::fake_shared(surface_factory),
683+ __LINE__,
684+ "Foo",
685+ std::make_shared<mtd::NullSnapshotStrategy>(),
686+ std::make_shared<msh::NullSessionListener>(),
687+ mt::fake_shared(sender));
688
689 EXPECT_CALL(surface_factory, create_surface(_, _, _, _));
690
691@@ -177,15 +192,20 @@
692 app_session.destroy_surface(surf);
693 }
694
695-TEST(Session, get_invalid_surface_throw_behavior)
696+TEST(ApplicationSession, get_invalid_surface_throw_behavior)
697 {
698 using namespace ::testing;
699
700 mtd::NullEventSink sender;
701 mtd::MockSurfaceFactory surface_factory;
702- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
703- std::make_shared<mtd::NullSnapshotStrategy>(),
704- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
705+ ms::ApplicationSession app_session(
706+ mt::fake_shared(surface_factory),
707+ __LINE__,
708+ "Foo",
709+ std::make_shared<mtd::NullSnapshotStrategy>(),
710+ std::make_shared<msh::NullSessionListener>(),
711+ mt::fake_shared(sender));
712+
713 mf::SurfaceId invalid_surface_id(1);
714
715 EXPECT_THROW({
716@@ -193,15 +213,20 @@
717 }, std::runtime_error);
718 }
719
720-TEST(Session, destroy_invalid_surface_throw_behavior)
721+TEST(ApplicationSession, destroy_invalid_surface_throw_behavior)
722 {
723 using namespace ::testing;
724
725 mtd::NullEventSink sender;
726 mtd::MockSurfaceFactory surface_factory;
727- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
728- std::make_shared<mtd::NullSnapshotStrategy>(),
729- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
730+ ms::ApplicationSession app_session(
731+ mt::fake_shared(surface_factory),
732+ __LINE__,
733+ "Foo",
734+ std::make_shared<mtd::NullSnapshotStrategy>(),
735+ std::make_shared<msh::NullSessionListener>(),
736+ mt::fake_shared(sender));
737+
738 mf::SurfaceId invalid_surface_id(1);
739
740 EXPECT_THROW({
741@@ -209,7 +234,7 @@
742 }, std::runtime_error);
743 }
744
745-TEST(Session, uses_snapshot_strategy)
746+TEST(ApplicationSession, uses_snapshot_strategy)
747 {
748 using namespace ::testing;
749
750@@ -226,9 +251,13 @@
751 auto snapshot_strategy = std::make_shared<MockSnapshotStrategy>();
752 mtd::NullEventSink sender;
753 mtd::MockSurfaceFactory surface_factory;
754- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
755- snapshot_strategy,
756- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
757+ ms::ApplicationSession app_session(
758+ mt::fake_shared(surface_factory),
759+ __LINE__,
760+ "Foo",
761+ snapshot_strategy,
762+ std::make_shared<msh::NullSessionListener>(),
763+ mt::fake_shared(sender));
764
765 EXPECT_CALL(*snapshot_strategy, take_snapshot_of(_,_));
766
767@@ -245,7 +274,7 @@
768 MOCK_METHOD1(handle_display_config_change, void(mir::graphics::DisplayConfiguration const&));
769 };
770 }
771-TEST(Session, display_config_sender)
772+TEST(ApplicationSession, display_config_sender)
773 {
774 using namespace ::testing;
775
776@@ -256,14 +285,18 @@
777 EXPECT_CALL(sender, handle_display_config_change(testing::Ref(stub_config)))
778 .Times(1);
779
780- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
781- std::make_shared<mtd::NullSnapshotStrategy>(),
782- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
783+ ms::ApplicationSession app_session(
784+ mt::fake_shared(surface_factory),
785+ __LINE__,
786+ "Foo",
787+ std::make_shared<mtd::NullSnapshotStrategy>(),
788+ std::make_shared<msh::NullSessionListener>(),
789+ mt::fake_shared(sender));
790
791 app_session.send_display_config(stub_config);
792 }
793
794-TEST(Session, lifecycle_event_sender)
795+TEST(ApplicationSession, lifecycle_event_sender)
796 {
797 using namespace ::testing;
798
799@@ -271,11 +304,35 @@
800 mtd::MockSurfaceFactory surface_factory;
801 MockEventSink sender;
802
803- ms::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo",
804- std::make_shared<mtd::NullSnapshotStrategy>(),
805- std::make_shared<msh::NullSessionListener>(), mt::fake_shared(sender));
806+ ms::ApplicationSession app_session(
807+ mt::fake_shared(surface_factory),
808+ __LINE__,
809+ "Foo",
810+ std::make_shared<mtd::NullSnapshotStrategy>(),
811+ std::make_shared<msh::NullSessionListener>(),
812+ mt::fake_shared(sender));
813
814 EXPECT_CALL(sender, handle_lifecycle_event(exp_state)).Times(1);
815
816 app_session.set_lifecycle_state(mir_lifecycle_state_will_suspend);
817 }
818+
819+TEST(ApplicationSession, process_id)
820+{
821+ using namespace ::testing;
822+
823+ pid_t const pid{__LINE__};
824+
825+ mtd::MockSurfaceFactory surface_factory;
826+ MockEventSink sender;
827+
828+ ms::ApplicationSession app_session(
829+ mt::fake_shared(surface_factory),
830+ pid,
831+ "Foo",
832+ std::make_shared<mtd::NullSnapshotStrategy>(),
833+ std::make_shared<msh::NullSessionListener>(),
834+ mt::fake_shared(sender));
835+
836+ EXPECT_THAT(app_session.process_id(), Eq(pid));
837+}
838
839=== modified file 'tests/unit-tests/scene/test_session_manager.cpp'
840--- tests/unit-tests/scene/test_session_manager.cpp 2014-01-13 06:12:33 +0000
841+++ tests/unit-tests/scene/test_session_manager.cpp 2014-02-07 14:29:43 +0000
842@@ -1,5 +1,5 @@
843 /*
844- * Copyright © 2012 Canonical Ltd.
845+ * Copyright © 2012-2014 Canonical Ltd.
846 *
847 * This program is free software: you can redistribute it and/or modify
848 * it under the terms of the GNU General Public License version 3 as
849@@ -104,7 +104,7 @@
850 EXPECT_CALL(focus_setter, set_focus_to(_));
851 EXPECT_CALL(focus_setter, set_focus_to(std::shared_ptr<msh::Session>())).Times(1);
852
853- auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<mf::EventSink>());
854+ auto session = session_manager.open_session(__LINE__, "Visual Basic Studio", std::shared_ptr<mf::EventSink>());
855 session_manager.close_session(session);
856 }
857
858@@ -126,7 +126,7 @@
859 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1);
860 EXPECT_CALL(focus_setter, set_focus_to(std::shared_ptr<msh::Session>())).Times(1);
861
862- auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<mf::EventSink>());
863+ auto session = session_manager.open_session(__LINE__, "Visual Basic Studio", std::shared_ptr<mf::EventSink>());
864 session->create_surface(msh::a_surface().of_size(geom::Size{geom::Width{1024}, geom::Height{768}}));
865
866 session_manager.close_session(session);
867@@ -140,7 +140,7 @@
868 EXPECT_CALL(container, insert_session(_)).Times(1);
869 EXPECT_CALL(focus_setter, set_focus_to(_)).WillOnce(SaveArg<0>(&new_session));
870
871- auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<mf::EventSink>());
872+ auto session = session_manager.open_session(__LINE__, "Visual Basic Studio", std::shared_ptr<mf::EventSink>());
873 EXPECT_EQ(session, new_session);
874 }
875
876@@ -161,7 +161,7 @@
877 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Post Surface creation
878 }
879
880- auto session1 = session_manager.open_session("Weather Report", std::shared_ptr<mf::EventSink>());
881+ auto session1 = session_manager.open_session(__LINE__, "Weather Report", std::shared_ptr<mf::EventSink>());
882 session_manager.create_surface_for(session1, msh::a_surface());
883 }
884
885@@ -200,7 +200,7 @@
886 EXPECT_CALL(session_listener, stopping(_)).Times(1);
887 EXPECT_CALL(session_listener, unfocused()).Times(1);
888
889- auto session = session_manager.open_session("XPlane", std::shared_ptr<mf::EventSink>());
890+ auto session = session_manager.open_session(__LINE__, "XPlane", std::shared_ptr<mf::EventSink>());
891 session_manager.close_session(session);
892 }
893
894@@ -237,8 +237,8 @@
895
896 EXPECT_CALL(session_event_sink, handle_focus_change(_)).Times(2);
897
898- auto session = session_manager.open_session("XPlane", std::shared_ptr<mf::EventSink>());
899- auto session1 = session_manager.open_session("Bla", std::shared_ptr<mf::EventSink>());
900+ auto session = session_manager.open_session(__LINE__, "XPlane", std::shared_ptr<mf::EventSink>());
901+ auto session1 = session_manager.open_session(__LINE__, "Bla", std::shared_ptr<mf::EventSink>());
902
903 Mock::VerifyAndClearExpectations(&session_event_sink);
904

Subscribers

People subscribed via source and target branches