Merge lp:~dandrader/qtmir/removeDBusWindowStack into lp:qtmir
- removeDBusWindowStack
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~dandrader/qtmir/removeDBusWindowStack |
Merge into: | lp:qtmir |
Diff against target: |
1235 lines (+141/-426) 7 files modified
src/modules/Unity/Application/CMakeLists.txt (+0/-1) src/modules/Unity/Application/application_manager.cpp (+0/-39) src/modules/Unity/Application/application_manager.h (+0/-6) src/modules/Unity/Application/dbuswindowstack.cpp (+0/-116) src/modules/Unity/Application/dbuswindowstack.h (+0/-72) tests/framework/qtmir_test.cpp (+0/-1) tests/modules/ApplicationManager/application_manager_test.cpp (+141/-191) |
To merge this branch: | bzr merge lp:~dandrader/qtmir/removeDBusWindowStack |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gerry Boland (community) | Approve | ||
Unity8 CI Bot (community) | continuous-integration | Needs Fixing | |
Review via email: mp+298256@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-07-25.
Commit message
Remove com.canonical.
Nobody knows of anyone using it and the code is outdated
(pre surface-based WM era), so it doesn't even work correctly.
Therefore this is effectively dead code.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Not applicable
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Gerry Boland (gerboland) wrote : | # |
I'm happy to see this go. If such a feature is needed, it should appear in unity8
- 521. By Daniel d'Andrada
-
com.canonical.
Unity.FocusInfo D-Bus service for providing focus information - 522. By CI Train Bot Account
-
Releasing 0.4.8+16.
10.20160704. 1-0ubuntu1 - 523. By Michał Sawicz
-
Don't use root dbus path (LP: #1599145)
- 524. By CI Train Bot Account
-
Releasing 0.4.8+16.
10.20160705. 2-0ubuntu1 - 525. By Łukasz Zemczak
-
Build the qtmir-android package for arm64 as well.
- 526. By CI Train Bot Account
-
Releasing 0.4.8+16.
10.20160712- 0ubuntu1 - 527. By Daniel d'Andrada
-
Implement MirSurface:
:inputBounds and make use of mir's input region This allows us to finally drop the UbuntuKeyboardInfo hack.
Approved by: Gerry Boland
- 528. By CI Train Bot Account
-
Releasing 0.4.8+16.
10.20160714- 0ubuntu1 - 529. By Daniel d'Andrada
- 530. By Daniel d'Andrada
-
Remove com.canonical.
Unity.WindowSta ck D-Bus service Nobody knows of anyone using it and the code is outdated
(pre surface-based WM era), so it doesn't even work correctly.Therefore this is effectively dead code.
Unmerged revisions
Preview Diff
1 | === modified file 'src/modules/Unity/Application/CMakeLists.txt' |
2 | --- src/modules/Unity/Application/CMakeLists.txt 2016-07-05 12:41:04 +0000 |
3 | +++ src/modules/Unity/Application/CMakeLists.txt 2016-07-25 14:34:11 +0000 |
4 | @@ -31,7 +31,6 @@ |
5 | ../../../common/debughelpers.cpp |
6 | dbusfocusinfo.cpp |
7 | plugin.cpp |
8 | - dbuswindowstack.cpp |
9 | mirsurfacemanager.cpp |
10 | mirfocuscontroller.cpp |
11 | mirsurface.cpp |
12 | |
13 | === modified file 'src/modules/Unity/Application/application_manager.cpp' |
14 | --- src/modules/Unity/Application/application_manager.cpp 2016-06-24 16:28:37 +0000 |
15 | +++ src/modules/Unity/Application/application_manager.cpp 2016-07-25 14:34:11 +0000 |
16 | @@ -19,7 +19,6 @@ |
17 | #include "application.h" |
18 | #include "applicationinfo.h" |
19 | #include "dbusfocusinfo.h" |
20 | -#include "dbuswindowstack.h" |
21 | #include "mirfocuscontroller.h" |
22 | #include "session.h" |
23 | #include "sharedwakelock.h" |
24 | @@ -75,16 +74,6 @@ |
25 | return appId; |
26 | } |
27 | |
28 | -void connectToSessionListener(ApplicationManager *manager, SessionListener *listener) |
29 | -{ |
30 | - QObject::connect(listener, &SessionListener::sessionStarting, |
31 | - manager, &ApplicationManager::onSessionStarting); |
32 | - QObject::connect(listener, &SessionListener::sessionStopping, |
33 | - manager, &ApplicationManager::onSessionStopping); |
34 | - QObject::connect(listener, &SessionListener::sessionCreatedSurface, |
35 | - manager, &ApplicationManager::onSessionCreatedSurface); |
36 | -} |
37 | - |
38 | void connectToSessionAuthorizer(ApplicationManager *manager, SessionAuthorizer *authorizer) |
39 | { |
40 | QObject::connect(authorizer, &SessionAuthorizer::requestAuthorizationForSession, |
41 | @@ -120,7 +109,6 @@ |
42 | } |
43 | |
44 | MirWindowManager *windowManager = static_cast<MirWindowManager*>(nativeInterface->nativeResourceForIntegration("WindowManager")); |
45 | - SessionListener *sessionListener = static_cast<SessionListener*>(nativeInterface->nativeResourceForIntegration("SessionListener")); |
46 | SessionAuthorizer *sessionAuthorizer = static_cast<SessionAuthorizer*>(nativeInterface->nativeResourceForIntegration("SessionAuthorizer")); |
47 | |
48 | QSharedPointer<TaskController> taskController(new upstart::TaskController()); |
49 | @@ -140,7 +128,6 @@ |
50 | settings |
51 | ); |
52 | |
53 | - connectToSessionListener(appManager, sessionListener); |
54 | connectToSessionAuthorizer(appManager, sessionAuthorizer); |
55 | connectToTaskController(appManager, taskController.data()); |
56 | connect(windowManager, &MirWindowManager::sessionAboutToCreateSurface, |
57 | @@ -178,7 +165,6 @@ |
58 | QObject *parent) |
59 | : ApplicationManagerInterface(parent) |
60 | , m_dbusFocusInfo(new DBusFocusInfo(m_applications)) |
61 | - , m_dbusWindowStack(new DBusWindowStack(this)) |
62 | , m_taskController(taskController) |
63 | , m_procInfo(procInfo) |
64 | , m_sharedWakelock(sharedWakelock) |
65 | @@ -620,31 +606,6 @@ |
66 | authorized = true; |
67 | } |
68 | |
69 | -void ApplicationManager::onSessionStarting(std::shared_ptr<ms::Session> const& session) |
70 | -{ |
71 | - Q_UNUSED(session); |
72 | -} |
73 | - |
74 | -void ApplicationManager::onSessionStopping(std::shared_ptr<ms::Session> const& session) |
75 | -{ |
76 | - Application* application = findApplicationWithSession(session); |
77 | - if (application) { |
78 | - m_dbusWindowStack->WindowDestroyed(0, application->appId()); |
79 | - } |
80 | -} |
81 | - |
82 | -void ApplicationManager::onSessionCreatedSurface(ms::Session const* session, |
83 | - std::shared_ptr<ms::Surface> const& surface) |
84 | -{ |
85 | - qCDebug(QTMIR_APPLICATIONS) << "ApplicationManager::onSessionCreatedSurface - sessionName=" << session->name().c_str(); |
86 | - Q_UNUSED(surface); |
87 | - |
88 | - Application* application = findApplicationWithSession(session); |
89 | - if (application) { |
90 | - m_dbusWindowStack->WindowCreated(0, application->appId()); |
91 | - } |
92 | -} |
93 | - |
94 | Application* ApplicationManager::findApplicationWithSession(const std::shared_ptr<ms::Session> &session) |
95 | { |
96 | return findApplicationWithSession(session.get()); |
97 | |
98 | === modified file 'src/modules/Unity/Application/application_manager.h' |
99 | --- src/modules/Unity/Application/application_manager.h 2016-06-23 19:58:48 +0000 |
100 | +++ src/modules/Unity/Application/application_manager.h 2016-07-25 14:34:11 +0000 |
101 | @@ -102,11 +102,6 @@ |
102 | public Q_SLOTS: |
103 | void authorizeSession(const pid_t pid, bool &authorized); |
104 | |
105 | - void onSessionStarting(std::shared_ptr<mir::scene::Session> const& session); |
106 | - void onSessionStopping(std::shared_ptr<mir::scene::Session> const& session); |
107 | - |
108 | - void onSessionCreatedSurface(mir::scene::Session const*, std::shared_ptr<mir::scene::Surface> const&); |
109 | - |
110 | void onProcessStarting(const QString& appId); |
111 | void onProcessStopped(const QString& appId); |
112 | void onProcessSuspended(const QString& appId); |
113 | @@ -140,7 +135,6 @@ |
114 | |
115 | QList<Application*> m_applications; |
116 | DBusFocusInfo *m_dbusFocusInfo; |
117 | - DBusWindowStack* m_dbusWindowStack; |
118 | QSharedPointer<TaskController> m_taskController; |
119 | QSharedPointer<ProcInfo> m_procInfo; |
120 | QSharedPointer<SharedWakelock> m_sharedWakelock; |
121 | |
122 | === removed file 'src/modules/Unity/Application/dbuswindowstack.cpp' |
123 | --- src/modules/Unity/Application/dbuswindowstack.cpp 2016-01-20 21:36:39 +0000 |
124 | +++ src/modules/Unity/Application/dbuswindowstack.cpp 1970-01-01 00:00:00 +0000 |
125 | @@ -1,116 +0,0 @@ |
126 | -/* |
127 | - * Copyright (C) 2013-2015 Canonical, Ltd. |
128 | - * |
129 | - * This program is free software: you can redistribute it and/or modify it under |
130 | - * the terms of the GNU Lesser General Public License version 3, as published by |
131 | - * the Free Software Foundation. |
132 | - * |
133 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
134 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
135 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
136 | - * Lesser General Public License for more details. |
137 | - * |
138 | - * You should have received a copy of the GNU Lesser General Public License |
139 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
140 | - */ |
141 | - |
142 | -// local |
143 | -#include "dbuswindowstack.h" |
144 | -#include "application_manager.h" |
145 | - |
146 | -// Qt |
147 | -#include <QDBusConnection> |
148 | -#include <QDBusMetaType> |
149 | - |
150 | -namespace qtmir { |
151 | - |
152 | -DBusWindowStack::DBusWindowStack(ApplicationManager *parent) : QObject(parent) |
153 | -{ |
154 | - qRegisterMetaType<AppIdDesktopFile>(); |
155 | - qDBusRegisterMetaType<AppIdDesktopFile>(); |
156 | - qRegisterMetaType<WindowInfo>(); |
157 | - qRegisterMetaType< QList<WindowInfo> >(); |
158 | - qDBusRegisterMetaType<WindowInfo>(); |
159 | - qDBusRegisterMetaType< QList<WindowInfo> >(); |
160 | - |
161 | - QDBusConnection::sessionBus().registerService("com.canonical.Unity.WindowStack"); |
162 | - // TODO ExportScriptableSlots shouldn't be needed but without it i don't get the methods :-/ |
163 | - QDBusConnection::sessionBus().registerObject("/com/canonical/Unity/WindowStack", this, QDBusConnection::ExportAllSignals | QDBusConnection::ExportScriptableSlots |QDBusConnection::ExportScriptableInvokables ); |
164 | -} |
165 | - |
166 | -DBusWindowStack::~DBusWindowStack() |
167 | -{ |
168 | -} |
169 | - |
170 | -AppIdDesktopFile DBusWindowStack::GetAppIdFromPid(unsigned int pid) |
171 | -{ |
172 | - AppIdDesktopFile res; |
173 | - ApplicationManager *appMgr = static_cast<ApplicationManager*>(parent()); |
174 | - const Application *app = appMgr->findApplicationWithPid(pid); |
175 | - if (app) { |
176 | - res.app_id = app->appId(); |
177 | - res.desktop_file = ""; |
178 | - } |
179 | - return res; |
180 | -} |
181 | - |
182 | -QList<WindowInfo> DBusWindowStack::GetWindowStack() |
183 | -{ |
184 | - QList<WindowInfo> res; |
185 | - ApplicationManager *appMgr = static_cast<ApplicationManager*>(parent()); |
186 | - const QList<Application*> &applications = appMgr->list(); |
187 | - Q_FOREACH(Application* app, applications) { |
188 | - WindowInfo wi; |
189 | - wi.window_id = 0; |
190 | - wi.app_id = app->appId(); |
191 | - wi.focused = app->focused(); |
192 | - wi.stage = 0; |
193 | - res << wi; |
194 | - } |
195 | - return res; |
196 | -} |
197 | - |
198 | -QStringList DBusWindowStack::GetWindowProperties(unsigned int window_id, const QString &app_id, |
199 | - const QStringList &names) |
200 | -{ |
201 | - Q_UNUSED(window_id); |
202 | - Q_UNUSED(app_id); |
203 | - Q_UNUSED(names); |
204 | - return QStringList(); |
205 | -} |
206 | - |
207 | -QDBusArgument &operator<<(QDBusArgument &a, const AppIdDesktopFile &aidf) |
208 | -{ |
209 | - a.beginStructure(); |
210 | - a << aidf.app_id << aidf.desktop_file; |
211 | - a.endStructure(); |
212 | - return a; |
213 | -} |
214 | - |
215 | -const QDBusArgument &operator>>(const QDBusArgument &a, AppIdDesktopFile &aidf) |
216 | -{ |
217 | - a.beginStructure(); |
218 | - a >> aidf.app_id >> aidf.desktop_file; |
219 | - a.endStructure(); |
220 | - |
221 | - return a; |
222 | -} |
223 | - |
224 | -QDBusArgument &operator<<(QDBusArgument &a, const WindowInfo &wi) |
225 | -{ |
226 | - a.beginStructure(); |
227 | - a << wi.window_id << wi.app_id << wi.focused << wi.stage; |
228 | - a.endStructure(); |
229 | - return a; |
230 | -} |
231 | - |
232 | -const QDBusArgument &operator>>(const QDBusArgument &a, WindowInfo &wi) |
233 | -{ |
234 | - a.beginStructure(); |
235 | - a >> wi.window_id >> wi.app_id >> wi.focused >> wi.stage; |
236 | - a.endStructure(); |
237 | - |
238 | - return a; |
239 | -} |
240 | - |
241 | -} // namespace qtmir |
242 | |
243 | === removed file 'src/modules/Unity/Application/dbuswindowstack.h' |
244 | --- src/modules/Unity/Application/dbuswindowstack.h 2015-08-11 12:08:32 +0000 |
245 | +++ src/modules/Unity/Application/dbuswindowstack.h 1970-01-01 00:00:00 +0000 |
246 | @@ -1,72 +0,0 @@ |
247 | -/* |
248 | - * Copyright (C) 2013-2015 Canonical, Ltd. |
249 | - * |
250 | - * This program is free software: you can redistribute it and/or modify it under |
251 | - * the terms of the GNU Lesser General Public License version 3, as published by |
252 | - * the Free Software Foundation. |
253 | - * |
254 | - * This program is distributed in the hope that it will be useful, but WITHOUT |
255 | - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
256 | - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
257 | - * Lesser General Public License for more details. |
258 | - * |
259 | - * You should have received a copy of the GNU Lesser General Public License |
260 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
261 | - */ |
262 | - |
263 | -#ifndef DBUSWINDOWSTACK_H |
264 | -#define DBUSWINDOWSTACK_H |
265 | - |
266 | -#include <QObject> |
267 | -#include <QDBusArgument> |
268 | - |
269 | -namespace qtmir { |
270 | - |
271 | -class ApplicationManager; |
272 | - |
273 | -class AppIdDesktopFile |
274 | -{ |
275 | -public: |
276 | - QString app_id; |
277 | - QString desktop_file; |
278 | -}; |
279 | - |
280 | -QDBusArgument &operator<<(QDBusArgument &a, const AppIdDesktopFile &aidf); |
281 | -const QDBusArgument &operator>>(const QDBusArgument &a, AppIdDesktopFile &aidf); |
282 | - |
283 | -class WindowInfo |
284 | -{ |
285 | -public: |
286 | - unsigned int window_id; |
287 | - QString app_id; |
288 | - bool focused; |
289 | - unsigned int stage; |
290 | -}; |
291 | - |
292 | -QDBusArgument &operator<<(QDBusArgument &a, const WindowInfo &aidf); |
293 | -const QDBusArgument &operator>>(const QDBusArgument &a, WindowInfo &aidf); |
294 | - |
295 | -class DBusWindowStack : public QObject |
296 | -{ |
297 | - Q_OBJECT |
298 | - Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.WindowStack") |
299 | -public: |
300 | - explicit DBusWindowStack(ApplicationManager* parent); |
301 | - ~DBusWindowStack(); |
302 | - |
303 | - Q_INVOKABLE Q_SCRIPTABLE qtmir::AppIdDesktopFile GetAppIdFromPid(unsigned int pid); |
304 | - Q_INVOKABLE Q_SCRIPTABLE QList<qtmir::WindowInfo> GetWindowStack(); |
305 | - Q_INVOKABLE Q_SCRIPTABLE QStringList GetWindowProperties(unsigned int window_id, const QString &app_id, const QStringList &names); |
306 | - |
307 | -Q_SIGNALS: |
308 | - void FocusedWindowChanged(unsigned int window_id, const QString &app_id, unsigned int stage); |
309 | - void WindowCreated(unsigned int window_id, const QString &app_id); |
310 | - void WindowDestroyed(unsigned int window_id, const QString &app_id); |
311 | -}; |
312 | - |
313 | -} // namespace qtmir |
314 | - |
315 | -Q_DECLARE_METATYPE(qtmir::AppIdDesktopFile); |
316 | -Q_DECLARE_METATYPE(qtmir::WindowInfo); |
317 | - |
318 | -#endif // DBUSWINDOWSTACK_H |
319 | |
320 | === modified file 'tests/framework/qtmir_test.cpp' |
321 | --- tests/framework/qtmir_test.cpp 2016-05-06 08:23:46 +0000 |
322 | +++ tests/framework/qtmir_test.cpp 2016-07-25 14:34:11 +0000 |
323 | @@ -153,7 +153,6 @@ |
324 | EXPECT_EQ(authed, true); |
325 | |
326 | auto appSession = std::make_shared<mir::scene::MockSession>(appId.toStdString(), procId); |
327 | - applicationManager.onSessionStarting(appSession); |
328 | sessionManager.onSessionStarting(appSession); |
329 | |
330 | Mock::VerifyAndClearExpectations(taskController); |
331 | |
332 | === modified file 'tests/modules/ApplicationManager/application_manager_test.cpp' |
333 | --- tests/modules/ApplicationManager/application_manager_test.cpp 2016-05-30 14:50:26 +0000 |
334 | +++ tests/modules/ApplicationManager/application_manager_test.cpp 2016-07-25 14:34:11 +0000 |
335 | @@ -1,5 +1,5 @@ |
336 | /* |
337 | - * Copyright (C) 2013-2015 Canonical, Ltd. |
338 | + * Copyright (C) 2013-2016 Canonical, Ltd. |
339 | * |
340 | * This program is free software: you can redistribute it and/or modify it under |
341 | * the terms of the GNU Lesser General Public License version 3, as published by |
342 | @@ -42,14 +42,6 @@ |
343 | ~ApplicationManagerTests() { |
344 | } |
345 | |
346 | - inline void onSessionStarting(const std::shared_ptr<mir::scene::Session> &session) { |
347 | - applicationManager.onSessionStarting(session); |
348 | - sessionManager.onSessionStarting(session); |
349 | - } |
350 | - inline void onSessionStopping(const std::shared_ptr<mir::scene::Session> &session) { |
351 | - applicationManager.onSessionStopping(session); |
352 | - sessionManager.onSessionStopping(session); |
353 | - } |
354 | inline void onSessionCreatedSurface(const mir::scene::Session *mirSession, |
355 | MirSurfaceInterface *qmlSurface) { |
356 | |
357 | @@ -57,11 +49,6 @@ |
358 | if (qmlSession) { |
359 | qmlSession->registerSurface(qmlSurface); |
360 | } |
361 | - |
362 | - // I assume that applicationManager ignores the mirSurface parameter, so sending |
363 | - // a null shared pointer must suffice |
364 | - std::shared_ptr<mir::scene::Surface> mirSurface(nullptr); |
365 | - applicationManager.onSessionCreatedSurface(mirSession, mirSurface); |
366 | } |
367 | |
368 | inline void suspend(Application *application) { |
369 | @@ -91,7 +78,7 @@ |
370 | QByteArray cmdLine( "/usr/bin/dialer-app --desktop_file_hint=dialer-app"); |
371 | QByteArray secondcmdLine( "/usr/bin/dialer-app"); |
372 | |
373 | - FakeMirSurface *surface = new FakeMirSurface; |
374 | + FakeMirSurface surface; |
375 | |
376 | EXPECT_CALL(procInfo,command_line(firstProcId)) |
377 | .Times(1) |
378 | @@ -105,9 +92,9 @@ |
379 | std::shared_ptr<mir::scene::Session> mirSession = std::make_shared<MockSession>(dialer_app_id, firstProcId); |
380 | applicationManager.authorizeSession(firstProcId, authed); |
381 | ASSERT_EQ(true, authed); |
382 | - onSessionStarting(mirSession); |
383 | - onSessionCreatedSurface(mirSession.get(), surface); |
384 | - surface->drawFirstFrame(); |
385 | + sessionManager.onSessionStarting(mirSession); |
386 | + onSessionCreatedSurface(mirSession.get(), &surface); |
387 | + surface.drawFirstFrame(); |
388 | Application * application = applicationManager.findApplication(dialer_app_id); |
389 | ASSERT_NE(nullptr,application); |
390 | ASSERT_EQ(Application::InternalState::Running, application->internalState()); |
391 | @@ -118,8 +105,6 @@ |
392 | |
393 | EXPECT_FALSE(authed); |
394 | EXPECT_EQ(application, applicationManager.findApplication(dialer_app_id)); |
395 | - |
396 | - delete surface; |
397 | } |
398 | |
399 | TEST_F(ApplicationManagerTests,application_dies_while_starting) |
400 | @@ -137,10 +122,10 @@ |
401 | |
402 | std::shared_ptr<mir::scene::Session> mirSession = std::make_shared<MockSession>(app_id, procId); |
403 | applicationManager.authorizeSession(procId, authed); |
404 | - onSessionStarting(mirSession); |
405 | + sessionManager.onSessionStarting(mirSession); |
406 | Application * beforeFailure = applicationManager.findApplication(app_id); |
407 | applicationManager.onProcessStarting(app_id); |
408 | - onSessionStopping(mirSession); |
409 | + sessionManager.onSessionStopping(mirSession); |
410 | applicationManager.onProcessFailed(app_id, TaskController::Error::APPLICATION_FAILED_TO_START); |
411 | Application * afterFailure = applicationManager.findApplication(app_id); |
412 | |
413 | @@ -258,9 +243,9 @@ |
414 | applicationManager.authorizeSession(first_procId, authed); |
415 | applicationManager.authorizeSession(second_procId, authed); |
416 | applicationManager.authorizeSession(third_procId, authed); |
417 | - onSessionStarting(first_session); |
418 | - onSessionStarting(third_session); |
419 | - onSessionStarting(second_session); |
420 | + sessionManager.onSessionStarting(first_session); |
421 | + sessionManager.onSessionStarting(third_session); |
422 | + sessionManager.onSessionStarting(second_session); |
423 | |
424 | Application * firstApp = applicationManager.findApplication(first_app_id); |
425 | Application * secondApp = applicationManager.findApplication(second_app_id); |
426 | @@ -292,16 +277,16 @@ |
427 | std::shared_ptr<mir::scene::Session> second_session = std::make_shared<MockSession>("oO", a_procId); |
428 | applicationManager.authorizeSession(a_procId, authed); |
429 | |
430 | - onSessionStarting(first_session); |
431 | - onSessionStarting(second_session); |
432 | + sessionManager.onSessionStarting(first_session); |
433 | + sessionManager.onSessionStarting(second_session); |
434 | |
435 | Application * the_app = applicationManager.findApplication(an_app_id); |
436 | |
437 | EXPECT_EQ(true, authed); |
438 | EXPECT_EQ(second_session, the_app->session()->session()); |
439 | |
440 | - onSessionStopping(first_session); |
441 | - onSessionStopping(second_session); |
442 | + sessionManager.onSessionStopping(first_session); |
443 | + sessionManager.onSessionStopping(second_session); |
444 | qtApp.sendPostedEvents(nullptr, QEvent::DeferredDelete); |
445 | } |
446 | |
447 | @@ -315,7 +300,7 @@ |
448 | const pid_t a_procId = 5921; |
449 | const char an_app_id[] = "some_app"; |
450 | QByteArray a_cmd( "/usr/bin/app1 --desktop_file_hint=some_app"); |
451 | - FakeMirSurface *aSurface = new FakeMirSurface; |
452 | + FakeMirSurface aSurface; |
453 | |
454 | ON_CALL(procInfo,command_line(_)).WillByDefault(Return(a_cmd)); |
455 | |
456 | @@ -327,10 +312,10 @@ |
457 | std::shared_ptr<mir::scene::Session> second_session = std::make_shared<MockSession>("oO", a_procId); |
458 | applicationManager.authorizeSession(a_procId, authed); |
459 | |
460 | - onSessionStarting(first_session); |
461 | - onSessionCreatedSurface(first_session.get(), aSurface); |
462 | - aSurface->drawFirstFrame(); |
463 | - onSessionStarting(second_session); |
464 | + sessionManager.onSessionStarting(first_session); |
465 | + onSessionCreatedSurface(first_session.get(), &aSurface); |
466 | + aSurface.drawFirstFrame(); |
467 | + sessionManager.onSessionStarting(second_session); |
468 | |
469 | Application * the_app = applicationManager.findApplication(an_app_id); |
470 | |
471 | @@ -338,9 +323,8 @@ |
472 | EXPECT_EQ(Application::Running, the_app->state()); |
473 | EXPECT_EQ(first_session, the_app->session()->session()); |
474 | |
475 | - onSessionStopping(first_session); |
476 | - onSessionStopping(second_session); |
477 | - delete aSurface; |
478 | + sessionManager.onSessionStopping(first_session); |
479 | + sessionManager.onSessionStopping(second_session); |
480 | qtApp.sendPostedEvents(nullptr, QEvent::DeferredDelete); |
481 | } |
482 | |
483 | @@ -348,7 +332,7 @@ |
484 | { |
485 | using namespace ::testing; |
486 | const pid_t procId = 5921; |
487 | - FakeMirSurface *aSurface = new FakeMirSurface; |
488 | + FakeMirSurface aSurface; |
489 | QByteArray cmdLine( "/usr/bin/app --desktop_file_hint=app"); |
490 | |
491 | EXPECT_CALL(procInfo,command_line(procId)) |
492 | @@ -361,7 +345,7 @@ |
493 | |
494 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("Oo", procId); |
495 | applicationManager.authorizeSession(procId, authed); |
496 | - onSessionStarting(session); |
497 | + sessionManager.onSessionStarting(session); |
498 | |
499 | Application * app = applicationManager.findApplication("app"); |
500 | app->setRequestedState(Application::RequestedSuspended); |
501 | @@ -371,13 +355,11 @@ |
502 | |
503 | // Signal app is ready now |
504 | applicationManager.onProcessStarting("app"); |
505 | - onSessionCreatedSurface(session.get(), aSurface); |
506 | - aSurface->drawFirstFrame(); |
507 | + onSessionCreatedSurface(session.get(), &aSurface); |
508 | + aSurface.drawFirstFrame(); |
509 | |
510 | // now that its ready, suspend process should have begun |
511 | EXPECT_EQ(Application::InternalState::SuspendingWaitSession, app->internalState()); |
512 | - |
513 | - delete aSurface; |
514 | } |
515 | |
516 | TEST_F(ApplicationManagerTests,requestFocusApplication) |
517 | @@ -413,9 +395,9 @@ |
518 | applicationManager.authorizeSession(first_procId, authed); |
519 | applicationManager.authorizeSession(second_procId, authed); |
520 | applicationManager.authorizeSession(third_procId, authed); |
521 | - onSessionStarting(first_session); |
522 | - onSessionStarting(third_session); |
523 | - onSessionStarting(second_session); |
524 | + sessionManager.onSessionStarting(first_session); |
525 | + sessionManager.onSessionStarting(third_session); |
526 | + sessionManager.onSessionStarting(second_session); |
527 | |
528 | QSignalSpy spy(&applicationManager, SIGNAL(focusRequested(const QString &))); |
529 | |
530 | @@ -722,7 +704,7 @@ |
531 | // Authorize session and emit Mir sessionStarting event |
532 | bool authed = true; |
533 | applicationManager.authorizeSession(procId, authed); |
534 | - onSessionStarting(session); |
535 | + sessionManager.onSessionStarting(session); |
536 | |
537 | EXPECT_EQ(countSpy.count(), 0); |
538 | EXPECT_EQ(applicationManager.count(), 1); |
539 | @@ -757,18 +739,16 @@ |
540 | |
541 | bool authed = true; |
542 | applicationManager.authorizeSession(procId, authed); |
543 | - onSessionStarting(session); |
544 | - |
545 | - FakeMirSurface *surface = new FakeMirSurface; |
546 | - |
547 | - onSessionCreatedSurface(session.get(), surface); |
548 | - surface->drawFirstFrame(); |
549 | + sessionManager.onSessionStarting(session); |
550 | + |
551 | + FakeMirSurface surface; |
552 | + |
553 | + onSessionCreatedSurface(session.get(), &surface); |
554 | + surface.drawFirstFrame(); |
555 | |
556 | // Check application state is correctly set |
557 | Application *theApp = applicationManager.findApplication(appId); |
558 | EXPECT_EQ(theApp->state(), Application::Running); |
559 | - |
560 | - delete surface; |
561 | } |
562 | |
563 | /* |
564 | @@ -792,7 +772,7 @@ |
565 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
566 | bool authed = true; |
567 | applicationManager.authorizeSession(procId, authed); |
568 | - onSessionStarting(session); |
569 | + sessionManager.onSessionStarting(session); |
570 | |
571 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
572 | |
573 | @@ -807,7 +787,7 @@ |
574 | |
575 | // emulate mir session dying and taskController emitting processStopped(appId) in response |
576 | // to the taskController->stop(appId) call from applicationManager |
577 | - onSessionStopping(session); |
578 | + sessionManager.onSessionStopping(session); |
579 | applicationManager.onProcessStopped(appId); |
580 | |
581 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
582 | @@ -835,15 +815,15 @@ |
583 | std::shared_ptr<mir::scene::Session> session = std::make_shared<NiceMock<MockSession>>("", procId); |
584 | bool authed = true; |
585 | applicationManager.authorizeSession(procId, authed); |
586 | - onSessionStarting(session); |
587 | + sessionManager.onSessionStarting(session); |
588 | |
589 | - FakeMirSurface *surface = new FakeMirSurface; |
590 | - onSessionCreatedSurface(session.get(), surface); |
591 | + QScopedPointer<FakeMirSurface> surface(new FakeMirSurface); |
592 | + onSessionCreatedSurface(session.get(), surface.data()); |
593 | surface->drawFirstFrame(); |
594 | |
595 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
596 | |
597 | - QSignalSpy closeRequestedSpy(surface, SIGNAL(closeRequested())); |
598 | + QSignalSpy closeRequestedSpy(surface.data(), SIGNAL(closeRequested())); |
599 | |
600 | // Stop app |
601 | applicationManager.stopApplication(appId); |
602 | @@ -853,14 +833,13 @@ |
603 | EXPECT_EQ(1, closeRequestedSpy.count()); |
604 | |
605 | // comply |
606 | - delete surface; |
607 | - surface = nullptr; |
608 | + surface.reset(); |
609 | |
610 | // now it's the turn of the application process itself to go away, since its last surface has gone |
611 | EXPECT_EQ(Application::InternalState::Closing, app->internalState()); |
612 | |
613 | // Simulates that the application complied to the close() request and stopped itself |
614 | - onSessionStopping(session); |
615 | + sessionManager.onSessionStopping(session); |
616 | applicationManager.onProcessStopped(appId); |
617 | |
618 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
619 | @@ -888,22 +867,20 @@ |
620 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
621 | bool authed = true; |
622 | applicationManager.authorizeSession(procId, authed); |
623 | - onSessionStarting(session); |
624 | + sessionManager.onSessionStarting(session); |
625 | |
626 | - FakeMirSurface *surface = new FakeMirSurface; |
627 | - onSessionCreatedSurface(session.get(), surface); |
628 | - surface->drawFirstFrame(); |
629 | + FakeMirSurface surface; |
630 | + onSessionCreatedSurface(session.get(), &surface); |
631 | + surface.drawFirstFrame(); |
632 | |
633 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
634 | |
635 | - onSessionStopping(session); |
636 | + sessionManager.onSessionStopping(session); |
637 | // Upstart notifies of stopping app |
638 | applicationManager.onProcessStopped(appId); |
639 | |
640 | EXPECT_EQ(2, countSpy.count()); //FIXME(greyback) |
641 | EXPECT_EQ(0, applicationManager.count()); |
642 | - |
643 | - delete surface; |
644 | } |
645 | |
646 | /* |
647 | @@ -928,15 +905,15 @@ |
648 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
649 | bool authed = true; |
650 | applicationManager.authorizeSession(procId, authed); |
651 | - onSessionStarting(session); |
652 | + sessionManager.onSessionStarting(session); |
653 | |
654 | - FakeMirSurface *surface = new FakeMirSurface; |
655 | - onSessionCreatedSurface(session.get(), surface); |
656 | - surface->drawFirstFrame(); |
657 | + FakeMirSurface surface; |
658 | + onSessionCreatedSurface(session.get(), &surface); |
659 | + surface.drawFirstFrame(); |
660 | |
661 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
662 | |
663 | - onSessionStopping(session); |
664 | + sessionManager.onSessionStopping(session); |
665 | |
666 | // Upstart notifies of crashing / OOM killed app |
667 | applicationManager.onProcessFailed(appId, TaskController::Error::APPLICATION_CRASHED); |
668 | @@ -946,8 +923,6 @@ |
669 | |
670 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
671 | EXPECT_EQ(applicationManager.count(), 0); |
672 | - |
673 | - delete surface; |
674 | } |
675 | |
676 | /* |
677 | @@ -974,11 +949,11 @@ |
678 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
679 | bool authed = true; |
680 | applicationManager.authorizeSession(procId, authed); |
681 | - onSessionStarting(session); |
682 | + sessionManager.onSessionStarting(session); |
683 | |
684 | - FakeMirSurface *surface = new FakeMirSurface; |
685 | - onSessionCreatedSurface(session.get(), surface); |
686 | - surface->drawFirstFrame(); |
687 | + FakeMirSurface surface; |
688 | + onSessionCreatedSurface(session.get(), &surface); |
689 | + surface.drawFirstFrame(); |
690 | |
691 | suspend(app); |
692 | |
693 | @@ -986,7 +961,7 @@ |
694 | QSignalSpy focusSpy(&applicationManager, SIGNAL(focusedApplicationIdChanged())); |
695 | |
696 | // Mir reports disconnection |
697 | - onSessionStopping(session); |
698 | + sessionManager.onSessionStopping(session); |
699 | |
700 | // Upstart notifies of crashing / OOM-killed app |
701 | applicationManager.onProcessFailed(appId, TaskController::Error::APPLICATION_CRASHED); |
702 | @@ -998,8 +973,6 @@ |
703 | |
704 | EXPECT_EQ(0, countSpy.count()); |
705 | EXPECT_EQ(1, applicationManager.count()); |
706 | - |
707 | - delete surface; |
708 | } |
709 | |
710 | /* |
711 | @@ -1028,11 +1001,11 @@ |
712 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
713 | bool authed = true; |
714 | applicationManager.authorizeSession(procId, authed); |
715 | - onSessionStarting(session); |
716 | + sessionManager.onSessionStarting(session); |
717 | |
718 | - FakeMirSurface *surface = new FakeMirSurface; |
719 | - onSessionCreatedSurface(session.get(), surface); |
720 | - surface->drawFirstFrame(); |
721 | + FakeMirSurface surface; |
722 | + onSessionCreatedSurface(session.get(), &surface); |
723 | + surface.drawFirstFrame(); |
724 | |
725 | suspend(app); |
726 | |
727 | @@ -1040,7 +1013,7 @@ |
728 | QSignalSpy focusSpy(&applicationManager, SIGNAL(focusedApplicationIdChanged())); |
729 | |
730 | // Mir reports disconnection |
731 | - onSessionStopping(session); |
732 | + sessionManager.onSessionStopping(session); |
733 | |
734 | // Upstart notifies of crashing app |
735 | applicationManager.onProcessFailed(appId, TaskController::Error::APPLICATION_FAILED_TO_START); |
736 | @@ -1052,8 +1025,6 @@ |
737 | |
738 | EXPECT_EQ(countSpy.count(), 0); |
739 | EXPECT_EQ(applicationManager.count(), 1); |
740 | - |
741 | - delete surface; |
742 | } |
743 | |
744 | /* |
745 | @@ -1077,12 +1048,12 @@ |
746 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
747 | bool authed = true; |
748 | applicationManager.authorizeSession(procId, authed); |
749 | - onSessionStarting(session); |
750 | + sessionManager.onSessionStarting(session); |
751 | |
752 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
753 | |
754 | // Mir notifies of stopping app |
755 | - onSessionStopping(session); |
756 | + sessionManager.onSessionStopping(session); |
757 | |
758 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
759 | EXPECT_EQ(applicationManager.count(), 0); |
760 | @@ -1109,22 +1080,20 @@ |
761 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
762 | bool authed = true; |
763 | applicationManager.authorizeSession(procId, authed); |
764 | - onSessionStarting(session); |
765 | + sessionManager.onSessionStarting(session); |
766 | |
767 | // Associate a surface so AppMan considers app Running, check focused |
768 | - FakeMirSurface *surface = new FakeMirSurface; |
769 | - onSessionCreatedSurface(session.get(), surface); |
770 | - surface->drawFirstFrame(); |
771 | + FakeMirSurface surface; |
772 | + onSessionCreatedSurface(session.get(), &surface); |
773 | + surface.drawFirstFrame(); |
774 | |
775 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
776 | |
777 | // Mir notifies of stopping app |
778 | - onSessionStopping(session); |
779 | + sessionManager.onSessionStopping(session); |
780 | |
781 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
782 | EXPECT_EQ(applicationManager.count(), 0); |
783 | - |
784 | - delete surface; |
785 | } |
786 | |
787 | /* |
788 | @@ -1149,25 +1118,23 @@ |
789 | applicationManager.authorizeSession(procId, authed); |
790 | EXPECT_EQ(authed, true); |
791 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
792 | - onSessionStarting(session); |
793 | + sessionManager.onSessionStarting(session); |
794 | |
795 | // Associate a surface so AppMan considers app Running, check focused |
796 | - FakeMirSurface *surface = new FakeMirSurface; |
797 | - onSessionCreatedSurface(session.get(), surface); |
798 | - surface->drawFirstFrame(); |
799 | + FakeMirSurface surface; |
800 | + onSessionCreatedSurface(session.get(), &surface); |
801 | + surface.drawFirstFrame(); |
802 | |
803 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
804 | |
805 | // Mir notifies of stopping app |
806 | - onSessionStopping(session); |
807 | + sessionManager.onSessionStopping(session); |
808 | |
809 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
810 | EXPECT_EQ(applicationManager.count(), 0); |
811 | |
812 | Application *app = applicationManager.findApplication(appId); |
813 | EXPECT_EQ(nullptr, app); |
814 | - |
815 | - delete surface; |
816 | } |
817 | |
818 | /* |
819 | @@ -1192,7 +1159,7 @@ |
820 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
821 | bool authed = true; |
822 | applicationManager.authorizeSession(procId, authed); |
823 | - onSessionStarting(session); |
824 | + sessionManager.onSessionStarting(session); |
825 | EXPECT_EQ(Application::Starting, app->state()); |
826 | |
827 | app->setRequestedState(Application::RequestedSuspended); |
828 | @@ -1201,9 +1168,9 @@ |
829 | ASSERT_EQ(Application::InternalState::Starting, app->internalState()); |
830 | |
831 | // Associate a surface so AppMan considers app Running |
832 | - FakeMirSurface *surface = new FakeMirSurface; |
833 | - onSessionCreatedSurface(session.get(), surface); |
834 | - surface->drawFirstFrame(); |
835 | + FakeMirSurface surface; |
836 | + onSessionCreatedSurface(session.get(), &surface); |
837 | + surface.drawFirstFrame(); |
838 | |
839 | ASSERT_EQ(Application::InternalState::SuspendingWaitSession, app->internalState()); |
840 | |
841 | @@ -1216,14 +1183,12 @@ |
842 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
843 | |
844 | // Mir notifies of stopping app |
845 | - onSessionStopping(session); |
846 | + sessionManager.onSessionStopping(session); |
847 | |
848 | EXPECT_EQ(0, countSpy.count()); |
849 | EXPECT_EQ(1, applicationManager.count()); |
850 | |
851 | EXPECT_EQ(Application::Stopped, app->state()); |
852 | - |
853 | - delete surface; |
854 | } |
855 | |
856 | /* |
857 | @@ -1247,7 +1212,7 @@ |
858 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
859 | bool authed = true; |
860 | applicationManager.authorizeSession(procId, authed); |
861 | - onSessionStarting(session); |
862 | + sessionManager.onSessionStarting(session); |
863 | |
864 | Mock::VerifyAndClearExpectations(taskController); |
865 | EXPECT_CALL(*taskController, stop(appId)) |
866 | @@ -1259,7 +1224,7 @@ |
867 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
868 | |
869 | // the mir session always ends before upstart notifies the process has stopped |
870 | - onSessionStopping(session); |
871 | + sessionManager.onSessionStopping(session); |
872 | |
873 | // Upstart notifies of stopping app |
874 | applicationManager.onProcessStopped(appId); |
875 | @@ -1303,10 +1268,10 @@ |
876 | |
877 | bool authed = false; |
878 | applicationManager.authorizeSession(procId1, authed); |
879 | - onSessionStarting(session1); |
880 | + sessionManager.onSessionStarting(session1); |
881 | EXPECT_EQ(authed, true); |
882 | applicationManager.authorizeSession(procId2, authed); |
883 | - onSessionStarting(session2); |
884 | + sessionManager.onSessionStarting(session2); |
885 | EXPECT_EQ(authed, true); |
886 | FakeMirSurface *surface = new FakeMirSurface; |
887 | onSessionCreatedSurface(session2.get(), surface); |
888 | @@ -1315,8 +1280,8 @@ |
889 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
890 | |
891 | // Mir notifies of stopping app/Session |
892 | - onSessionStopping(session2); |
893 | - onSessionStopping(session1); |
894 | + sessionManager.onSessionStopping(session2); |
895 | + sessionManager.onSessionStopping(session1); |
896 | |
897 | EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback) |
898 | EXPECT_EQ(applicationManager.count(), 0); |
899 | @@ -1362,10 +1327,10 @@ |
900 | |
901 | bool authed = false; |
902 | applicationManager.authorizeSession(procId1, authed); |
903 | - onSessionStarting(session1); |
904 | + sessionManager.onSessionStarting(session1); |
905 | EXPECT_EQ(true, authed); |
906 | applicationManager.authorizeSession(procId2, authed); |
907 | - onSessionStarting(session2); |
908 | + sessionManager.onSessionStarting(session2); |
909 | EXPECT_EQ(true, authed); |
910 | |
911 | // both sessions create surfaces, then get them all suspended |
912 | @@ -1381,8 +1346,8 @@ |
913 | QSignalSpy countSpy(&applicationManager, SIGNAL(countChanged())); |
914 | |
915 | // Mir notifies of stopping app/Session |
916 | - onSessionStopping(session2); |
917 | - onSessionStopping(session1); |
918 | + sessionManager.onSessionStopping(session2); |
919 | + sessionManager.onSessionStopping(session1); |
920 | |
921 | EXPECT_EQ(0, countSpy.count()); |
922 | |
923 | @@ -1421,22 +1386,22 @@ |
924 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
925 | bool authed = true; |
926 | applicationManager.authorizeSession(procId, authed); |
927 | - onSessionStarting(session); |
928 | + sessionManager.onSessionStarting(session); |
929 | |
930 | // App creates surface, puts it in background, then is OOM killed. |
931 | - FakeMirSurface *surface = new FakeMirSurface; |
932 | - onSessionCreatedSurface(session.get(), surface); |
933 | + QScopedPointer<FakeMirSurface> surface(new FakeMirSurface); |
934 | + onSessionCreatedSurface(session.get(), surface.data()); |
935 | surface->drawFirstFrame(); |
936 | suspend(app); |
937 | |
938 | surface->setLive(false); |
939 | - onSessionStopping(session); |
940 | + sessionManager.onSessionStopping(session); |
941 | applicationManager.onProcessFailed(appId, TaskController::Error::APPLICATION_CRASHED); |
942 | applicationManager.onProcessStopped(appId); |
943 | |
944 | EXPECT_EQ(Application::Stopped, app->state()); |
945 | |
946 | - delete surface; surface = nullptr; |
947 | + surface.reset(); |
948 | |
949 | // Session should have called deleteLater() on itself, as it's zombie and doesn't hold any surface |
950 | // But DeferredDelete is special: likes to be called out specifically or it won't come out |
951 | @@ -1474,12 +1439,12 @@ |
952 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
953 | bool authed = true; |
954 | applicationManager.authorizeSession(procId, authed); |
955 | - onSessionStarting(session); |
956 | + sessionManager.onSessionStarting(session); |
957 | |
958 | // App creates surface, focuses it so state is running |
959 | - FakeMirSurface *surface = new FakeMirSurface; |
960 | - onSessionCreatedSurface(session.get(), surface); |
961 | - surface->drawFirstFrame(); |
962 | + FakeMirSurface surface; |
963 | + onSessionCreatedSurface(session.get(), &surface); |
964 | + surface.drawFirstFrame(); |
965 | |
966 | // Test normal lifecycle management as a control group |
967 | ASSERT_EQ(Application::InternalState::Running, the_app->internalState()); |
968 | @@ -1514,8 +1479,6 @@ |
969 | |
970 | EXPECT_EQ(Application::Running, the_app->state()); |
971 | ASSERT_EQ(Application::InternalState::Running, the_app->internalState()); |
972 | - |
973 | - delete surface; |
974 | } |
975 | |
976 | /* |
977 | @@ -1540,12 +1503,12 @@ |
978 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
979 | bool authed = true; |
980 | applicationManager.authorizeSession(procId, authed); |
981 | - onSessionStarting(session); |
982 | + sessionManager.onSessionStarting(session); |
983 | |
984 | // App creates surface, focuses it so state is running |
985 | - FakeMirSurface *surface = new FakeMirSurface; |
986 | - onSessionCreatedSurface(session.get(), surface); |
987 | - surface->drawFirstFrame(); |
988 | + FakeMirSurface surface; |
989 | + onSessionCreatedSurface(session.get(), &surface); |
990 | + surface.drawFirstFrame(); |
991 | |
992 | // Mark app as exempt |
993 | application->setExemptFromLifecycle(true); |
994 | @@ -1555,8 +1518,6 @@ |
995 | EXPECT_FALSE(sharedWakelock.enabled()); |
996 | ASSERT_EQ(Application::InternalState::RunningInBackground, application->internalState()); |
997 | EXPECT_EQ(Application::Running, application->state()); |
998 | - |
999 | - delete surface; |
1000 | } |
1001 | |
1002 | /* |
1003 | @@ -1580,7 +1541,7 @@ |
1004 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
1005 | bool authed = true; |
1006 | applicationManager.authorizeSession(procId, authed); |
1007 | - onSessionStarting(session); |
1008 | + sessionManager.onSessionStarting(session); |
1009 | |
1010 | // Create fake QML cache for this app |
1011 | QString path(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) |
1012 | @@ -1620,7 +1581,7 @@ |
1013 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
1014 | bool authed = true; |
1015 | applicationManager.authorizeSession(procId, authed); |
1016 | - onSessionStarting(session); |
1017 | + sessionManager.onSessionStarting(session); |
1018 | |
1019 | // Have app in fully Running state |
1020 | FakeMirSurface *aSurface = new FakeMirSurface; |
1021 | @@ -1635,7 +1596,7 @@ |
1022 | dir.mkpath(path); |
1023 | |
1024 | // Report app crash |
1025 | - onSessionStopping(session); |
1026 | + sessionManager.onSessionStopping(session); |
1027 | // Upstart notifies of **crashing** app |
1028 | applicationManager.onProcessFailed(appId, TaskController::Error::APPLICATION_FAILED_TO_START); |
1029 | applicationManager.onProcessStopped(appId); |
1030 | @@ -1665,12 +1626,12 @@ |
1031 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
1032 | bool authed = true; |
1033 | applicationManager.authorizeSession(procId, authed); |
1034 | - onSessionStarting(session); |
1035 | + sessionManager.onSessionStarting(session); |
1036 | |
1037 | // Have app in fully Running state |
1038 | - FakeMirSurface *aSurface = new FakeMirSurface; |
1039 | - onSessionCreatedSurface(session.get(), aSurface); |
1040 | - aSurface->drawFirstFrame(); |
1041 | + FakeMirSurface aSurface; |
1042 | + onSessionCreatedSurface(session.get(), &aSurface); |
1043 | + aSurface.drawFirstFrame(); |
1044 | ASSERT_EQ(Application::InternalState::Running, the_app->internalState()); |
1045 | |
1046 | // Create fake QML cache for this app |
1047 | @@ -1680,14 +1641,12 @@ |
1048 | dir.mkpath(path); |
1049 | |
1050 | // Report app stop |
1051 | - onSessionStopping(session); |
1052 | + sessionManager.onSessionStopping(session); |
1053 | // Upstart notifies of stopping app |
1054 | applicationManager.onProcessStopped(appId); |
1055 | |
1056 | EXPECT_EQ(0, applicationManager.count()); |
1057 | EXPECT_TRUE(dir.exists()); |
1058 | - |
1059 | - delete aSurface; |
1060 | } |
1061 | |
1062 | /* |
1063 | @@ -1702,18 +1661,16 @@ |
1064 | Application* app = startApplication(procId, appId); |
1065 | std::shared_ptr<mir::scene::Session> session = app->session()->session(); |
1066 | |
1067 | - FakeMirSurface *surface = new FakeMirSurface; |
1068 | - onSessionCreatedSurface(session.get(), surface); |
1069 | - surface->drawFirstFrame(); |
1070 | + FakeMirSurface surface; |
1071 | + onSessionCreatedSurface(session.get(), &surface); |
1072 | + surface.drawFirstFrame(); |
1073 | |
1074 | - QSignalSpy spy(surface, SIGNAL(closeRequested())); |
1075 | + QSignalSpy spy(&surface, SIGNAL(closeRequested())); |
1076 | |
1077 | // Stop app |
1078 | applicationManager.stopApplication(appId); |
1079 | |
1080 | EXPECT_EQ(1, spy.count()); |
1081 | - |
1082 | - delete surface; |
1083 | } |
1084 | |
1085 | |
1086 | @@ -1740,7 +1697,7 @@ |
1087 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
1088 | bool authed = true; |
1089 | applicationManager.authorizeSession(procId, authed); |
1090 | - onSessionStarting(session); |
1091 | + sessionManager.onSessionStarting(session); |
1092 | |
1093 | Mock::VerifyAndClearExpectations(taskController); |
1094 | |
1095 | @@ -1755,7 +1712,7 @@ |
1096 | applicationManager.stopApplication(appId); |
1097 | |
1098 | // the mir session always ends before upstart notifies the process has stopped |
1099 | - onSessionStopping(session); |
1100 | + sessionManager.onSessionStopping(session); |
1101 | |
1102 | // Upstart notifies of stopping app |
1103 | applicationManager.onProcessStopped(appId); |
1104 | @@ -1792,10 +1749,10 @@ |
1105 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
1106 | bool authed = true; |
1107 | applicationManager.authorizeSession(procId, authed); |
1108 | - onSessionStarting(session); |
1109 | + sessionManager.onSessionStarting(session); |
1110 | |
1111 | - FakeMirSurface *surface = new FakeMirSurface; |
1112 | - onSessionCreatedSurface(session.get(), surface); |
1113 | + QScopedPointer<FakeMirSurface> surface(new FakeMirSurface); |
1114 | + onSessionCreatedSurface(session.get(), surface.data()); |
1115 | surface->drawFirstFrame(); |
1116 | |
1117 | EXPECT_EQ(Application::InternalState::Running, app->internalState()); |
1118 | @@ -1808,7 +1765,7 @@ |
1119 | .Times(1) |
1120 | .WillOnce(Return(true)); |
1121 | |
1122 | - QSignalSpy closeRequestedSpy(surface, SIGNAL(closeRequested())); |
1123 | + QSignalSpy closeRequestedSpy(surface.data(), SIGNAL(closeRequested())); |
1124 | |
1125 | applicationManager.stopApplication(appId); |
1126 | |
1127 | @@ -1817,8 +1774,7 @@ |
1128 | EXPECT_EQ(1, closeRequestedSpy.count()); |
1129 | |
1130 | // comply |
1131 | - delete surface; |
1132 | - surface = nullptr; |
1133 | + surface.reset(); |
1134 | |
1135 | // now it's the turn of the application process itself to go away, since its last surface has gone |
1136 | EXPECT_EQ(Application::InternalState::Closing, app->internalState()); |
1137 | @@ -1830,7 +1786,7 @@ |
1138 | QSignalSpy appAddedSpy(&applicationManager, &QAbstractItemModel::rowsInserted); |
1139 | |
1140 | // Simulates that the application complied to the close() request and stopped itself |
1141 | - onSessionStopping(session); |
1142 | + sessionManager.onSessionStopping(session); |
1143 | applicationManager.onProcessStopped(appId); |
1144 | |
1145 | // DeferredDelete is special: likes to be called out specifically or it won't come out |
1146 | @@ -1869,19 +1825,19 @@ |
1147 | std::shared_ptr<mir::scene::Session> session1 = std::make_shared<MockSession>("", procId1); |
1148 | bool authed = true; |
1149 | applicationManager.authorizeSession(procId1, authed); |
1150 | - onSessionStarting(session1); |
1151 | + sessionManager.onSessionStarting(session1); |
1152 | |
1153 | - FakeMirSurface *surface1 = new FakeMirSurface; |
1154 | - surface1->setSession(app1->session()); |
1155 | - onSessionCreatedSurface(session1.get(), surface1); |
1156 | - surface1->drawFirstFrame(); |
1157 | + FakeMirSurface surface1; |
1158 | + surface1.setSession(app1->session()); |
1159 | + onSessionCreatedSurface(session1.get(), &surface1); |
1160 | + surface1.drawFirstFrame(); |
1161 | |
1162 | EXPECT_EQ(Application::InternalState::Running, app1->internalState()); |
1163 | |
1164 | QSignalSpy focusedApplicationIdChangedSpy(&applicationManager, |
1165 | &unityapi::ApplicationManagerInterface::focusedApplicationIdChanged); |
1166 | |
1167 | - MirFocusController::instance()->setFocusedSurface(surface1); |
1168 | + MirFocusController::instance()->setFocusedSurface(&surface1); |
1169 | qtApp.processEvents(); // process queued signal-slot connections |
1170 | |
1171 | EXPECT_EQ(1, focusedApplicationIdChangedSpy.count()); |
1172 | @@ -1896,30 +1852,26 @@ |
1173 | std::shared_ptr<mir::scene::Session> session2 = std::make_shared<MockSession>("", procId2); |
1174 | authed = true; |
1175 | applicationManager.authorizeSession(procId2, authed); |
1176 | - onSessionStarting(session2); |
1177 | + sessionManager.onSessionStarting(session2); |
1178 | |
1179 | - FakeMirSurface *surface2 = new FakeMirSurface; |
1180 | - surface2->setSession(app2->session()); |
1181 | - onSessionCreatedSurface(session2.get(), surface2); |
1182 | - surface2->drawFirstFrame(); |
1183 | + FakeMirSurface surface2; |
1184 | + surface2.setSession(app2->session()); |
1185 | + onSessionCreatedSurface(session2.get(), &surface2); |
1186 | + surface2.drawFirstFrame(); |
1187 | |
1188 | EXPECT_EQ(Application::InternalState::Running, app2->internalState()); |
1189 | |
1190 | - MirFocusController::instance()->setFocusedSurface(surface2); |
1191 | + MirFocusController::instance()->setFocusedSurface(&surface2); |
1192 | qtApp.processEvents(); // process queued signal-slot connections |
1193 | |
1194 | EXPECT_EQ(2, focusedApplicationIdChangedSpy.count()); |
1195 | EXPECT_EQ(appId2, applicationManager.focusedApplicationId()); |
1196 | |
1197 | - MirFocusController::instance()->setFocusedSurface(surface1); |
1198 | + MirFocusController::instance()->setFocusedSurface(&surface1); |
1199 | qtApp.processEvents(); // process queued signal-slot connections |
1200 | |
1201 | EXPECT_EQ(3, focusedApplicationIdChangedSpy.count()); |
1202 | EXPECT_EQ(appId1, applicationManager.focusedApplicationId()); |
1203 | - |
1204 | - // clean up |
1205 | - delete surface1; |
1206 | - delete surface2; |
1207 | } |
1208 | |
1209 | /* |
1210 | @@ -1947,20 +1899,18 @@ |
1211 | std::shared_ptr<mir::scene::Session> session = std::make_shared<MockSession>("", procId); |
1212 | bool authed = true; |
1213 | applicationManager.authorizeSession(procId, authed); |
1214 | - onSessionStarting(session); |
1215 | + sessionManager.onSessionStarting(session); |
1216 | |
1217 | - FakeMirSurface *surface = new FakeMirSurface; |
1218 | - onSessionCreatedSurface(session.get(), surface); |
1219 | - surface->drawFirstFrame(); |
1220 | + FakeMirSurface surface; |
1221 | + onSessionCreatedSurface(session.get(), &surface); |
1222 | + surface.drawFirstFrame(); |
1223 | |
1224 | EXPECT_EQ(Application::InternalState::Running, app->internalState()); |
1225 | |
1226 | QSignalSpy focusRequestedSpy(&applicationManager, |
1227 | &unityapi::ApplicationManagerInterface::focusRequested); |
1228 | |
1229 | - surface->requestFocus(); |
1230 | + surface.requestFocus(); |
1231 | |
1232 | EXPECT_EQ(1, focusRequestedSpy.count()); |
1233 | - |
1234 | - delete surface; |
1235 | } |
FAILED: Continuous integration, rev:521 /unity8- jenkins. ubuntu. com/job/ lp-qtmir- ci/293/ /unity8- jenkins. ubuntu. com/job/ build/2138/ console /unity8- jenkins. ubuntu. com/job/ build-0- fetch/2166 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 2075 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 2075 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 2075 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2066/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2066/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2066 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2066/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-qtmir- ci/293/ rebuild
https:/