Merge lp:~mzanetti/qtmir/exception-settings into lp:qtmir
- exception-settings
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Gerry Boland |
Approved revision: | 330 |
Merged at revision: | 331 |
Proposed branch: | lp:~mzanetti/qtmir/exception-settings |
Merge into: | lp:qtmir |
Diff against target: |
484 lines (+269/-3) 13 files modified
CMakeLists.txt (+1/-0) debian/control (+1/-0) debian/qtdeclarative5-qtmir-plugin.install (+1/-0) src/modules/Unity/Application/CMakeLists.txt (+6/-0) src/modules/Unity/Application/application_manager.cpp (+18/-2) src/modules/Unity/Application/application_manager.h (+4/-0) src/modules/Unity/Application/com.canonical.qtmir.gschema.xml (+10/-0) src/modules/Unity/Application/settings.cpp (+39/-0) src/modules/Unity/Application/settings.h (+45/-0) src/modules/Unity/Application/settings_interface.h (+40/-0) tests/modules/ApplicationManager/application_manager_test.cpp (+59/-0) tests/modules/common/mock_settings.h (+41/-0) tests/modules/common/qtmir_test.h (+4/-1) |
To merge this branch: | bzr merge lp:~mzanetti/qtmir/exception-settings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gerry Boland (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Daniel d'Andrada (community) | Abstain | ||
Review via email: mp+252921@code.launchpad.net |
Commit message
read exception list from gsettings instead of a hardcoded list
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?
yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
no
- 326. By Michael Zanetti
-
update build dep
PS Jenkins bot (ps-jenkins) wrote : | # |
- 327. By Michael Zanetti
-
camellCase it because the emitted key in the signal is converted to camelCase
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:327
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) wrote : | # |
Tests are crashing.
Daniel d'Andrada (dandrader) wrote : | # |
And the checklist is missing:
https:/
- 328. By Michael Zanetti
-
fix tests
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:328
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) : | # |
Gerry Boland (gerboland) wrote : | # |
Code looks ok, but there's no tests!
- 329. By Michael Zanetti
-
properly mock settings and add a test for it
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:329
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 330. By Michael Zanetti
-
merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:330
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Gerry Boland (gerboland) wrote : | # |
Code looks ok, testing on device now
Gerry Boland (gerboland) wrote : | # |
Ok, this works. I'm not 100% happy about having this setting defined by qtmir, as I want the lifecycle decision logic in the shell/unity8. Once that is done, the gsettings key will change, but that's ok as we know the users
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-03-18 10:12:16 +0000 |
3 | +++ CMakeLists.txt 2015-03-25 08:59:38 +0000 |
4 | @@ -77,6 +77,7 @@ |
5 | pkg_check_modules(GIO gio-2.0) |
6 | pkg_check_modules(GIO_UNIX gio-unix-2.0) |
7 | pkg_check_modules(LTTNG lttng-ust) |
8 | +pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt) |
9 | pkg_check_modules(QTDBUSTEST libqtdbustest-1 REQUIRED) |
10 | pkg_check_modules(QTDBUSMOCK libqtdbusmock-1 REQUIRED) |
11 | |
12 | |
13 | === modified file 'debian/control' |
14 | --- debian/control 2015-03-04 17:08:47 +0000 |
15 | +++ debian/control 2015-03-25 08:59:38 +0000 |
16 | @@ -16,6 +16,7 @@ |
17 | libfontconfig1-dev, |
18 | libgles2-mesa-dev, |
19 | libglib2.0-dev, |
20 | + libgsettings-qt-dev, |
21 | liblttng-ust-dev, |
22 | libmirclient-dev (>= 0.6.0), |
23 | libmircommon-dev, |
24 | |
25 | === modified file 'debian/qtdeclarative5-qtmir-plugin.install' |
26 | --- debian/qtdeclarative5-qtmir-plugin.install 2014-07-07 19:33:56 +0000 |
27 | +++ debian/qtdeclarative5-qtmir-plugin.install 2015-03-25 08:59:38 +0000 |
28 | @@ -1,1 +1,2 @@ |
29 | usr/lib/*/qt5/qml/* |
30 | +usr/share/glib-2.0/schemas |
31 | |
32 | === modified file 'src/modules/Unity/Application/CMakeLists.txt' |
33 | --- src/modules/Unity/Application/CMakeLists.txt 2015-01-08 12:37:08 +0000 |
34 | +++ src/modules/Unity/Application/CMakeLists.txt 2015-03-25 08:59:38 +0000 |
35 | @@ -9,6 +9,7 @@ |
36 | ${UBUNTU_APP_LAUNCH_INCLUDE_DIRS} |
37 | ${CMAKE_SOURCE_DIR}/src/platforms/mirserver |
38 | ${CMAKE_SOURCE_DIR}/src/common |
39 | + ${GSETTINGS_QT_INCLUDE_DIRS} |
40 | |
41 | ${LTTNG_INCLUDE_DIRS} |
42 | ${Qt5Gui_PRIVATE_INCLUDE_DIRS} |
43 | @@ -41,12 +42,14 @@ |
44 | sharedwakelock.cpp |
45 | upstart/applicationcontroller.cpp |
46 | tracepoints.c |
47 | + settings.cpp |
48 | # We need to run moc on these headers |
49 | /usr/include/unity/shell/application/ApplicationInfoInterface.h |
50 | /usr/include/unity/shell/application/ApplicationManagerInterface.h |
51 | # Feed the automoc monster |
52 | session_interface.h |
53 | applicationcontroller.h |
54 | + settings_interface.h |
55 | ) |
56 | |
57 | add_library(unityapplicationplugin SHARED |
58 | @@ -64,6 +67,7 @@ |
59 | ${PROCESS_CPP_LDFLAGS} |
60 | ${UBUNTU_APP_LAUNCH_LDFLAGS} |
61 | ${LTTNG_LDFLAGS} |
62 | + ${GSETTINGS_QT_LDFLAGS} |
63 | |
64 | ${GL_LIBRARIES} |
65 | |
66 | @@ -82,3 +86,5 @@ |
67 | |
68 | # install |
69 | add_qml_plugin(Unity.Application 0.1 Unity/Application TARGETS unityapplicationplugin) |
70 | +install(FILES com.canonical.qtmir.gschema.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas) |
71 | + |
72 | |
73 | === modified file 'src/modules/Unity/Application/application_manager.cpp' |
74 | --- src/modules/Unity/Application/application_manager.cpp 2015-02-25 11:27:56 +0000 |
75 | +++ src/modules/Unity/Application/application_manager.cpp 2015-03-25 08:59:38 +0000 |
76 | @@ -25,6 +25,7 @@ |
77 | #include "taskcontroller.h" |
78 | #include "upstart/applicationcontroller.h" |
79 | #include "tracepoints.h" // generated from tracepoints.tp |
80 | +#include "settings.h" |
81 | |
82 | // mirserver |
83 | #include "mirserver.h" |
84 | @@ -152,6 +153,7 @@ |
85 | QSharedPointer<DesktopFileReader::Factory> fileReaderFactory(new DesktopFileReader::Factory()); |
86 | QSharedPointer<ProcInfo> procInfo(new ProcInfo()); |
87 | QSharedPointer<SharedWakelock> sharedWakelock(new SharedWakelock); |
88 | + QSharedPointer<Settings> settings(new Settings()); |
89 | |
90 | // FIXME: We should use a QSharedPointer to wrap this ApplicationManager object, which requires us |
91 | // to use the data() method to pass the raw pointer to the QML engine. However the QML engine appears |
92 | @@ -163,7 +165,8 @@ |
93 | taskController, |
94 | sharedWakelock, |
95 | fileReaderFactory, |
96 | - procInfo |
97 | + procInfo, |
98 | + settings |
99 | ); |
100 | |
101 | connectToSessionListener(appManager, sessionListener); |
102 | @@ -199,18 +202,19 @@ |
103 | const QSharedPointer<SharedWakelock>& sharedWakelock, |
104 | const QSharedPointer<DesktopFileReader::Factory>& desktopFileReaderFactory, |
105 | const QSharedPointer<ProcInfo>& procInfo, |
106 | + const QSharedPointer<SettingsInterface>& settings, |
107 | QObject *parent) |
108 | : ApplicationManagerInterface(parent) |
109 | , m_mirServer(mirServer) |
110 | , m_focusedApplication(nullptr) |
111 | , m_mainStageApplication(nullptr) |
112 | , m_sideStageApplication(nullptr) |
113 | - , m_lifecycleExceptions(QStringList() << "com.ubuntu.music") |
114 | , m_dbusWindowStack(new DBusWindowStack(this)) |
115 | , m_taskController(taskController) |
116 | , m_desktopFileReaderFactory(desktopFileReaderFactory) |
117 | , m_procInfo(procInfo) |
118 | , m_sharedWakelock(sharedWakelock) |
119 | + , m_settings(settings) |
120 | , m_suspended(false) |
121 | , m_forceDashActive(false) |
122 | { |
123 | @@ -219,6 +223,11 @@ |
124 | |
125 | m_roleNames.insert(RoleSession, "session"); |
126 | m_roleNames.insert(RoleFullscreen, "fullscreen"); |
127 | + |
128 | + if (settings.data()) { |
129 | + m_lifecycleExceptions = m_settings->get("lifecycleExemptAppids").toStringList(); |
130 | + connect(m_settings.data(), &Settings::changed, this, &ApplicationManager::onSettingsChanged); |
131 | + } |
132 | } |
133 | |
134 | ApplicationManager::~ApplicationManager() |
135 | @@ -712,6 +721,13 @@ |
136 | } |
137 | } |
138 | |
139 | +void ApplicationManager::onSettingsChanged(const QString &key) |
140 | +{ |
141 | + if (key == "lifecycleExemptAppids") { |
142 | + m_lifecycleExceptions = m_settings->get("lifecycleExemptAppids").toStringList(); |
143 | + } |
144 | +} |
145 | + |
146 | void ApplicationManager::authorizeSession(const quint64 pid, bool &authorized) |
147 | { |
148 | tracepoint(qtmir, authorizeSession); |
149 | |
150 | === modified file 'src/modules/Unity/Application/application_manager.h' |
151 | --- src/modules/Unity/Application/application_manager.h 2015-01-09 11:23:34 +0000 |
152 | +++ src/modules/Unity/Application/application_manager.h 2015-03-25 08:59:38 +0000 |
153 | @@ -48,6 +48,7 @@ |
154 | class ProcInfo; |
155 | class SharedWakelock; |
156 | class TaskController; |
157 | +class SettingsInterface; |
158 | |
159 | class ApplicationManager : public unity::shell::application::ApplicationManagerInterface |
160 | { |
161 | @@ -86,6 +87,7 @@ |
162 | const QSharedPointer<SharedWakelock> &sharedWakelock, |
163 | const QSharedPointer<DesktopFileReader::Factory> &desktopFileReaderFactory, |
164 | const QSharedPointer<ProcInfo> &processInfo, |
165 | + const QSharedPointer<SettingsInterface> &settings, |
166 | QObject *parent = 0); |
167 | virtual ~ApplicationManager(); |
168 | |
169 | @@ -136,6 +138,7 @@ |
170 | |
171 | private Q_SLOTS: |
172 | void onAppDataChanged(const int role); |
173 | + void onSettingsChanged(const QString &key); |
174 | |
175 | private: |
176 | void setFocused(Application *application); |
177 | @@ -163,6 +166,7 @@ |
178 | QSharedPointer<DesktopFileReader::Factory> m_desktopFileReaderFactory; |
179 | QSharedPointer<ProcInfo> m_procInfo; |
180 | QSharedPointer<SharedWakelock> m_sharedWakelock; |
181 | + QSharedPointer<SettingsInterface> m_settings; |
182 | static ApplicationManager* the_application_manager; |
183 | QList<pid_t> m_hiddenPIDs; |
184 | bool m_suspended; |
185 | |
186 | === added file 'src/modules/Unity/Application/com.canonical.qtmir.gschema.xml' |
187 | --- src/modules/Unity/Application/com.canonical.qtmir.gschema.xml 1970-01-01 00:00:00 +0000 |
188 | +++ src/modules/Unity/Application/com.canonical.qtmir.gschema.xml 2015-03-25 08:59:38 +0000 |
189 | @@ -0,0 +1,10 @@ |
190 | +<schemalist> |
191 | + <schema path="/com/canonical/qtmir/" id="com.canonical.qtmir" gettext-domain="qtmir"> |
192 | + <key type="as" name="lifecycle-exempt-appids"> |
193 | + <default>[ |
194 | + 'com.ubuntu.music' |
195 | + ]</default> |
196 | + <summary>List of apps that should be excluded from the app lifecycle</summary> |
197 | + </key> |
198 | + </schema> |
199 | +</schemalist> |
200 | |
201 | === added file 'src/modules/Unity/Application/settings.cpp' |
202 | --- src/modules/Unity/Application/settings.cpp 1970-01-01 00:00:00 +0000 |
203 | +++ src/modules/Unity/Application/settings.cpp 2015-03-25 08:59:38 +0000 |
204 | @@ -0,0 +1,39 @@ |
205 | +/* |
206 | + * Copyright (C) 2015 Canonical, Ltd. |
207 | + * |
208 | + * This program is free software: you can redistribute it and/or modify it under |
209 | + * the terms of the GNU Lesser General Public License version 3, as published by |
210 | + * the Free Software Foundation. |
211 | + * |
212 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
213 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
214 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
215 | + * Lesser General Public License for more details. |
216 | + * |
217 | + * You should have received a copy of the GNU Lesser General Public License |
218 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
219 | + */ |
220 | + |
221 | +// Ubuntu |
222 | +#include <QGSettings> |
223 | +#include <QVariant> |
224 | + |
225 | +// local |
226 | +#include "settings.h" |
227 | + |
228 | +namespace qtmir |
229 | +{ |
230 | + |
231 | +Settings::Settings(QObject *parent) |
232 | + :SettingsInterface(parent) |
233 | + ,m_settings(new QGSettings("com.canonical.qtmir", "/com/canonical/qtmir/")) |
234 | +{ |
235 | + connect(m_settings, &QGSettings::changed, this, &Settings::changed); |
236 | +} |
237 | + |
238 | +QVariant Settings::get(const QString &key) const |
239 | +{ |
240 | + return m_settings->get(key); |
241 | +} |
242 | + |
243 | +} // namespace qtmir |
244 | |
245 | === added file 'src/modules/Unity/Application/settings.h' |
246 | --- src/modules/Unity/Application/settings.h 1970-01-01 00:00:00 +0000 |
247 | +++ src/modules/Unity/Application/settings.h 2015-03-25 08:59:38 +0000 |
248 | @@ -0,0 +1,45 @@ |
249 | +/* |
250 | + * Copyright (C) 2015 Canonical, Ltd. |
251 | + * |
252 | + * This program is free software: you can redistribute it and/or modify it under |
253 | + * the terms of the GNU Lesser General Public License version 3, as published by |
254 | + * the Free Software Foundation. |
255 | + * |
256 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
257 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
258 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
259 | + * Lesser General Public License for more details. |
260 | + * |
261 | + * You should have received a copy of the GNU Lesser General Public License |
262 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
263 | + */ |
264 | + |
265 | +#ifndef SETTINGS_H |
266 | +#define SETTINGS_H |
267 | + |
268 | +//Qt |
269 | +#include <QObject> |
270 | + |
271 | +// local |
272 | +#include "settings_interface.h" |
273 | + |
274 | +class QGSettings; |
275 | + |
276 | +namespace qtmir |
277 | +{ |
278 | + |
279 | +class Settings: public SettingsInterface |
280 | +{ |
281 | + Q_OBJECT |
282 | +public: |
283 | + explicit Settings(QObject *parent = 0); |
284 | + |
285 | + QVariant get(const QString &key) const override; |
286 | + |
287 | +private: |
288 | + QGSettings *m_settings; |
289 | +}; |
290 | + |
291 | +} |
292 | + |
293 | +#endif // SETTINGS_H |
294 | |
295 | === added file 'src/modules/Unity/Application/settings_interface.h' |
296 | --- src/modules/Unity/Application/settings_interface.h 1970-01-01 00:00:00 +0000 |
297 | +++ src/modules/Unity/Application/settings_interface.h 2015-03-25 08:59:38 +0000 |
298 | @@ -0,0 +1,40 @@ |
299 | +/* |
300 | + * Copyright (C) 2015 Canonical, Ltd. |
301 | + * |
302 | + * This program is free software: you can redistribute it and/or modify it under |
303 | + * the terms of the GNU Lesser General Public License version 3, as published by |
304 | + * the Free Software Foundation. |
305 | + * |
306 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
307 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
308 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
309 | + * Lesser General Public License for more details. |
310 | + * |
311 | + * You should have received a copy of the GNU Lesser General Public License |
312 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
313 | + */ |
314 | + |
315 | +#ifndef SETTINGS_INTERFACE_H |
316 | +#define SETTINGS_INTERFACE_H |
317 | + |
318 | +//Qt |
319 | +#include <QObject> |
320 | + |
321 | +namespace qtmir |
322 | +{ |
323 | + |
324 | +class SettingsInterface: public QObject |
325 | +{ |
326 | + Q_OBJECT |
327 | +public: |
328 | + explicit SettingsInterface(QObject *parent = 0): QObject(parent) {} |
329 | + |
330 | + virtual QVariant get(const QString &key) const = 0; |
331 | + |
332 | +Q_SIGNALS: |
333 | + void changed(const QString &key); |
334 | +}; |
335 | + |
336 | +} |
337 | + |
338 | +#endif // SETTINGS_INTERFACE_H |
339 | |
340 | === modified file 'tests/modules/ApplicationManager/application_manager_test.cpp' |
341 | --- tests/modules/ApplicationManager/application_manager_test.cpp 2015-03-18 10:12:16 +0000 |
342 | +++ tests/modules/ApplicationManager/application_manager_test.cpp 2015-03-25 08:59:38 +0000 |
343 | @@ -2235,6 +2235,65 @@ |
344 | applicationManager.focusApplication(webbrowserAppId); |
345 | } |
346 | |
347 | +TEST_F(ApplicationManagerTests,lifecycle_exempt_appId_is_not_suspended) |
348 | +{ |
349 | + using namespace ::testing; |
350 | + quint64 a_procId = 5921; |
351 | + const char an_app_id[] = "some_app"; |
352 | + QByteArray a_cmd( "/usr/bin/app1 --desktop_file_hint=some_app"); |
353 | + std::shared_ptr<mir::scene::Surface> aSurface(nullptr); |
354 | + |
355 | + ON_CALL(procInfo,command_line(_)).WillByDefault(Return(a_cmd)); |
356 | + |
357 | + ON_CALL(appController,appIdHasProcessId(_,_)).WillByDefault(Return(false)); |
358 | + |
359 | + bool authed = true; |
360 | + |
361 | + std::shared_ptr<mir::scene::Session> first_session = std::make_shared<MockSession>("Oo", a_procId); |
362 | + std::shared_ptr<mir::scene::Session> second_session = std::make_shared<MockSession>("oO", a_procId); |
363 | + applicationManager.authorizeSession(a_procId, authed); |
364 | + |
365 | + onSessionStarting(first_session); |
366 | + applicationManager.onSessionCreatedSurface(first_session.get(), aSurface); |
367 | + onSessionStarting(second_session); |
368 | + |
369 | + Application * the_app = applicationManager.findApplication(an_app_id); |
370 | + applicationManager.focusApplication(an_app_id); |
371 | + |
372 | + // Add to other apps to the list (Not "some_app") |
373 | + QVariantList lifecycleExemptAppIds; |
374 | + lifecycleExemptAppIds << "one_app" << "another_app"; |
375 | + ON_CALL(settings,get(_)).WillByDefault(Return(lifecycleExemptAppIds)); |
376 | + settings.changed("lifecycleExemptAppids"); |
377 | + |
378 | + EXPECT_EQ(Application::Running, the_app->state()); |
379 | + |
380 | + applicationManager.setSuspended(true); |
381 | + |
382 | + // And expect "some_app" to get suspended |
383 | + EXPECT_EQ(Application::Suspended, the_app->state()); |
384 | + |
385 | + applicationManager.setSuspended(false); |
386 | + |
387 | + EXPECT_EQ(Application::Running, the_app->state()); |
388 | + |
389 | + // Now add "some_app" to the exception list |
390 | + lifecycleExemptAppIds << "some_app"; |
391 | + ON_CALL(settings,get(_)).WillByDefault(Return(lifecycleExemptAppIds)); |
392 | + settings.changed("lifecycleExemptAppids"); |
393 | + |
394 | + EXPECT_EQ(Application::Running, the_app->state()); |
395 | + |
396 | + applicationManager.setSuspended(true); |
397 | + |
398 | + // And expect it to be running still |
399 | + EXPECT_EQ(Application::Running, the_app->state()); |
400 | + |
401 | + applicationManager.setSuspended(false); |
402 | + |
403 | + EXPECT_EQ(Application::Running, the_app->state()); |
404 | +} |
405 | + |
406 | /* |
407 | * Test lifecycle exempt applications have their wakelocks released when shell tries to suspend them |
408 | */ |
409 | |
410 | === added file 'tests/modules/common/mock_settings.h' |
411 | --- tests/modules/common/mock_settings.h 1970-01-01 00:00:00 +0000 |
412 | +++ tests/modules/common/mock_settings.h 2015-03-25 08:59:38 +0000 |
413 | @@ -0,0 +1,41 @@ |
414 | +/* |
415 | + * Copyright (C) 2015 Canonical, Ltd. |
416 | + * |
417 | + * This program is free software: you can redistribute it and/or modify it under |
418 | + * the terms of the GNU Lesser General Public License version 3, as published by |
419 | + * the Free Software Foundation. |
420 | + * |
421 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
422 | + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
423 | + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
424 | + * Lesser General Public License for more details. |
425 | + * |
426 | + * You should have received a copy of the GNU Lesser General Public License |
427 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
428 | + */ |
429 | + |
430 | +#ifndef MOCK_SETTINGS_H |
431 | +#define MOCK_SETTINGS_H |
432 | + |
433 | +#include <Unity/Application/settings_interface.h> |
434 | + |
435 | +#include <gmock/gmock.h> |
436 | + |
437 | +namespace testing |
438 | +{ |
439 | +struct MockSettings : public qtmir::SettingsInterface |
440 | +{ |
441 | + MockSettings() |
442 | + { |
443 | + QVariantList lifecycleExemptAppIds; |
444 | + lifecycleExemptAppIds << "com.ubuntu.music"; |
445 | + ON_CALL(*this, get(_)) |
446 | + .WillByDefault( |
447 | + Return(lifecycleExemptAppIds)); |
448 | + |
449 | + } |
450 | + MOCK_CONST_METHOD1(get, QVariant(const QString &)); |
451 | +}; |
452 | + |
453 | +} // namespace testing |
454 | +#endif // MOCK_SETTINGS_H |
455 | |
456 | === modified file 'tests/modules/common/qtmir_test.h' |
457 | --- tests/modules/common/qtmir_test.h 2015-02-06 09:47:21 +0000 |
458 | +++ tests/modules/common/qtmir_test.h 2015-03-25 08:59:38 +0000 |
459 | @@ -36,6 +36,7 @@ |
460 | #include "mock_prompt_session_manager.h" |
461 | #include "mock_prompt_session.h" |
462 | #include "mock_shared_wakelock.h" |
463 | +#include "mock_settings.h" |
464 | |
465 | namespace ms = mir::scene; |
466 | using namespace qtmir; |
467 | @@ -102,7 +103,8 @@ |
468 | QSharedPointer<DesktopFileReader::Factory>( |
469 | &desktopFileReaderFactory, |
470 | [](DesktopFileReader::Factory*){}), |
471 | - QSharedPointer<ProcInfo>(&procInfo,[](ProcInfo *){}) |
472 | + QSharedPointer<ProcInfo>(&procInfo,[](ProcInfo *){}), |
473 | + QSharedPointer<MockSettings>(&settings,[](MockSettings *){}) |
474 | } |
475 | , sessionManager{ |
476 | mirServer, |
477 | @@ -149,6 +151,7 @@ |
478 | testing::NiceMock<testing::MockProcInfo> procInfo; |
479 | testing::NiceMock<testing::MockDesktopFileReaderFactory> desktopFileReaderFactory; |
480 | testing::NiceMock<testing::MockSharedWakelock> sharedWakelock; |
481 | + testing::NiceMock<testing::MockSettings> settings; |
482 | QSharedPointer<FakeMirServer> mirServer; |
483 | MirShell *mirShell{nullptr}; |
484 | QSharedPointer<TaskController> taskController; |
FAILED: Continuous integration, rev:326 jenkins. qa.ubuntu. com/job/ qtmir-ci/ 236/ jenkins. qa.ubuntu. com/job/ qtmir-vivid- amd64-ci/ 87/console jenkins. qa.ubuntu. com/job/ qtmir-vivid- armhf-ci/ 87/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtmir- ci/236/ rebuild
http://