Mir

Merge lp:~mir-team/mir/backport-1355173.trust-prompt-suspend into lp:mir/0.8

Proposed by Cemil Azizoglu
Status: Merged
Approved by: Cemil Azizoglu
Approved revision: no longer in the source branch.
Merged at revision: 1966
Proposed branch: lp:~mir-team/mir/backport-1355173.trust-prompt-suspend
Merge into: lp:mir/0.8
Diff against target: 973 lines (+468/-71)
31 files modified
CMakeLists.txt (+1/-1)
client-ABI-sha1sums (+1/-1)
common-ABI-sha1sums (+1/-1)
debian/changelog (+16/-0)
debian/control (+2/-2)
debian/libmirserver26.1.install (+1/-1)
include/common/mir_toolkit/common.h (+2/-1)
include/server/mir/scene/prompt_session.h (+24/-0)
include/server/mir/scene/prompt_session_listener.h (+2/-0)
include/server/mir/scene/prompt_session_manager.h (+12/-0)
include/server/mir/scene/session.h (+2/-0)
platform-ABI-sha1sums (+1/-1)
server-ABI-sha1sums (+5/-5)
src/include/server/mir/scene/null_prompt_session_listener.h (+2/-0)
src/server/CMakeLists.txt (+1/-1)
src/server/scene/CMakeLists.txt (+1/-0)
src/server/scene/application_session.cpp (+18/-0)
src/server/scene/application_session.h (+2/-0)
src/server/scene/prompt_session_impl.cpp (+81/-0)
src/server/scene/prompt_session_impl.h (+50/-0)
src/server/scene/prompt_session_manager_impl.cpp (+22/-9)
src/server/scene/prompt_session_manager_impl.h (+6/-0)
tests/acceptance-tests/test_prompt_session_client_api.cpp (+55/-45)
tests/include/mir_test_doubles/mock_prompt_session_listener.h (+2/-0)
tests/include/mir_test_doubles/mock_scene_session.h (+2/-0)
tests/include/mir_test_doubles/null_prompt_session.h (+16/-0)
tests/include/mir_test_doubles/null_prompt_session_manager.h (+8/-0)
tests/include/mir_test_doubles/stub_scene_session.h (+8/-0)
tests/unit-tests/scene/CMakeLists.txt (+1/-0)
tests/unit-tests/scene/test_prompt_session_impl.cpp (+110/-0)
tests/unit-tests/scene/test_prompt_session_manager.cpp (+13/-3)
To merge this branch: bzr merge lp:~mir-team/mir/backport-1355173.trust-prompt-suspend
Reviewer Review Type Date Requested Status
Cemil Azizoglu (community) Approve
Daniel van Vugt Abstain
Chris Halse Rogers Approve
Gerry Boland Pending
Nick Dedekind Pending
Review via email: mp+246024@code.launchpad.net

Commit message

Backport of dednick's 1355173.trust-prompt-suspend branch into mir/0.8.
(LP: #1355173)

Description of the change

.

To post a comment you must log in.
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

TODO: Need to carefully identify the broken ABIs.

(Server ABI is definitely broken.)

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

Alright, this is adding features to the server ABI. That seems to be its purpose.

In that case we have little choice but to branch the server ABI string and make all downstream projects in RTM rebuild.

review: Needs Fixing
Revision history for this message
Chris Halse Rogers (raof) wrote :

This now looks correct to me

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

"26rtm1" is wrong. This is not a distro branch so should not contain any distro names.

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

Fixed SONAME so that any other distro using lp:mir/0.8 isn't forced to use "rtm" it is names.

Haven't reviewed the rest yet though.

review: Abstain
Revision history for this message
Chris Halse Rogers (raof) wrote :

Fair chop.

Although I very much hope that no other distros are using lp:mir/0.8,
because this is both an ABI and API break, and totally unacceptable for
a real stable branch :).

Possibly this should be proposed to a new mir/rtm-krillin branch or
something, but I'm happy with mir/0.8 as a practical matter.

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

Do we have all the external linkage required? No one's updated symbols.map for this...

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

Changelog needs to mention at least two fixes that have landed (including this one). Possibly more are desirable too:
https://launchpad.net/mir/+milestone/0.8.1

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Abstain
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

FYI, still missing two more important fixes (IMHO) after this one. Listed in:
https://launchpad.net/mir/+milestone/0.8.1

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

ABI bumps and changelog look good now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-30 06:11:33 +0000
3+++ CMakeLists.txt 2015-01-12 15:38:36 +0000
4@@ -28,7 +28,7 @@
5
6 set(MIR_VERSION_MAJOR 0)
7 set(MIR_VERSION_MINOR 8) # This should change at least with every MIRSERVER_ABI
8-set(MIR_VERSION_PATCH 0)
9+set(MIR_VERSION_PATCH 1)
10
11 set(MIR_VERSION ${MIR_VERSION_MAJOR}.${MIR_VERSION_MINOR}.${MIR_VERSION_PATCH})
12
13
14=== modified file 'client-ABI-sha1sums'
15--- client-ABI-sha1sums 2014-09-30 06:11:33 +0000
16+++ client-ABI-sha1sums 2015-01-12 15:38:36 +0000
17@@ -9,7 +9,7 @@
18 8609754db3be20e11e43858dd2c36b5bd480d5ec include/client/mir_toolkit/mir_surface.h
19 b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h
20 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
21-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
22+e0e0a814b0b4da74f78b1216af0cd62e51f79673 include/common/mir_toolkit/common.h
23 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
24 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
25 99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
26
27=== modified file 'common-ABI-sha1sums'
28--- common-ABI-sha1sums 2014-09-30 06:11:33 +0000
29+++ common-ABI-sha1sums 2015-01-12 15:38:36 +0000
30@@ -11,7 +11,7 @@
31 be7d58c9fde2ce91cc66dd6144b76e08b536266b include/common/mir/int_wrapper.h
32 48015c67ddc4998ed5a2e8bb04ff3a4bfdd6a613 include/common/mir/time/clock.h
33 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
34-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
35+e0e0a814b0b4da74f78b1216af0cd62e51f79673 include/common/mir_toolkit/common.h
36 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
37 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
38 99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
39
40=== modified file 'debian/changelog'
41--- debian/changelog 2014-10-10 14:01:27 +0000
42+++ debian/changelog 2015-01-12 15:38:36 +0000
43@@ -1,3 +1,19 @@
44+mir (0.8.1-0ubuntu1) UNRELEASED; urgency=medium
45+
46+ * Bug fix release 0.8.1 (https://launchpad.net/mir/+milestone/0.8.1)
47+ - ABI summary: Servers need rebuilding, but clients do not;
48+ . Mirclient ABI unchanged at 8
49+ . Mircommon ABI unchanged at 2
50+ . Mirplatform ABI unchanged to 3
51+ . Mirserver ABI bumped to 26.1 (due to breakage in LP: #1355173)
52+ - Fixes bugs:
53+ . Switching windows with a Trusted Prompt Session active loses the
54+ trusted prompt session (LP: #1355173)
55+ . a prompt session with an invalid application pid should be an error
56+ (LP: #1377968)
57+
58+ -- Daniel van Vugt <daniel.van.vugt@canonical.com> Mon, 12 Jan 2015 17:44:57 +0800
59+
60 mir (0.8.0+14.10.20141010-0ubuntu1) utopic; urgency=medium
61
62 [ Daniel van Vugt ]
63
64=== modified file 'debian/control'
65--- debian/control 2014-10-01 03:41:21 +0000
66+++ debian/control 2015-01-12 15:38:36 +0000
67@@ -45,7 +45,7 @@
68 # just go ahead. ~mir-team will notice and sync up the code again.
69 Vcs-Bzr: https://code.launchpad.net/~mir-team/mir/trunk
70
71-Package: libmirserver26
72+Package: libmirserver26.1
73 Section: libs
74 Architecture: i386 amd64 armhf arm64
75 Multi-Arch: same
76@@ -139,7 +139,7 @@
77 Architecture: i386 amd64 armhf arm64
78 Multi-Arch: same
79 Pre-Depends: ${misc:Pre-Depends}
80-Depends: libmirserver26 (= ${binary:Version}),
81+Depends: libmirserver26.1 (= ${binary:Version}),
82 libmirplatform-dev (= ${binary:Version}),
83 libmircommon-dev (= ${binary:Version}),
84 libglm-dev,
85
86=== renamed file 'debian/libmirserver26.install' => 'debian/libmirserver26.1.install'
87--- debian/libmirserver26.install 2014-09-30 06:11:33 +0000
88+++ debian/libmirserver26.1.install 2015-01-12 15:38:36 +0000
89@@ -1,1 +1,1 @@
90-usr/lib/*/libmirserver.so.26
91+usr/lib/*/libmirserver.so.26.1
92
93=== modified file 'include/common/mir_toolkit/common.h'
94--- include/common/mir_toolkit/common.h 2014-09-11 05:51:44 +0000
95+++ include/common/mir_toolkit/common.h 2015-01-12 15:38:36 +0000
96@@ -104,7 +104,8 @@
97 typedef enum MirPromptSessionState
98 {
99 mir_prompt_session_state_stopped = 0,
100- mir_prompt_session_state_started
101+ mir_prompt_session_state_started,
102+ mir_prompt_session_state_suspended
103 } MirPromptSessionState;
104
105 /**
106
107=== modified file 'include/server/mir/scene/prompt_session.h'
108--- include/server/mir/scene/prompt_session.h 2014-06-12 10:24:08 +0000
109+++ include/server/mir/scene/prompt_session.h 2015-01-12 15:38:36 +0000
110@@ -29,6 +29,30 @@
111
112 class PromptSession : public frontend::PromptSession
113 {
114+public:
115+ /**
116+ * Start a prompt session
117+ * \param [in] helper The prompt session helper session
118+ */
119+ virtual void start(std::shared_ptr<Session> const& helper_session) = 0;
120+
121+ /**
122+ * Stop a prompt session
123+ * \param [in] helper The prompt session helper session
124+ */
125+ virtual void stop(std::shared_ptr<Session> const& helper_session) = 0;
126+
127+ /**
128+ * Suspend a prompt session
129+ * \param [in] helper The prompt session helper session
130+ */
131+ virtual void suspend(std::shared_ptr<Session> const& helper_session) = 0;
132+
133+ /**
134+ * Resume a prompt session
135+ * \param [in] helper The prompt session helper session
136+ */
137+ virtual void resume(std::shared_ptr<Session> const& helper_session) = 0;
138 };
139
140 }
141
142=== modified file 'include/server/mir/scene/prompt_session_listener.h'
143--- include/server/mir/scene/prompt_session_listener.h 2014-06-12 10:06:11 +0000
144+++ include/server/mir/scene/prompt_session_listener.h 2015-01-12 15:38:36 +0000
145@@ -33,6 +33,8 @@
146 public:
147 virtual void starting(std::shared_ptr<PromptSession> const& prompt_session) = 0;
148 virtual void stopping(std::shared_ptr<PromptSession> const& prompt_session) = 0;
149+ virtual void suspending(std::shared_ptr<PromptSession> const& prompt_session) = 0;
150+ virtual void resuming(std::shared_ptr<PromptSession> const& prompt_session) = 0;
151
152 virtual void prompt_provider_added(PromptSession const& prompt_session, std::shared_ptr<Session> const& prompt_provider) = 0;
153 virtual void prompt_provider_removed(PromptSession const& prompt_session, std::shared_ptr<Session> const& prompt_provider) = 0;
154
155=== modified file 'include/server/mir/scene/prompt_session_manager.h'
156--- include/server/mir/scene/prompt_session_manager.h 2014-09-11 05:51:44 +0000
157+++ include/server/mir/scene/prompt_session_manager.h 2015-01-12 15:38:36 +0000
158@@ -51,6 +51,18 @@
159 virtual void stop_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) const = 0;
160
161 /**
162+ * Suspend a prompt session
163+ * \param [in] prompt_session The prompt session
164+ */
165+ virtual void suspend_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) const = 0;
166+
167+ /**
168+ * Resume a suspended prompt session
169+ * \param [in] prompt_session The prompt session
170+ */
171+ virtual void resume_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) const = 0;
172+
173+ /**
174 * Add a prompt provider to an existing prompt session
175 * \param [in] prompt_session The prompt session
176 * \param [in] prompt_provider The prompt provider to add to the prompt session
177
178=== modified file 'include/server/mir/scene/session.h'
179--- include/server/mir/scene/session.h 2014-09-11 05:51:44 +0000
180+++ include/server/mir/scene/session.h 2015-01-12 15:38:36 +0000
181@@ -43,6 +43,8 @@
182
183 virtual void start_prompt_session() = 0;
184 virtual void stop_prompt_session() = 0;
185+ virtual void suspend_prompt_session() = 0;
186+ virtual void resume_prompt_session() = 0;
187 };
188 }
189 }
190
191=== modified file 'platform-ABI-sha1sums'
192--- platform-ABI-sha1sums 2014-10-03 03:02:09 +0000
193+++ platform-ABI-sha1sums 2015-01-12 15:38:36 +0000
194@@ -11,7 +11,7 @@
195 be7d58c9fde2ce91cc66dd6144b76e08b536266b include/common/mir/int_wrapper.h
196 48015c67ddc4998ed5a2e8bb04ff3a4bfdd6a613 include/common/mir/time/clock.h
197 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
198-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
199+e0e0a814b0b4da74f78b1216af0cd62e51f79673 include/common/mir_toolkit/common.h
200 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
201 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
202 99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
203
204=== modified file 'server-ABI-sha1sums'
205--- server-ABI-sha1sums 2014-10-03 03:02:09 +0000
206+++ server-ABI-sha1sums 2015-01-12 15:38:36 +0000
207@@ -11,7 +11,7 @@
208 be7d58c9fde2ce91cc66dd6144b76e08b536266b include/common/mir/int_wrapper.h
209 48015c67ddc4998ed5a2e8bb04ff3a4bfdd6a613 include/common/mir/time/clock.h
210 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
211-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
212+e0e0a814b0b4da74f78b1216af0cd62e51f79673 include/common/mir_toolkit/common.h
213 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
214 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
215 99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
216@@ -88,11 +88,11 @@
217 d5273f3363b0b776427d5e3f1af99f0f2bcf3fa6 include/server/mir/scene/observer.h
218 10db25fbaefcabb3b191177ed70f5972df7f05f0 include/server/mir/scene/placement_strategy.h
219 74f7f66ffc3e15c428082fb961e748cb4f39dafc include/server/mir/scene/prompt_session_creation_parameters.h
220-4e8269c822ad2daddd92115cbe5332caaa9ef4cc include/server/mir/scene/prompt_session.h
221-79adf11e2b1778897ed97d1713ba4c3d34eb1f31 include/server/mir/scene/prompt_session_listener.h
222-27f614f98ad7c249d9b12dcca30a324220cdd25b include/server/mir/scene/prompt_session_manager.h
223+b657cfb8fb31140b83b78fc19135dd0165ede67b include/server/mir/scene/prompt_session.h
224+a745a63d413ced63b82350b8c253b65dffd5bf44 include/server/mir/scene/prompt_session_listener.h
225+a09a3f18ecea53dc45386c1e2baf545c4177c047 include/server/mir/scene/prompt_session_manager.h
226 5edf446380070f567500069e422d293e88468ee5 include/server/mir/scene/session_coordinator.h
227-f148a69caa39756d43cfaf7cc868ad681bda9ef6 include/server/mir/scene/session.h
228+cf13a79b20acf9e53db6e0078df085b9a023d8da include/server/mir/scene/session.h
229 ee94083f10f890e24c0e0bbdb94842e2dd788deb include/server/mir/scene/session_listener.h
230 7f5f26000fd2312373817d05c488a6a950a47c82 include/server/mir/scene/snapshot.h
231 5bab4dc0a6488b8b9d47e958c6bab94f1dcf2c57 include/server/mir/scene/surface_buffer_access.h
232
233=== modified file 'src/include/server/mir/scene/null_prompt_session_listener.h'
234--- src/include/server/mir/scene/null_prompt_session_listener.h 2014-09-11 05:51:44 +0000
235+++ src/include/server/mir/scene/null_prompt_session_listener.h 2015-01-12 15:38:36 +0000
236@@ -30,6 +30,8 @@
237 public:
238 void starting(std::shared_ptr<PromptSession> const&) override {}
239 void stopping(std::shared_ptr<PromptSession> const&) override {}
240+ void suspending(std::shared_ptr<PromptSession> const&) override {}
241+ void resuming(std::shared_ptr<PromptSession> const&) override {}
242
243 void prompt_provider_added(PromptSession const&, std::shared_ptr<Session> const&) override {}
244 void prompt_provider_removed(PromptSession const&, std::shared_ptr<Session> const&) override {}
245
246=== modified file 'src/server/CMakeLists.txt'
247--- src/server/CMakeLists.txt 2014-09-30 06:11:33 +0000
248+++ src/server/CMakeLists.txt 2015-01-12 15:38:36 +0000
249@@ -90,7 +90,7 @@
250 ${CMAKE_SOURCE_DIR}/include/server/mir DESTINATION "include/mirserver"
251 )
252
253-set(MIRSERVER_ABI 26) # Be sure to increment MIR_VERSION_MINOR at the same time
254+set(MIRSERVER_ABI 26.1) # Be sure to increment MIR_VERSION_MINOR at the same time
255 set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
256
257 set_target_properties(
258
259=== modified file 'src/server/scene/CMakeLists.txt'
260--- src/server/scene/CMakeLists.txt 2014-09-30 06:11:33 +0000
261+++ src/server/scene/CMakeLists.txt 2015-01-12 15:38:36 +0000
262@@ -21,6 +21,7 @@
263 legacy_scene_change_notification.cpp
264 legacy_surface_change_notification.cpp
265 prompt_session_container.cpp
266+ prompt_session_impl.cpp
267 prompt_session_manager_impl.cpp
268 rendering_tracker.cpp
269 )
270
271=== modified file 'src/server/scene/application_session.cpp'
272--- src/server/scene/application_session.cpp 2014-09-11 05:51:44 +0000
273+++ src/server/scene/application_session.cpp 2015-01-12 15:38:36 +0000
274@@ -202,3 +202,21 @@
275 stop_event.prompt_session.new_state = mir_prompt_session_state_stopped;
276 event_sink->handle_event(stop_event);
277 }
278+
279+void ms::ApplicationSession::suspend_prompt_session()
280+{
281+ MirEvent start_event;
282+ memset(&start_event, 0, sizeof start_event);
283+ start_event.type = mir_event_type_prompt_session_state_change;
284+ start_event.prompt_session.new_state = mir_prompt_session_state_suspended;
285+ event_sink->handle_event(start_event);
286+}
287+
288+void ms::ApplicationSession::resume_prompt_session()
289+{
290+ MirEvent start_event;
291+ memset(&start_event, 0, sizeof start_event);
292+ start_event.type = mir_event_type_prompt_session_state_change;
293+ start_event.prompt_session.new_state = mir_prompt_session_state_started;
294+ event_sink->handle_event(start_event);
295+}
296
297=== modified file 'src/server/scene/application_session.h'
298--- src/server/scene/application_session.h 2014-09-11 05:51:44 +0000
299+++ src/server/scene/application_session.h 2015-01-12 15:38:36 +0000
300@@ -73,6 +73,8 @@
301
302 void start_prompt_session() override;
303 void stop_prompt_session() override;
304+ void suspend_prompt_session() override;
305+ void resume_prompt_session() override;
306
307 protected:
308 ApplicationSession(ApplicationSession const&) = delete;
309
310=== added file 'src/server/scene/prompt_session_impl.cpp'
311--- src/server/scene/prompt_session_impl.cpp 1970-01-01 00:00:00 +0000
312+++ src/server/scene/prompt_session_impl.cpp 2015-01-12 15:38:36 +0000
313@@ -0,0 +1,81 @@
314+/*
315+ * Copyright © 2014 Canonical Ltd.
316+ *
317+ * This program is free software: you can redistribute it and/or modify it
318+ * under the terms of the GNU General Public License version 3,
319+ * as published by the Free Software Foundation.
320+ *
321+ * This program is distributed in the hope that it will be useful,
322+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
323+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
324+ * GNU General Public License for more details.
325+ *
326+ * You should have received a copy of the GNU General Public License
327+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
328+ *
329+ * Authored by: Nick Dedekind <nick.dedekind@canonical.com>
330+ */
331+
332+#include "prompt_session_impl.h"
333+
334+#include "mir/scene/session.h"
335+
336+namespace ms = mir::scene;
337+
338+ms::PromptSessionImpl::PromptSessionImpl() :
339+ current_state(mir_prompt_session_state_stopped)
340+{
341+}
342+
343+void ms::PromptSessionImpl::start(std::shared_ptr<Session> const& helper_session)
344+{
345+ std::lock_guard<std::mutex> lk(guard);
346+
347+ if (current_state == mir_prompt_session_state_stopped)
348+ {
349+ current_state = mir_prompt_session_state_started;
350+ if (helper_session)
351+ helper_session->start_prompt_session();
352+ }
353+}
354+
355+void ms::PromptSessionImpl::stop(std::shared_ptr<Session> const& helper_session)
356+{
357+ std::lock_guard<std::mutex> lk(guard);
358+
359+ if (current_state != mir_prompt_session_state_stopped)
360+ {
361+ current_state = mir_prompt_session_state_stopped;
362+ if (helper_session)
363+ helper_session->stop_prompt_session();
364+ }
365+}
366+
367+void ms::PromptSessionImpl::suspend(std::shared_ptr<Session> const& helper_session)
368+{
369+ std::lock_guard<std::mutex> lk(guard);
370+
371+ if (current_state == mir_prompt_session_state_started)
372+ {
373+ current_state = mir_prompt_session_state_suspended;
374+ if (helper_session)
375+ helper_session->suspend_prompt_session();
376+ }
377+}
378+
379+void ms::PromptSessionImpl::resume(std::shared_ptr<Session> const& helper_session)
380+{
381+ std::lock_guard<std::mutex> lk(guard);
382+
383+ if (current_state == mir_prompt_session_state_suspended)
384+ {
385+ current_state = mir_prompt_session_state_started;
386+ if (helper_session)
387+ helper_session->resume_prompt_session();
388+ }
389+}
390+
391+MirPromptSessionState ms::PromptSessionImpl::state() const
392+{
393+ return current_state;
394+}
395
396=== added file 'src/server/scene/prompt_session_impl.h'
397--- src/server/scene/prompt_session_impl.h 1970-01-01 00:00:00 +0000
398+++ src/server/scene/prompt_session_impl.h 2015-01-12 15:38:36 +0000
399@@ -0,0 +1,50 @@
400+/*
401+ * Copyright © 2014 Canonical Ltd.
402+ *
403+ * This program is free software: you can redistribute it and/or modify it
404+ * under the terms of the GNU General Public License version 3,
405+ * as published by the Free Software Foundation.
406+ *
407+ * This program is distributed in the hope that it will be useful,
408+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
409+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
410+ * GNU General Public License for more details.
411+ *
412+ * You should have received a copy of the GNU General Public License
413+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
414+ *
415+ * Authored by: Nick Dedekind <nick.dedekind@canonical.com>
416+ */
417+
418+#ifndef MIR_SCENE_PROMPT_SESSION_IMPL_H_
419+#define MIR_SCENE_PROMPT_SESSION_IMPL_H_
420+
421+#include "mir/scene/prompt_session.h"
422+
423+#include <mutex>
424+
425+namespace mir
426+{
427+namespace scene
428+{
429+
430+class PromptSessionImpl : public scene::PromptSession
431+{
432+public:
433+ explicit PromptSessionImpl();
434+
435+ void start(std::shared_ptr<Session> const& helper_session) override;
436+ void stop(std::shared_ptr<Session> const& helper_session) override;
437+ void suspend(std::shared_ptr<Session> const& helper_session) override;
438+ void resume(std::shared_ptr<Session> const& helper_session) override;
439+
440+ MirPromptSessionState state() const;
441+
442+private:
443+ std::mutex mutable guard;
444+ MirPromptSessionState current_state;
445+};
446+}
447+}
448+
449+#endif // MIR_SCENE_PROMPT_SESSION_IMPL_H_
450
451=== modified file 'src/server/scene/prompt_session_manager_impl.cpp'
452--- src/server/scene/prompt_session_manager_impl.cpp 2014-12-04 10:59:04 +0000
453+++ src/server/scene/prompt_session_manager_impl.cpp 2015-01-12 15:38:36 +0000
454@@ -21,9 +21,9 @@
455 #include "mir/scene/prompt_session_creation_parameters.h"
456 #include "mir/scene/prompt_session_listener.h"
457 #include "mir/scene/session.h"
458-#include "mir/scene/prompt_session.h"
459 #include "session_container.h"
460 #include "prompt_session_container.h"
461+#include "prompt_session_impl.h"
462
463 namespace ms = mir::scene;
464
465@@ -45,12 +45,7 @@
466 prompt_session_container->for_each_participant_in_prompt_session(prompt_session.get(),
467 [&](std::weak_ptr<Session> const& session, PromptSessionContainer::ParticipantType type)
468 {
469- if (type == PromptSessionContainer::ParticipantType::helper)
470- {
471- if (auto locked_session = session.lock())
472- locked_session->stop_prompt_session();
473- }
474- else if (type == PromptSessionContainer::ParticipantType::prompt_provider)
475+ if (type == PromptSessionContainer::ParticipantType::prompt_provider)
476 {
477 if (auto locked_session = session.lock())
478 participants.push_back(locked_session);
479@@ -63,6 +58,8 @@
480 prompt_session_listener->prompt_provider_removed(*prompt_session, participant);
481 }
482
483+ prompt_session->stop(helper_for(prompt_session));
484+
485 prompt_session_container->remove_prompt_session(prompt_session);
486
487 prompt_session_listener->stopping(prompt_session);
488@@ -104,11 +101,27 @@
489 stop_prompt_session_locked(lock, prompt_session);
490 }
491
492+void ms::PromptSessionManagerImpl::suspend_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) const
493+{
494+ std::lock_guard<std::mutex> lock(prompt_sessions_mutex);
495+
496+ prompt_session->suspend(helper_for(prompt_session));
497+ prompt_session_listener->suspending(prompt_session);
498+}
499+
500+void ms::PromptSessionManagerImpl::resume_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) const
501+{
502+ std::lock_guard<std::mutex> lock(prompt_sessions_mutex);
503+
504+ prompt_session->resume(helper_for(prompt_session));
505+ prompt_session_listener->resuming(prompt_session);
506+}
507+
508 std::shared_ptr<ms::PromptSession> ms::PromptSessionManagerImpl::start_prompt_session_for(
509 std::shared_ptr<Session> const& session,
510 PromptSessionCreationParameters const& params) const
511 {
512- auto prompt_session = std::make_shared<PromptSession>();
513+ auto prompt_session = std::make_shared<PromptSessionImpl>();
514 std::shared_ptr<Session> application_session;
515
516 app_container->for_each(
517@@ -129,7 +142,7 @@
518 if (!prompt_session_container->insert_participant(prompt_session.get(), session, PromptSessionContainer::ParticipantType::helper))
519 BOOST_THROW_EXCEPTION(std::runtime_error("Could not set prompt session helper"));
520
521- session->start_prompt_session();
522+ prompt_session->start(session);
523 prompt_session_listener->starting(prompt_session);
524
525 prompt_session_container->insert_participant(prompt_session.get(), application_session, PromptSessionContainer::ParticipantType::application);
526
527=== modified file 'src/server/scene/prompt_session_manager_impl.h'
528--- src/server/scene/prompt_session_manager_impl.h 2014-09-11 05:51:44 +0000
529+++ src/server/scene/prompt_session_manager_impl.h 2015-01-12 15:38:36 +0000
530@@ -50,6 +50,12 @@
531 void stop_prompt_session(
532 std::shared_ptr<PromptSession> const& prompt_session) const override;
533
534+ void suspend_prompt_session(
535+ std::shared_ptr<PromptSession> const& prompt_session) const override;
536+
537+ void resume_prompt_session(
538+ std::shared_ptr<PromptSession> const& prompt_session) const override;
539+
540 void add_prompt_provider(
541 std::shared_ptr<PromptSession> const& prompt_session,
542 std::shared_ptr<Session> const& prompt_provider) const override;
543
544=== modified file 'tests/acceptance-tests/test_prompt_session_client_api.cpp'
545--- tests/acceptance-tests/test_prompt_session_client_api.cpp 2014-12-04 10:59:04 +0000
546+++ tests/acceptance-tests/test_prompt_session_client_api.cpp 2015-01-12 15:38:36 +0000
547@@ -26,6 +26,7 @@
548 #include "mir/fd.h"
549
550 #include "mir_test_doubles/stub_session_authorizer.h"
551+#include "mir_test_doubles/mock_prompt_session_listener.h"
552 #include "mir_test_framework/stubbed_server_configuration.h"
553 #include "mir_test_framework/in_process_server.h"
554 #include "mir_test_framework/using_stub_client_platform.h"
555@@ -36,6 +37,7 @@
556
557 #include <condition_variable>
558 #include <mutex>
559+#include <atomic>
560
561 namespace mtd = mir::test::doubles;
562 namespace mtf = mir_test_framework;
563@@ -46,35 +48,6 @@
564
565 namespace
566 {
567-struct MockPromptSessionListener : ms::PromptSessionListener
568-{
569- MockPromptSessionListener(std::shared_ptr<ms::PromptSessionListener> const& wrapped) :
570- wrapped(wrapped)
571- {
572- ON_CALL(*this, starting(_)).WillByDefault(Invoke(
573- wrapped.get(), &ms::PromptSessionListener::starting));
574-
575- ON_CALL(*this, stopping(_)).WillByDefault(Invoke(
576- wrapped.get(), &ms::PromptSessionListener::stopping));
577-
578- ON_CALL(*this, prompt_provider_added(_, _)).WillByDefault(Invoke(
579- wrapped.get(), &ms::PromptSessionListener::prompt_provider_added));
580-
581- ON_CALL(*this, prompt_provider_removed(_, _)).WillByDefault(Invoke(
582- wrapped.get(), &ms::PromptSessionListener::prompt_provider_removed));
583- }
584-
585- MOCK_METHOD1(starting, void(std::shared_ptr<ms::PromptSession> const& prompt_session));
586- MOCK_METHOD1(stopping, void(std::shared_ptr<ms::PromptSession> const& prompt_session));
587-
588- MOCK_METHOD2(prompt_provider_added,
589- void(ms::PromptSession const& session, std::shared_ptr<ms::Session> const& provider));
590-
591- MOCK_METHOD2(prompt_provider_removed,
592- void(ms::PromptSession const& session, std::shared_ptr<ms::Session> const& provider));
593-
594- std::shared_ptr<ms::PromptSessionListener> const wrapped;
595-};
596
597 struct MockSessionAuthorizer : public mtd::StubSessionAuthorizer
598 {
599@@ -99,12 +72,11 @@
600 });
601 }
602
603- std::shared_ptr<MockPromptSessionListener> the_mock_prompt_session_listener()
604+ std::shared_ptr<mtd::MockPromptSessionListener> the_mock_prompt_session_listener()
605 {
606- return mock_prompt_session_listener([this]
607+ return mock_prompt_session_listener([]
608 {
609- return std::make_shared<NiceMock<MockPromptSessionListener>>(
610- mtf::StubbedServerConfiguration::the_prompt_session_listener());
611+ return std::make_shared<NiceMock<mtd::MockPromptSessionListener>>();
612 });
613 }
614
615@@ -125,7 +97,7 @@
616 });
617 }
618
619- mir::CachedPtr<MockPromptSessionListener> mock_prompt_session_listener;
620+ mir::CachedPtr<mtd::MockPromptSessionListener> mock_prompt_session_listener;
621 mir::CachedPtr<MockSessionAuthorizer> mock_prompt_session_authorizer;
622 };
623
624@@ -143,6 +115,7 @@
625
626 std::shared_ptr<ms::PromptSession> server_prompt_session;
627 mtf::UsingStubClientPlatform using_stub_client_platform;
628+ std::atomic<bool> prompt_session_state_change_callback_called;
629
630 void SetUp() override
631 {
632@@ -158,11 +131,18 @@
633 void capture_server_prompt_session()
634 {
635 EXPECT_CALL(*the_mock_prompt_session_listener(), starting(_)).
636- WillOnce(DoAll(
637- Invoke(
638- the_mock_prompt_session_listener()->wrapped.get(),
639- &ms::PromptSessionListener::starting),
640- SaveArg<0>(&server_prompt_session)));
641+ WillOnce(SaveArg<0>(&server_prompt_session));
642+ }
643+
644+ void wait_for_state_change_callback()
645+ {
646+ for (int i = 0; !prompt_session_state_change_callback_called.load() && i < 5000; ++i)
647+ {
648+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
649+ std::this_thread::yield();
650+ }
651+
652+ prompt_session_state_change_callback_called.store(false);
653 }
654
655 void TearDown() override
656@@ -179,7 +159,7 @@
657 mtf::InProcessServer::TearDown();
658 }
659
660- MockPromptSessionListener* the_mock_prompt_session_listener()
661+ mtd::MockPromptSessionListener* the_mock_prompt_session_listener()
662 {
663 return server_configuration.the_mock_prompt_session_listener().get();
664 }
665@@ -250,6 +230,7 @@
666 {
667 PromptSessionClientAPI* self = static_cast<PromptSessionClientAPI*>(context);
668 self->prompt_session_state_change(prompt_provider, state);
669+ self->prompt_session_state_change_callback_called.store(true);
670 }
671
672 void client_fd_callback(MirPromptSession*, size_t count, int const* fds, void* context)
673@@ -405,20 +386,49 @@
674 {
675 connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
676
677- EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_started));
678+ {
679+ InSequence seq;
680+ EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_started));
681+ EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_stopped));
682+ }
683
684 capture_server_prompt_session();
685
686 MirPromptSession* prompt_session = mir_connection_create_prompt_session_sync(
687 connection, application_session_pid, prompt_session_state_change_callback, this);
688-
689- EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_stopped));
690+ wait_for_state_change_callback();
691
692 the_prompt_session_manager()->stop_prompt_session(server_prompt_session);
693+ wait_for_state_change_callback();
694
695 // Verify we have got the "stopped" notification before we go on and release the session
696- Mock::VerifyAndClearExpectations(the_mock_prompt_session_listener());
697-
698+ Mock::VerifyAndClearExpectations(this);
699+
700+ mir_prompt_session_release_sync(prompt_session);
701+}
702+
703+TEST_F(PromptSessionClientAPI, notifies_when_server_suspends_prompt_session)
704+{
705+ connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
706+ {
707+ InSequence seq;
708+ EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_started));
709+ EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_suspended));
710+ }
711+
712+ capture_server_prompt_session();
713+
714+ MirPromptSession* prompt_session = mir_connection_create_prompt_session_sync(
715+ connection, application_session_pid, prompt_session_state_change_callback, this);
716+ wait_for_state_change_callback();
717+
718+ the_prompt_session_manager()->suspend_prompt_session(server_prompt_session);
719+ wait_for_state_change_callback();
720+
721+ // Verify we have got the "suspend" notification before we go on and release the session
722+ Mock::VerifyAndClearExpectations(this);
723+
724+ EXPECT_CALL(*this, prompt_session_state_change(_, mir_prompt_session_state_stopped));
725 mir_prompt_session_release_sync(prompt_session);
726 }
727
728
729=== modified file 'tests/include/mir_test_doubles/mock_prompt_session_listener.h'
730--- tests/include/mir_test_doubles/mock_prompt_session_listener.h 2014-06-12 10:06:11 +0000
731+++ tests/include/mir_test_doubles/mock_prompt_session_listener.h 2015-01-12 15:38:36 +0000
732@@ -36,6 +36,8 @@
733
734 MOCK_METHOD1(starting, void(std::shared_ptr<scene::PromptSession> const&));
735 MOCK_METHOD1(stopping, void(std::shared_ptr<scene::PromptSession> const&));
736+ MOCK_METHOD1(suspending, void(std::shared_ptr<scene::PromptSession> const&));
737+ MOCK_METHOD1(resuming, void(std::shared_ptr<scene::PromptSession> const&));
738
739 MOCK_METHOD2(prompt_provider_added, void(scene::PromptSession const&, std::shared_ptr<scene::Session> const&));
740 MOCK_METHOD2(prompt_provider_removed, void(scene::PromptSession const&, std::shared_ptr<scene::Session> const&));
741
742=== modified file 'tests/include/mir_test_doubles/mock_scene_session.h'
743--- tests/include/mir_test_doubles/mock_scene_session.h 2014-09-11 05:51:44 +0000
744+++ tests/include/mir_test_doubles/mock_scene_session.h 2015-01-12 15:38:36 +0000
745@@ -55,6 +55,8 @@
746
747 MOCK_METHOD0(start_prompt_session, void());
748 MOCK_METHOD0(stop_prompt_session, void());
749+ MOCK_METHOD0(suspend_prompt_session, void());
750+ MOCK_METHOD0(resume_prompt_session, void());
751 };
752
753 }
754
755=== modified file 'tests/include/mir_test_doubles/null_prompt_session.h'
756--- tests/include/mir_test_doubles/null_prompt_session.h 2014-06-12 10:24:08 +0000
757+++ tests/include/mir_test_doubles/null_prompt_session.h 2015-01-12 15:38:36 +0000
758@@ -29,6 +29,22 @@
759 {
760 class NullPromptSession : public scene::PromptSession
761 {
762+public:
763+ void start(std::shared_ptr<scene::Session> const&) override
764+ {
765+ }
766+
767+ void stop(std::shared_ptr<scene::Session> const&) override
768+ {
769+ }
770+
771+ void suspend(std::shared_ptr<scene::Session> const&) override
772+ {
773+ }
774+
775+ void resume(std::shared_ptr<scene::Session> const&) override
776+ {
777+ }
778 };
779 }
780 }
781
782=== modified file 'tests/include/mir_test_doubles/null_prompt_session_manager.h'
783--- tests/include/mir_test_doubles/null_prompt_session_manager.h 2014-09-11 05:51:44 +0000
784+++ tests/include/mir_test_doubles/null_prompt_session_manager.h 2015-01-12 15:38:36 +0000
785@@ -41,6 +41,14 @@
786 {
787 }
788
789+ void suspend_prompt_session(std::shared_ptr<scene::PromptSession> const&) const override
790+ {
791+ }
792+
793+ void resume_prompt_session(std::shared_ptr<scene::PromptSession> const&) const override
794+ {
795+ }
796+
797 void add_prompt_provider(std::shared_ptr<scene::PromptSession> const&,
798 std::shared_ptr<scene::Session> const&) const
799 {
800
801=== modified file 'tests/include/mir_test_doubles/stub_scene_session.h'
802--- tests/include/mir_test_doubles/stub_scene_session.h 2014-09-11 05:51:44 +0000
803+++ tests/include/mir_test_doubles/stub_scene_session.h 2015-01-12 15:38:36 +0000
804@@ -88,6 +88,14 @@
805 {
806 }
807
808+ void suspend_prompt_session() override
809+ {
810+ }
811+
812+ void resume_prompt_session() override
813+ {
814+ }
815+
816 pid_t const pid;
817 };
818
819
820=== modified file 'tests/unit-tests/scene/CMakeLists.txt'
821--- tests/unit-tests/scene/CMakeLists.txt 2014-09-11 05:51:44 +0000
822+++ tests/unit-tests/scene/CMakeLists.txt 2015-01-12 15:38:36 +0000
823@@ -10,6 +10,7 @@
824 ${CMAKE_CURRENT_SOURCE_DIR}/test_mediating_display_changer.cpp
825 ${CMAKE_CURRENT_SOURCE_DIR}/test_prompt_session_container.cpp
826 ${CMAKE_CURRENT_SOURCE_DIR}/test_prompt_session_manager.cpp
827+ ${CMAKE_CURRENT_SOURCE_DIR}/test_prompt_session_impl.cpp
828
829 ${CMAKE_CURRENT_SOURCE_DIR}/test_surface.cpp
830 ${CMAKE_CURRENT_SOURCE_DIR}/test_surface_impl.cpp
831
832=== added file 'tests/unit-tests/scene/test_prompt_session_impl.cpp'
833--- tests/unit-tests/scene/test_prompt_session_impl.cpp 1970-01-01 00:00:00 +0000
834+++ tests/unit-tests/scene/test_prompt_session_impl.cpp 2015-01-12 15:38:36 +0000
835@@ -0,0 +1,110 @@
836+/*
837+ * Copyright © 2014 Canonical Ltd.
838+ *
839+ * This program is free software: you can redistribute it and/or modify it
840+ * under the terms of the GNU General Public License version 3,
841+ * as published by the Free Software Foundation.
842+ *
843+ * This program is distributed in the hope that it will be useful,
844+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
845+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
846+ * GNU General Public License for more details.
847+ *
848+ * You should have received a copy of the GNU General Public License
849+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
850+ *
851+ * Authored By: Nick Dedekind <nick.dedekind@canonical.com>
852+ */
853+
854+
855+#include "src/server/scene/prompt_session_impl.h"
856+
857+#include "mir_test_doubles/mock_scene_session.h"
858+#include "mir_test/fake_shared.h"
859+
860+#include <gmock/gmock.h>
861+#include <gtest/gtest.h>
862+
863+namespace ms = mir::scene;
864+namespace mt = mir::test;
865+namespace mtd = mir::test::doubles;
866+
867+using namespace ::testing;
868+
869+namespace
870+{
871+
872+struct PromptSession : public testing::Test
873+{
874+ std::shared_ptr<mtd::MockSceneSession> const helper{std::make_shared<::testing::NiceMock<mtd::MockSceneSession>>()};
875+};
876+
877+}
878+
879+TEST_F(PromptSession, start_when_stopped)
880+{
881+ ms::PromptSessionImpl prompt_session;
882+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_stopped);
883+
884+ EXPECT_CALL(*helper, start_prompt_session()).Times(1);
885+ prompt_session.start(helper);
886+
887+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_started);
888+}
889+
890+TEST_F(PromptSession, stop_when_started)
891+{
892+ ms::PromptSessionImpl prompt_session;
893+ prompt_session.start(helper);
894+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_started);
895+
896+ EXPECT_CALL(*helper, stop_prompt_session()).Times(1);
897+ prompt_session.stop(helper);
898+
899+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_stopped);
900+}
901+
902+TEST_F(PromptSession, suspend_when_started)
903+{
904+ ms::PromptSessionImpl prompt_session;
905+ prompt_session.start(helper);
906+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_started);
907+
908+ EXPECT_CALL(*helper, suspend_prompt_session()).Times(1);
909+ prompt_session.suspend(helper);
910+
911+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_suspended);
912+}
913+
914+TEST_F(PromptSession, suspend_fails_to_stop_helper_when_not_started)
915+{
916+ ms::PromptSessionImpl prompt_session;
917+
918+ EXPECT_CALL(*helper, suspend_prompt_session()).Times(0);
919+ prompt_session.suspend(helper);
920+
921+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_stopped);
922+}
923+
924+TEST_F(PromptSession, resume_when_suspended)
925+{
926+ ms::PromptSessionImpl prompt_session;
927+ prompt_session.start(helper);
928+ prompt_session.suspend(helper);
929+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_suspended);
930+
931+ EXPECT_CALL(*helper, resume_prompt_session()).Times(1);
932+ prompt_session.resume(helper);
933+
934+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_started);
935+}
936+
937+TEST_F(PromptSession, resume_fails_to_stop_helper_when_not_started)
938+{
939+ ms::PromptSessionImpl prompt_session;
940+
941+ EXPECT_CALL(*helper, resume_prompt_session()).Times(0);
942+ prompt_session.resume(helper);
943+
944+ EXPECT_EQ(prompt_session.state(), mir_prompt_session_state_stopped);
945+}
946
947=== modified file 'tests/unit-tests/scene/test_prompt_session_manager.cpp'
948--- tests/unit-tests/scene/test_prompt_session_manager.cpp 2014-09-11 05:51:44 +0000
949+++ tests/unit-tests/scene/test_prompt_session_manager.cpp 2015-01-12 15:38:36 +0000
950@@ -128,10 +128,20 @@
951 auto const prompt_session = session_manager.start_prompt_session_for(helper, parameters);
952
953 EXPECT_CALL(prompt_session_listener, stopping(Eq(prompt_session))).Times(1);
954+
955 session_manager.stop_prompt_session(prompt_session);
956-
957- // Need to verify explicitly as we see unmatched callbacks during teardown of fixture
958- Mock::VerifyAndClearExpectations(&prompt_session_listener);
959+}
960+
961+TEST_F(PromptSessionManager, notifies_provider_of_suspend_and_resume)
962+{
963+ InSequence seq;
964+ EXPECT_CALL(prompt_session_listener, suspending(_)).Times(1);
965+
966+ session_manager.suspend_prompt_session(prompt_session);
967+
968+ EXPECT_CALL(prompt_session_listener, resuming(Eq(prompt_session))).Times(1);
969+
970+ session_manager.resume_prompt_session(prompt_session);
971 }
972
973 TEST_F(PromptSessionManager, sets_helper_for)

Subscribers

People subscribed via source and target branches

to all changes: