Merge lp:~mterry/unity8/greeter-active into lp:unity8

Proposed by Michael Terry
Status: Superseded
Proposed branch: lp:~mterry/unity8/greeter-active
Merge into: lp:unity8
Prerequisite: lp:~josharenson/unity8/session-chooser-gui
Diff against target: 1541 lines (+980/-38)
40 files modified
data/unity8-greeter-wrapper (+11/-3)
debian/control (+1/-0)
debian/rules (+3/-2)
plugins/SessionBroadcast/SessionBroadcast.cpp (+36/-10)
plugins/SessionBroadcast/SessionBroadcast.h (+10/-3)
plugins/Utils/CMakeLists.txt (+1/-0)
plugins/Utils/URLDispatcher.cpp (+77/-0)
plugins/Utils/URLDispatcher.h (+47/-0)
plugins/Utils/plugin.cpp (+2/-0)
qml/Greeter/Greeter.qml (+2/-2)
qml/Greeter/LoginList.qml (+15/-2)
qml/Shell.qml (+35/-10)
tests/mocks/AccountsService/AccountsService.cpp (+19/-3)
tests/mocks/AccountsService/AccountsService.h (+3/-0)
tests/mocks/AccountsService/CMakeLists.txt (+14/-0)
tests/mocks/CMakeLists.txt (+1/-0)
tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp (+5/-0)
tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h (+2/-0)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+13/-1)
tests/mocks/SessionBroadcast/CMakeLists.txt (+8/-0)
tests/mocks/SessionBroadcast/SessionBroadcast.cpp (+34/-0)
tests/mocks/SessionBroadcast/SessionBroadcast.h (+39/-0)
tests/mocks/SessionBroadcast/plugin.cpp (+31/-0)
tests/mocks/SessionBroadcast/plugin.h (+32/-0)
tests/mocks/SessionBroadcast/qmldir (+2/-0)
tests/mocks/Utils/CMakeLists.txt (+1/-0)
tests/mocks/Utils/URLDispatcher.cpp (+38/-0)
tests/mocks/Utils/URLDispatcher.h (+47/-0)
tests/mocks/Utils/plugin.cpp (+2/-0)
tests/plugins/CMakeLists.txt (+1/-0)
tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp (+2/-2)
tests/plugins/SessionBroadcast/BroadcastServer.cpp (+33/-0)
tests/plugins/SessionBroadcast/BroadcastServer.h (+40/-0)
tests/plugins/SessionBroadcast/CMakeLists.txt (+45/-0)
tests/plugins/SessionBroadcast/interfaces.xml (+18/-0)
tests/plugins/SessionBroadcast/server.cpp (+37/-0)
tests/plugins/SessionBroadcast/sessionbroadcasttest.cpp (+111/-0)
tests/plugins/Utils/CMakeLists.txt (+9/-0)
tests/plugins/Utils/URLDispatcherTest.cpp (+78/-0)
tests/qmltests/tst_Shell.qml (+75/-0)
To merge this branch: bzr merge lp:~mterry/unity8/greeter-active
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+301422@code.launchpad.net

This proposal has been superseded by a proposal from 2016-08-11.

Commit message

Add an indicator to the greeter when a user is logged in (only shown if we have more than one user)

Description of the change

While in the area, I fixed the moveDuration time from an arbitrary(?) 200ms to an on-brand 165ms. Seems the same to me.

I couldn't think of a test for the active indicator that was more than a reiteration of the visible binding. So I didn't bother adding one.

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 Just pre-req

 * 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?
 NA

 * If you changed the UI, has there been a design review?
 I followed the design visuals for this, so design is pre-approved.
 https://docs.google.com/document/d/1X_doNFMLNDxsN3VcGM9I_tDlyzmao3MboQXW9duiAMc

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2048
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1842/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2400
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1299/console
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1299
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1299
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2428
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2315
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2315
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2315
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2308/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2308
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2308/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1842/rebuild

review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/greeter-active updated
2552. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2553. By Michael Terry

Connect our mock AccountsService background files with our mock liblightdm background files

2554. By Michael Terry

Fix deb build

2555. By Michael Terry

Fix usersmodel test

2556. By Michael Terry

Merge greeter-apps

2557. By Michael Terry

Merge greeter-apps

2558. By Michael Terry

Just always link to mock liblightdm, especially now that our mock AS module needs it

2559. By Michael Terry

Don't set mock backgrounds if none exist

2560. By Michael Terry

Merge greeter-apps

2561. By Michael Terry

Add an indicator to the greeter when a user is logged in (only shown if we have more than one user)

2562. By Michael Terry

Merge greeter-mock-bg

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/unity8-greeter-wrapper'
2--- data/unity8-greeter-wrapper 2016-06-14 17:53:56 +0000
3+++ data/unity8-greeter-wrapper 2016-08-11 17:58:52 +0000
4@@ -1,8 +1,7 @@
5 #!/bin/sh
6 # -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
7 #
8-# Copyright (C) 2011,2013 Canonical Ltd
9-# Author: Michael Terry <michael.terry@canonical.com>
10+# Copyright (C) 2011,2013,2016 Canonical Ltd
11 #
12 # This program is free software: you can redistribute it and/or modify it under
13 # the terms of the GNU General Public License as published by the Free Software
14@@ -42,6 +41,8 @@
15 SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
16 rm -f $SUB_SOCKET # clear socket in case we were hard shut down
17
18+echo "DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}" >"$XDG_RUNTIME_DIR/dbus-session"
19+
20 # If touch session script (which sets up grid units and mir variables) is available, use it
21 TOUCH_WRAPPER=
22 if [ -x /usr/bin/ubuntu-touch-session ]; then
23@@ -65,7 +66,14 @@
24 MIR_SOCKET=$SUB_SOCKET $TOUCH_WRAPPER /sbin/upstart --user --no-startup-event &
25 INIT_PID=$!
26 while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
27-export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
28+. "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session"
29+export UPSTART_SESSION
30+
31+# Connect upstart to system, but do first command in a loop to avoid any
32+# race condition between the session file above being written and upstart being
33+# ready to handle requests.
34+while ! /sbin/initctl notify-dbus-address "$DBUS_SESSION_BUS_ADDRESS"; do sleep 0.1; done
35+/sbin/initctl start notify-cgmanager
36
37 # Start any pre-greeter tasks if needed (like wizard)
38 /sbin/initctl emit unity8-greeter-starting
39
40=== modified file 'debian/control'
41--- debian/control 2016-08-03 15:53:00 +0000
42+++ debian/control 2016-08-11 17:58:52 +0000
43@@ -132,6 +132,7 @@
44 ${shlibs:Depends},
45 Recommends: indicator-keyboard,
46 indicator-session,
47+ unity-greeter-session-broadcast,
48 unity-scope-click,
49 unity-scope-mediascanner2,
50 Breaks: indicator-network (<< 0.5.1+14.10.20141014),
51
52=== modified file 'debian/rules'
53--- debian/rules 2016-06-20 14:56:40 +0000
54+++ debian/rules 2016-08-11 17:58:52 +0000
55@@ -37,6 +37,7 @@
56 override_dh_makeshlibs:
57 dh_makeshlibs -Nunity8-private -Nunity8-fake-env
58
59-# libMockLightDM-qml.so links against liblightdm-qt5-3.so which doesn't exist
60 override_dh_shlibdeps:
61- dh_shlibdeps -XlibMockLightDM-qml.so
62+ # Some mock libraries link against liblightdm-qt5-3.so which we want to
63+ # avoid, since we only really link against our mock one, not the system one.
64+ dh_shlibdeps -XlibMockLightDM-qml.so -XlibMockAccountsService-qml.so
65
66=== modified file 'plugins/SessionBroadcast/SessionBroadcast.cpp'
67--- plugins/SessionBroadcast/SessionBroadcast.cpp 2016-04-19 20:36:29 +0000
68+++ plugins/SessionBroadcast/SessionBroadcast.cpp 2016-08-11 17:58:52 +0000
69@@ -1,5 +1,5 @@
70 /*
71- * Copyright (C) 2013 Canonical, Ltd.
72+ * Copyright (C) 2013,2016 Canonical, Ltd.
73 *
74 * This program is free software; you can redistribute it and/or modify
75 * it under the terms of the GNU General Public License as published by
76@@ -12,12 +12,12 @@
77 *
78 * You should have received a copy of the GNU General Public License
79 * along with this program. If not, see <http://www.gnu.org/licenses/>.
80- *
81- * Author: Michael Terry <michael.terry@canonical.com>
82 */
83
84 #include "SessionBroadcast.h"
85 #include <QDBusConnection>
86+#include <QDBusConnectionInterface>
87+#include <QDBusInterface>
88
89 #include <glib.h>
90
91@@ -27,13 +27,39 @@
92 m_username = QString::fromUtf8(g_get_user_name());
93
94 auto connection = QDBusConnection::SM_BUSNAME();
95-
96- connection.connect(QStringLiteral("com.canonical.Unity.Greeter.Broadcast"),
97- QStringLiteral("/com/canonical/Unity/Greeter/Broadcast"),
98- QStringLiteral("com.canonical.Unity.Greeter.Broadcast"),
99- QStringLiteral("ShowHome"),
100- this,
101- SLOT(onShowHome(const QString &)));
102+ auto interface = connection.interface();
103+ interface->startService(QStringLiteral("com.canonical.Unity.Greeter.Broadcast"));
104+
105+ m_broadcaster = new QDBusInterface(QStringLiteral("com.canonical.Unity.Greeter.Broadcast"),
106+ QStringLiteral("/com/canonical/Unity/Greeter/Broadcast"),
107+ QStringLiteral("com.canonical.Unity.Greeter.Broadcast"),
108+ connection, this);
109+
110+ connect(m_broadcaster, SIGNAL(StartUrl(const QString &, const QString &)),
111+ this, SLOT(onStartUrl(const QString &, const QString &)));
112+
113+ connect(m_broadcaster, SIGNAL(ShowHome(const QString &)),
114+ this, SLOT(onShowHome(const QString &)));
115+}
116+
117+void SessionBroadcast::requestUrlStart(const QString &username, const QString &url)
118+{
119+ m_broadcaster->asyncCall(QStringLiteral("RequestUrlStart"), username, url);
120+}
121+
122+void SessionBroadcast::requestHomeShown(const QString &username)
123+{
124+ m_broadcaster->asyncCall(QStringLiteral("RequestHomeShown"), username);
125+}
126+
127+void SessionBroadcast::onStartUrl(const QString &username, const QString &url)
128+{
129+ // Since this signal is just used for testing, we don't *really* care if
130+ // username matches, but just in case we do eventually use the signal, we
131+ // should only listen to our own requests.
132+ if (username == m_username) {
133+ Q_EMIT startUrl(url);
134+ }
135 }
136
137 void SessionBroadcast::onShowHome(const QString &username)
138
139=== modified file 'plugins/SessionBroadcast/SessionBroadcast.h'
140--- plugins/SessionBroadcast/SessionBroadcast.h 2016-04-06 19:03:42 +0000
141+++ plugins/SessionBroadcast/SessionBroadcast.h 2016-08-11 17:58:52 +0000
142@@ -1,5 +1,5 @@
143 /*
144- * Copyright (C) 2013 Canonical, Ltd.
145+ * Copyright (C) 2013,2016 Canonical, Ltd.
146 *
147 * This program is free software; you can redistribute it and/or modify
148 * it under the terms of the GNU General Public License as published by
149@@ -12,8 +12,6 @@
150 *
151 * You should have received a copy of the GNU General Public License
152 * along with this program. If not, see <http://www.gnu.org/licenses/>.
153- *
154- * Authors: Michael Terry <michael.terry@canonical.com>
155 */
156
157 #ifndef UNITY_SESSIONBROADCAST_H
158@@ -31,14 +29,23 @@
159 public:
160 explicit SessionBroadcast(QObject *parent = 0);
161
162+ Q_INVOKABLE void requestUrlStart(const QString &username, const QString &url);
163+ Q_INVOKABLE void requestHomeShown(const QString &username);
164+
165 Q_SIGNALS:
166+ // This signal isn't actually used by the shell
167+ // (unity-greeter-session-broadcast handles launching an app for us), but
168+ // it's useful for testing the plugin.
169+ void startUrl(const QString &url);
170 void showHome();
171
172 private Q_SLOTS:
173+ void onStartUrl(const QString &username, const QString &url);
174 void onShowHome(const QString &username);
175
176 private:
177 QString m_username;
178+ QDBusInterface *m_broadcaster;
179 };
180
181 #endif
182
183=== modified file 'plugins/Utils/CMakeLists.txt'
184--- plugins/Utils/CMakeLists.txt 2016-06-27 18:45:27 +0000
185+++ plugins/Utils/CMakeLists.txt 2016-08-11 17:58:52 +0000
186@@ -29,6 +29,7 @@
187 inputeventgenerator.cpp
188 deviceconfigparser.cpp
189 globalfunctions.cpp
190+ URLDispatcher.cpp
191 plugin.cpp
192 )
193
194
195=== added file 'plugins/Utils/URLDispatcher.cpp'
196--- plugins/Utils/URLDispatcher.cpp 1970-01-01 00:00:00 +0000
197+++ plugins/Utils/URLDispatcher.cpp 2016-08-11 17:58:52 +0000
198@@ -0,0 +1,77 @@
199+/*
200+ * Copyright (C) 2016 Canonical, Ltd.
201+ *
202+ * This program is free software; you can redistribute it and/or modify
203+ * it under the terms of the GNU General Public License as published by
204+ * the Free Software Foundation; version 3.
205+ *
206+ * This program is distributed in the hope that it will be useful,
207+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
208+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
209+ * GNU General Public License for more details.
210+ *
211+ * You should have received a copy of the GNU General Public License
212+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
213+ */
214+
215+#include "URLDispatcher.h"
216+
217+#include <QDBusConnection>
218+
219+class URLDispatcherInterface : public QObject
220+{
221+ Q_OBJECT
222+ Q_CLASSINFO("D-Bus Interface", "com.canonical.URLDispatcher")
223+
224+public:
225+ explicit URLDispatcherInterface(URLDispatcher *parent);
226+
227+ Q_SCRIPTABLE void DispatchURL(const QString &url, const QString &package);
228+};
229+
230+URLDispatcherInterface::URLDispatcherInterface(URLDispatcher *parent)
231+ : QObject(parent)
232+{
233+}
234+
235+void URLDispatcherInterface::DispatchURL(const QString &url, const QString &package)
236+{
237+ Q_UNUSED(package);
238+ Q_EMIT static_cast<URLDispatcher *>(parent())->urlRequested(url);
239+}
240+
241+URLDispatcher::URLDispatcher(QObject *parent)
242+ : QObject(parent)
243+ , m_dispatcher(nullptr)
244+{
245+}
246+
247+bool URLDispatcher::active() const
248+{
249+ return m_dispatcher != nullptr;
250+}
251+
252+void URLDispatcher::setActive(bool value)
253+{
254+ if (value == active())
255+ return;
256+
257+ QDBusConnection connection = QDBusConnection::sessionBus();
258+
259+ if (value) {
260+ URLDispatcherInterface *dispatcher = new URLDispatcherInterface(this);
261+ connection.registerObject(QStringLiteral("/com/canonical/URLDispatcher"),
262+ dispatcher,
263+ QDBusConnection::ExportScriptableContents);
264+ connection.registerService(QStringLiteral("com.canonical.URLDispatcher"));
265+ m_dispatcher = dispatcher;
266+ } else {
267+ connection.unregisterService(QStringLiteral("com.canonical.URLDispatcher"));
268+ delete m_dispatcher;
269+ m_dispatcher = nullptr;
270+ }
271+
272+ Q_EMIT activeChanged();
273+}
274+
275+#include "URLDispatcher.moc"
276
277=== added file 'plugins/Utils/URLDispatcher.h'
278--- plugins/Utils/URLDispatcher.h 1970-01-01 00:00:00 +0000
279+++ plugins/Utils/URLDispatcher.h 2016-08-11 17:58:52 +0000
280@@ -0,0 +1,47 @@
281+/*
282+ * Copyright (C) 2016 Canonical, Ltd.
283+ *
284+ * This program is free software; you can redistribute it and/or modify
285+ * it under the terms of the GNU General Public License as published by
286+ * the Free Software Foundation; version 3.
287+ *
288+ * This program is distributed in the hope that it will be useful,
289+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
290+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
291+ * GNU General Public License for more details.
292+ *
293+ * You should have received a copy of the GNU General Public License
294+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
295+ */
296+
297+#ifndef UNITY_URLDISPATCHER_H
298+#define UNITY_URLDISPATCHER_H
299+
300+#include <QObject>
301+#include <QString>
302+
303+// This class manages our url-dispatcher interception. We intercept
304+// url-dispatcher because rather than spawning the handler for the URL
305+// in our own session, we want to notify the user session to do it for us
306+// (and start an unlock in the process).
307+
308+class URLDispatcher : public QObject
309+{
310+ Q_OBJECT
311+ Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
312+
313+public:
314+ explicit URLDispatcher(QObject *parent=0);
315+
316+ bool active() const;
317+ void setActive(bool active);
318+
319+Q_SIGNALS:
320+ void urlRequested(const QString &url);
321+ void activeChanged();
322+
323+private:
324+ QObject *m_dispatcher;
325+};
326+
327+#endif
328
329=== modified file 'plugins/Utils/plugin.cpp'
330--- plugins/Utils/plugin.cpp 2016-04-29 20:07:03 +0000
331+++ plugins/Utils/plugin.cpp 2016-08-11 17:58:52 +0000
332@@ -38,6 +38,7 @@
333 #include "inputeventgenerator.h"
334 #include "deviceconfigparser.h"
335 #include "globalfunctions.h"
336+#include "URLDispatcher.h"
337
338 static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
339 {
340@@ -80,4 +81,5 @@
341 qmlRegisterType<InputEventGenerator>(uri, 0, 1, "InputEventGenerator");
342 qmlRegisterType<DeviceConfigParser>(uri, 0, 1, "DeviceConfigParser");
343 qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions);
344+ qmlRegisterType<URLDispatcher>(uri, 0, 1, "URLDispatcher");
345 }
346
347=== modified file 'qml/Greeter/Greeter.qml'
348--- qml/Greeter/Greeter.qml 2016-08-11 17:58:51 +0000
349+++ qml/Greeter/Greeter.qml 2016-08-11 17:58:52 +0000
350@@ -105,8 +105,8 @@
351 }
352 }
353
354- // Notify that the user has explicitly requested the given app through unity8 GUI.
355- function notifyUserRequestedApp(appId) {
356+ // Notify that the user has explicitly requested an app
357+ function notifyUserRequestedApp() {
358 if (!active) {
359 return;
360 }
361
362=== modified file 'qml/Greeter/LoginList.qml'
363--- qml/Greeter/LoginList.qml 2016-08-11 17:58:51 +0000
364+++ qml/Greeter/LoginList.qml 2016-08-11 17:58:52 +0000
365@@ -34,7 +34,7 @@
366 readonly property int numAboveBelow: 4
367 readonly property int cellHeight: units.gu(5)
368 readonly property int highlightedHeight: units.gu(15)
369- readonly property int moveDuration: 200
370+ readonly property int moveDuration: UbuntuAnimation.FastDuration
371 property string selectedSession
372 property string currentSession
373 readonly property string currentUser: userList.currentItem.username
374@@ -201,9 +201,22 @@
375 bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
376 }
377 text: realName
378- color: userList.currentIndex !== index ? theme.palette.normal.raised : theme.palette.normal.raisedText
379+ color: userList.currentIndex !== index ? theme.palette.normal.raised
380+ : theme.palette.normal.raisedText
381
382 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
383+
384+ Rectangle {
385+ id: activeIndicator
386+ anchors.horizontalCenter: parent.left
387+ anchors.horizontalCenterOffset: -units.gu(1)
388+ anchors.verticalCenter: parent.verticalCenter
389+ color: userList.currentIndex !== index ? theme.palette.normal.raised
390+ : theme.palette.normal.focus
391+ visible: userList.count > 1 && loggedIn
392+ height: units.gu(0.5)
393+ width: height
394+ }
395 }
396
397 MouseArea {
398
399=== modified file 'qml/Shell.qml'
400--- qml/Shell.qml 2016-08-03 15:52:10 +0000
401+++ qml/Shell.qml 2016-08-11 17:58:52 +0000
402@@ -151,6 +151,22 @@
403 readonly property alias greeter: greeterLoader.item
404
405 function activateApplication(appId) {
406+ // Either open the app in our own session, or -- if we're acting as a
407+ // greeter -- ask the user's session to open it for us.
408+ if (shell.mode === "greeter") {
409+ activateURL("application:///" + appId + ".desktop");
410+ } else {
411+ startApp(appId);
412+ }
413+ }
414+
415+ function activateURL(url) {
416+ SessionBroadcast.requestUrlStart(AccountsService.user, url);
417+ greeter.notifyUserRequestedApp();
418+ panel.indicators.hide();
419+ }
420+
421+ function startApp(appId) {
422 if (ApplicationManager.findApplication(appId)) {
423 ApplicationManager.requestFocusApplication(appId);
424 } else {
425@@ -162,7 +178,7 @@
426 if (greeter.locked) {
427 greeter.lockedApp = app;
428 }
429- shell.activateApplication(app);
430+ startApp(app); // locked apps are always in our same session
431 }
432
433 Binding {
434@@ -259,9 +275,7 @@
435 ? "phone"
436 : shell.usageScenario
437 readonly property string qmlComponent: {
438- if (shell.mode === "greeter") {
439- return "Stages/AbstractStage.qml"
440- } else if (applicationsDisplayLoader.usageScenario === "phone") {
441+ if (applicationsDisplayLoader.usageScenario === "phone") {
442 return "Stages/PhoneStage.qml";
443 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
444 return "Stages/TabletStage.qml";
445@@ -499,11 +513,15 @@
446 }
447
448 function showHome() {
449- greeter.notifyUserRequestedApp("unity8-dash");
450+ greeter.notifyUserRequestedApp();
451
452- var animate = !LightDMService.greeter.active && !stages.shown
453- dash.setCurrentScope(0, animate, false)
454- ApplicationManager.requestFocusApplication("unity8-dash")
455+ if (shell.mode === "greeter") {
456+ SessionBroadcast.requestHomeShown(AccountsService.user);
457+ } else {
458+ var animate = !LightDMService.greeter.active && !stages.shown;
459+ dash.setCurrentScope(0, animate, false);
460+ ApplicationManager.requestFocusApplication("unity8-dash");
461+ }
462 }
463
464 function showDash() {
465@@ -599,7 +617,7 @@
466 }
467 }
468 onLauncherApplicationSelected: {
469- greeter.notifyUserRequestedApp(appId);
470+ greeter.notifyUserRequestedApp();
471 shell.activateApplication(appId);
472 }
473 onShownChanged: {
474@@ -745,7 +763,14 @@
475
476 Connections {
477 target: SessionBroadcast
478- onShowHome: showHome()
479+ onShowHome: if (shell.mode !== "greeter") showHome()
480+ }
481+
482+ URLDispatcher {
483+ id: urlDispatcher
484+ objectName: "urlDispatcher"
485+ active: shell.mode === "greeter"
486+ onUrlRequested: shell.activateURL(url)
487 }
488
489 ItemGrabber {
490
491=== modified file 'tests/mocks/AccountsService/AccountsService.cpp'
492--- tests/mocks/AccountsService/AccountsService.cpp 2016-06-20 15:24:27 +0000
493+++ tests/mocks/AccountsService/AccountsService.cpp 2016-08-11 17:58:52 +0000
494@@ -15,7 +15,9 @@
495 */
496
497 #include "AccountsService.h"
498+#include "MockUsersModel.h"
499
500+#include <QLightDM/UsersModel>
501 #include <paths.h>
502
503 AccountsService::AccountsService(QObject* parent)
504@@ -23,15 +25,17 @@
505 m_enableFingerprintIdentification(true),
506 m_enableLauncherWhileLocked(true),
507 m_enableIndicatorsWhileLocked(true),
508- m_backgroundFile(qmlDirectory() + "/graphics/phone_background.jpg"),
509+ m_backgroundFile(),
510 m_statsWelcomeScreen(true),
511 m_failedLogins(0),
512 m_failedFingerprintLogins(0),
513 m_demoEdges(false),
514 m_demoEdgesCompleted(),
515 m_hereEnabled(false),
516- m_hereLicensePath("")
517+ m_hereLicensePath(""),
518+ m_usersModel(new MockUsersModel(this))
519 {
520+ m_usersModel->setMockMode("full");
521 }
522
523 QString AccountsService::user() const
524@@ -44,6 +48,7 @@
525 m_user = user;
526 Q_EMIT userChanged();
527 Q_EMIT passwordDisplayHintChanged();
528+ Q_EMIT backgroundFileChanged();
529 }
530
531 bool AccountsService::demoEdges() const
532@@ -111,7 +116,18 @@
533
534 QString AccountsService::backgroundFile() const
535 {
536- return m_backgroundFile;
537+ if (!m_backgroundFile.isEmpty()) {
538+ return m_backgroundFile;
539+ }
540+
541+ // Check if our mock user has a background set in liblightdm
542+ for (int i = 0; i < m_usersModel->count(); i++) {
543+ if (m_usersModel->data(i, QLightDM::UsersModel::NameRole) == m_user) {
544+ return m_usersModel->data(i, QLightDM::UsersModel::BackgroundPathRole).toString();
545+ }
546+ }
547+
548+ return QString();
549 }
550
551 void AccountsService::setBackgroundFile(const QString &backgroundFile)
552
553=== modified file 'tests/mocks/AccountsService/AccountsService.h'
554--- tests/mocks/AccountsService/AccountsService.h 2016-06-20 15:24:27 +0000
555+++ tests/mocks/AccountsService/AccountsService.h 2016-08-11 17:58:52 +0000
556@@ -22,6 +22,8 @@
557 #include <QStringList>
558 #include <QVariant>
559
560+class MockUsersModel;
561+
562 class AccountsService: public QObject
563 {
564 Q_OBJECT
565@@ -163,6 +165,7 @@
566 QString m_realName;
567 QStringList m_kbdMap;
568 QString m_email;
569+ MockUsersModel *m_usersModel;
570 };
571
572 #endif
573
574=== modified file 'tests/mocks/AccountsService/CMakeLists.txt'
575--- tests/mocks/AccountsService/CMakeLists.txt 2014-07-02 16:17:14 +0000
576+++ tests/mocks/AccountsService/CMakeLists.txt 2016-08-11 17:58:52 +0000
577@@ -1,10 +1,24 @@
578+include_directories(
579+ ${CMAKE_CURRENT_BINARY_DIR}
580+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
581+ ${CMAKE_SOURCE_DIR}/plugins/Utils
582+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
583+ )
584+
585 add_library(MockAccountsService-qml MODULE
586+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
587+ ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
588+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp
589 AccountsService.cpp
590 plugin.cpp
591 )
592
593 qt5_use_modules(MockAccountsService-qml DBus Qml)
594
595+target_link_libraries(MockAccountsService-qml
596+ MockLightDM
597+ )
598+
599 add_unity8_mock(AccountsService 0.1 AccountsService
600 PREFIX mocks
601 TARGETS MockAccountsService-qml
602
603=== modified file 'tests/mocks/CMakeLists.txt'
604--- tests/mocks/CMakeLists.txt 2016-06-27 14:51:40 +0000
605+++ tests/mocks/CMakeLists.txt 2016-08-11 17:58:52 +0000
606@@ -39,6 +39,7 @@
607 add_subdirectory(MeeGo)
608 add_subdirectory(Powerd)
609 add_subdirectory(QMenuModel)
610+add_subdirectory(SessionBroadcast)
611 add_subdirectory(Ubuntu)
612 add_subdirectory(Unity)
613 add_subdirectory(QtMultimedia)
614
615=== modified file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp'
616--- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 2015-09-25 13:01:00 +0000
617+++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 2016-08-11 17:58:52 +0000
618@@ -19,6 +19,11 @@
619 #include <QLightDM/UsersModel>
620 #include <QSortFilterProxyModel>
621
622+MockUsersModel::MockUsersModel(QObject* parent)
623+ : UsersModel(parent)
624+{
625+}
626+
627 QString MockUsersModel::mockMode() const
628 {
629 QLightDM::UsersModel* qUsersModel =
630
631=== modified file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h'
632--- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 2015-09-25 13:01:00 +0000
633+++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 2016-08-11 17:58:52 +0000
634@@ -27,6 +27,8 @@
635 Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
636
637 public:
638+ explicit MockUsersModel(QObject* parent=0);
639+
640 QString mockMode() const;
641 void setMockMode(QString mockMode);
642
643
644=== modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp'
645--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-06-30 15:49:16 +0000
646+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-08-11 17:58:52 +0000
647@@ -17,6 +17,8 @@
648 #include "UsersModelPrivate.h"
649 #include "UsersModel.h"
650
651+#include <QDir>
652+
653 namespace QLightDM
654 {
655
656@@ -53,6 +55,15 @@
657 entries[i].uid = i + 1;
658 }
659
660+ // Assign backgrounds
661+ QDir backgroundDir("/usr/share/backgrounds");
662+ QStringList backgrounds = backgroundDir.entryList(QDir::Files);
663+ for (int i = 0; i < entries.size(); i++) {
664+ if (entries[i].background.isNull()) {
665+ entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]);
666+ }
667+ }
668+
669 q->endResetModel();
670 }
671
672@@ -96,7 +107,7 @@
673 { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
674 { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
675 { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
676- { "color-background", "Color Background", "#dd4814", 0, false, false, "ubuntu", 0 },
677+ { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 },
678 // white and black are a bit redundant, but useful for manually testing if UI is still readable
679 { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
680 { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
681@@ -104,6 +115,7 @@
682 { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
683 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
684 { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
685+ { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
686 };
687 }
688
689
690=== added directory 'tests/mocks/SessionBroadcast'
691=== added file 'tests/mocks/SessionBroadcast/CMakeLists.txt'
692--- tests/mocks/SessionBroadcast/CMakeLists.txt 1970-01-01 00:00:00 +0000
693+++ tests/mocks/SessionBroadcast/CMakeLists.txt 2016-08-11 17:58:52 +0000
694@@ -0,0 +1,8 @@
695+add_library(MockSessionBroadcast-qml MODULE
696+ plugin.cpp
697+ SessionBroadcast.cpp
698+ )
699+
700+qt5_use_modules(MockSessionBroadcast-qml Qml)
701+
702+add_unity8_mock(SessionBroadcast 0.1 SessionBroadcast TARGETS MockSessionBroadcast-qml)
703
704=== added file 'tests/mocks/SessionBroadcast/SessionBroadcast.cpp'
705--- tests/mocks/SessionBroadcast/SessionBroadcast.cpp 1970-01-01 00:00:00 +0000
706+++ tests/mocks/SessionBroadcast/SessionBroadcast.cpp 2016-08-11 17:58:52 +0000
707@@ -0,0 +1,34 @@
708+/*
709+ * Copyright (C) 2016 Canonical, Ltd.
710+ *
711+ * This program is free software; you can redistribute it and/or modify
712+ * it under the terms of the GNU General Public License as published by
713+ * the Free Software Foundation; version 3.
714+ *
715+ * This program is distributed in the hope that it will be useful,
716+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
717+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
718+ * GNU General Public License for more details.
719+ *
720+ * You should have received a copy of the GNU General Public License
721+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
722+ */
723+
724+#include "SessionBroadcast.h"
725+
726+SessionBroadcast::SessionBroadcast(QObject* parent)
727+ : QObject(parent)
728+{
729+}
730+
731+void SessionBroadcast::requestUrlStart(const QString &, const QString &url)
732+{
733+ // No user name guards, we won't worry about that aspect of the plugin here
734+ Q_EMIT startUrl(url);
735+}
736+
737+void SessionBroadcast::requestHomeShown(const QString &)
738+{
739+ // No user name guards, we won't worry about that aspect of the plugin here
740+ Q_EMIT showHome();
741+}
742
743=== added file 'tests/mocks/SessionBroadcast/SessionBroadcast.h'
744--- tests/mocks/SessionBroadcast/SessionBroadcast.h 1970-01-01 00:00:00 +0000
745+++ tests/mocks/SessionBroadcast/SessionBroadcast.h 2016-08-11 17:58:52 +0000
746@@ -0,0 +1,39 @@
747+/*
748+ * Copyright (C) 2012,2013 Canonical, Ltd.
749+ *
750+ * This program is free software; you can redistribute it and/or modify
751+ * it under the terms of the GNU General Public License as published by
752+ * the Free Software Foundation; version 3.
753+ *
754+ * This program is distributed in the hope that it will be useful,
755+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
756+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
757+ * GNU General Public License for more details.
758+ *
759+ * You should have received a copy of the GNU General Public License
760+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
761+ *
762+ * Authors: Michael Terry <michael.terry@canonical.com>
763+ */
764+
765+#ifndef UNITY_MOCK_SESSIONBROADCAST_H
766+#define UNITY_MOCK_SESSIONBROADCAST_H
767+
768+#include <QObject>
769+
770+class SessionBroadcast: public QObject
771+{
772+ Q_OBJECT
773+
774+public:
775+ explicit SessionBroadcast(QObject *parent = 0);
776+
777+ Q_INVOKABLE void requestUrlStart(const QString &username, const QString &url);
778+ Q_INVOKABLE void requestHomeShown(const QString &username);
779+
780+Q_SIGNALS:
781+ void startUrl(const QString &url);
782+ void showHome();
783+};
784+
785+#endif
786
787=== added file 'tests/mocks/SessionBroadcast/plugin.cpp'
788--- tests/mocks/SessionBroadcast/plugin.cpp 1970-01-01 00:00:00 +0000
789+++ tests/mocks/SessionBroadcast/plugin.cpp 2016-08-11 17:58:52 +0000
790@@ -0,0 +1,31 @@
791+/*
792+ * Copyright (C) 2016 Canonical, Ltd.
793+ *
794+ * This program is free software; you can redistribute it and/or modify
795+ * it under the terms of the GNU General Public License as published by
796+ * the Free Software Foundation; version 3.
797+ *
798+ * This program is distributed in the hope that it will be useful,
799+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
800+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
801+ * GNU General Public License for more details.
802+ *
803+ * You should have received a copy of the GNU General Public License
804+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
805+ */
806+
807+#include "plugin.h"
808+#include "SessionBroadcast.h"
809+
810+#include <QtQml/qqml.h>
811+
812+static QObject *broadcast_provider(QQmlEngine *, QJSEngine *)
813+{
814+ return new SessionBroadcast();
815+}
816+
817+void PowerdPlugin::registerTypes(const char *uri)
818+{
819+ Q_ASSERT(uri == QLatin1String("SessionBroadcast"));
820+ qmlRegisterSingletonType<SessionBroadcast>(uri, 0, 1, "SessionBroadcast", broadcast_provider);
821+}
822
823=== added file 'tests/mocks/SessionBroadcast/plugin.h'
824--- tests/mocks/SessionBroadcast/plugin.h 1970-01-01 00:00:00 +0000
825+++ tests/mocks/SessionBroadcast/plugin.h 2016-08-11 17:58:52 +0000
826@@ -0,0 +1,32 @@
827+/*
828+ * Copyright (C) 2016 Canonical, Ltd.
829+ *
830+ * This program is free software; you can redistribute it and/or modify
831+ * it under the terms of the GNU General Public License as published by
832+ * the Free Software Foundation; version 3.
833+ *
834+ * This program is distributed in the hope that it will be useful,
835+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
836+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
837+ * GNU General Public License for more details.
838+ *
839+ * You should have received a copy of the GNU General Public License
840+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
841+ */
842+
843+#ifndef MOCK_SESSIONBROADCAST_PLUGIN_H
844+#define MOCK_SESSIONBROADCAST_PLUGIN_H
845+
846+#include <QtQml/QQmlEngine>
847+#include <QtQml/QQmlExtensionPlugin>
848+
849+class PowerdPlugin : public QQmlExtensionPlugin
850+{
851+ Q_OBJECT
852+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
853+
854+public:
855+ void registerTypes(const char *uri) override;
856+};
857+
858+#endif
859
860=== added file 'tests/mocks/SessionBroadcast/qmldir'
861--- tests/mocks/SessionBroadcast/qmldir 1970-01-01 00:00:00 +0000
862+++ tests/mocks/SessionBroadcast/qmldir 2016-08-11 17:58:52 +0000
863@@ -0,0 +1,2 @@
864+module SessionBroadcast
865+plugin MockSessionBroadcast-qml
866
867=== modified file 'tests/mocks/Utils/CMakeLists.txt'
868--- tests/mocks/Utils/CMakeLists.txt 2016-06-02 09:32:33 +0000
869+++ tests/mocks/Utils/CMakeLists.txt 2016-08-11 17:58:52 +0000
870@@ -32,6 +32,7 @@
871 constants.cpp
872 plugin.cpp
873 windowstatestorage.cpp
874+ URLDispatcher.cpp
875 )
876
877 add_library(FakeUtils-qml SHARED
878
879=== added file 'tests/mocks/Utils/URLDispatcher.cpp'
880--- tests/mocks/Utils/URLDispatcher.cpp 1970-01-01 00:00:00 +0000
881+++ tests/mocks/Utils/URLDispatcher.cpp 2016-08-11 17:58:52 +0000
882@@ -0,0 +1,38 @@
883+/*
884+ * Copyright (C) 2016 Canonical, Ltd.
885+ *
886+ * This program is free software; you can redistribute it and/or modify
887+ * it under the terms of the GNU General Public License as published by
888+ * the Free Software Foundation; version 3.
889+ *
890+ * This program is distributed in the hope that it will be useful,
891+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
892+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
893+ * GNU General Public License for more details.
894+ *
895+ * You should have received a copy of the GNU General Public License
896+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
897+ */
898+
899+#include "URLDispatcher.h"
900+
901+#include <QDBusConnection>
902+
903+URLDispatcher::URLDispatcher(QObject *parent)
904+ : QObject(parent)
905+ , m_active(false)
906+{
907+}
908+
909+bool URLDispatcher::active() const
910+{
911+ return m_active;
912+}
913+
914+void URLDispatcher::setActive(bool value)
915+{
916+ if (m_active != value) {
917+ m_active = value;
918+ Q_EMIT activeChanged();
919+ }
920+}
921
922=== added file 'tests/mocks/Utils/URLDispatcher.h'
923--- tests/mocks/Utils/URLDispatcher.h 1970-01-01 00:00:00 +0000
924+++ tests/mocks/Utils/URLDispatcher.h 2016-08-11 17:58:52 +0000
925@@ -0,0 +1,47 @@
926+/*
927+ * Copyright (C) 2016 Canonical, Ltd.
928+ *
929+ * This program is free software; you can redistribute it and/or modify
930+ * it under the terms of the GNU General Public License as published by
931+ * the Free Software Foundation; version 3.
932+ *
933+ * This program is distributed in the hope that it will be useful,
934+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
935+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
936+ * GNU General Public License for more details.
937+ *
938+ * You should have received a copy of the GNU General Public License
939+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
940+ */
941+
942+#ifndef UNITY_URLDISPATCHER_H
943+#define UNITY_URLDISPATCHER_H
944+
945+#include <QObject>
946+#include <QString>
947+
948+// This class manages our url-dispatcher interception. We intercept
949+// url-dispatcher because rather than spawning the handler for the URL
950+// in our own session, we want to notify the user session to do it for us
951+// (and start an unlock in the process).
952+
953+class URLDispatcher : public QObject
954+{
955+ Q_OBJECT
956+ Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
957+
958+public:
959+ explicit URLDispatcher(QObject *parent=0);
960+
961+ bool active() const;
962+ void setActive(bool active);
963+
964+Q_SIGNALS:
965+ void urlRequested(const QString &url);
966+ void activeChanged();
967+
968+private:
969+ bool m_active;
970+};
971+
972+#endif
973
974=== modified file 'tests/mocks/Utils/plugin.cpp'
975--- tests/mocks/Utils/plugin.cpp 2016-04-29 20:07:03 +0000
976+++ tests/mocks/Utils/plugin.cpp 2016-08-11 17:58:52 +0000
977@@ -25,6 +25,7 @@
978 #include "plugin.h"
979 #include "windowstatestorage.h"
980 #include "constants.h"
981+#include "URLDispatcher.h"
982
983 // plugin
984 #include <activefocuslogger.h>
985@@ -80,4 +81,5 @@
986 qmlRegisterType<InputEventGenerator>(uri, 0, 1, "InputEventGenerator");
987 qmlRegisterType<DeviceConfigParser>(uri, 0, 1, "DeviceConfigParser");
988 qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions);
989+ qmlRegisterType<URLDispatcher>(uri, 0, 1, "URLDispatcher");
990 }
991
992=== modified file 'tests/plugins/CMakeLists.txt'
993--- tests/plugins/CMakeLists.txt 2016-06-07 16:10:36 +0000
994+++ tests/plugins/CMakeLists.txt 2016-08-11 17:58:52 +0000
995@@ -4,6 +4,7 @@
996 add_subdirectory(GlobalShortcut)
997 add_subdirectory(Greeter)
998 add_subdirectory(LightDM)
999+add_subdirectory(SessionBroadcast)
1000 add_subdirectory(Ubuntu)
1001 add_subdirectory(Unity)
1002 add_subdirectory(Utils)
1003
1004=== modified file 'tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp'
1005--- tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp 2015-09-28 18:00:44 +0000
1006+++ tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp 2016-08-11 17:58:52 +0000
1007@@ -59,10 +59,10 @@
1008 void testMangleColor()
1009 {
1010 QString background = getStringValue(sourceModel, "color-background", QLightDM::UsersModel::BackgroundPathRole);
1011- QVERIFY(background == "#dd4814");
1012+ QVERIFY(background == "#E95420");
1013
1014 background = getStringValue(model, "color-background", QLightDM::UsersModel::BackgroundPathRole);
1015- QVERIFY(background == "data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#dd4814'/></svg>");
1016+ QVERIFY(background == "data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#E95420'/></svg>");
1017 }
1018
1019 void testMangleEmptyName()
1020
1021=== added directory 'tests/plugins/SessionBroadcast'
1022=== added file 'tests/plugins/SessionBroadcast/BroadcastServer.cpp'
1023--- tests/plugins/SessionBroadcast/BroadcastServer.cpp 1970-01-01 00:00:00 +0000
1024+++ tests/plugins/SessionBroadcast/BroadcastServer.cpp 2016-08-11 17:58:52 +0000
1025@@ -0,0 +1,33 @@
1026+/*
1027+ * Copyright 2016 Canonical Ltd.
1028+ *
1029+ * This program is free software: you can redistribute it and/or modify it
1030+ * under the terms of the GNU General Public License version 3, as published
1031+ * by the Free Software Foundation.
1032+ *
1033+ * This program is distributed in the hope that it will be useful, but
1034+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1035+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1036+ * PURPOSE. See the GNU General Public License for more details.
1037+ *
1038+ * You should have received a copy of the GNU General Public License
1039+ * version 3 along with this program. If not, see
1040+ * <http://www.gnu.org/licenses/>
1041+ */
1042+
1043+#include "BroadcastServer.h"
1044+
1045+BroadcastServer::BroadcastServer(QObject *parent)
1046+ : QObject(parent)
1047+{
1048+}
1049+
1050+void BroadcastServer::RequestUrlStart(const QString &username, const QString &url)
1051+{
1052+ Q_EMIT StartUrl(username, url);
1053+}
1054+
1055+void BroadcastServer::RequestHomeShown(const QString &username)
1056+{
1057+ Q_EMIT ShowHome(username);
1058+}
1059
1060=== added file 'tests/plugins/SessionBroadcast/BroadcastServer.h'
1061--- tests/plugins/SessionBroadcast/BroadcastServer.h 1970-01-01 00:00:00 +0000
1062+++ tests/plugins/SessionBroadcast/BroadcastServer.h 2016-08-11 17:58:52 +0000
1063@@ -0,0 +1,40 @@
1064+/*
1065+ * Copyright 2016 Canonical Ltd.
1066+ *
1067+ * This program is free software: you can redistribute it and/or modify it
1068+ * under the terms of the GNU General Public License version 3, as published
1069+ * by the Free Software Foundation.
1070+ *
1071+ * This program is distributed in the hope that it will be useful, but
1072+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1073+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1074+ * PURPOSE. See the GNU General Public License for more details.
1075+ *
1076+ * You should have received a copy of the GNU General Public License
1077+ * version 3 along with this program. If not, see
1078+ * <http://www.gnu.org/licenses/>
1079+ */
1080+
1081+#ifndef UNITY_BROADCASTSERVER_H
1082+#define UNITY_BROADCASTSERVER_H
1083+
1084+#include <QDBusContext>
1085+#include <QObject>
1086+
1087+class BroadcastServer: public QObject, protected QDBusContext
1088+{
1089+ Q_OBJECT
1090+
1091+public:
1092+ explicit BroadcastServer(QObject *parent = nullptr);
1093+
1094+public Q_SLOTS:
1095+ void RequestUrlStart(const QString &username, const QString &url);
1096+ void RequestHomeShown(const QString &username);
1097+
1098+Q_SIGNALS:
1099+ void StartUrl(const QString &username, const QString &url);
1100+ void ShowHome(const QString &username);
1101+};
1102+
1103+#endif
1104
1105=== added file 'tests/plugins/SessionBroadcast/CMakeLists.txt'
1106--- tests/plugins/SessionBroadcast/CMakeLists.txt 1970-01-01 00:00:00 +0000
1107+++ tests/plugins/SessionBroadcast/CMakeLists.txt 2016-08-11 17:58:52 +0000
1108@@ -0,0 +1,45 @@
1109+macro(make_dbus_class NAME INTERFACE)
1110+ if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
1111+ execute_process(COMMAND ${QDBUSXML2CPP_EXECUTABLE} -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
1112+ endif()
1113+endmacro(make_dbus_class)
1114+
1115+make_dbus_class(Broadcast com.canonical.Unity.Greeter.Broadcast)
1116+
1117+add_definitions(-DSM_BUSNAME=sessionBus)
1118+
1119+include_directories(
1120+ ${GLIB_INCLUDE_DIRS}
1121+ ${CMAKE_CURRENT_BINARY_DIR}
1122+ ${CMAKE_CURRENT_SOURCE_DIR}
1123+ ${CMAKE_SOURCE_DIR}/plugins/SessionBroadcast
1124+)
1125+
1126+link_libraries(
1127+ ${GLIB_LIBRARIES}
1128+)
1129+
1130+add_executable(MockBroadcastServer
1131+ ${CMAKE_CURRENT_BINARY_DIR}/BroadcastAdaptor.cpp
1132+ server.cpp
1133+ BroadcastServer.cpp
1134+)
1135+qt5_use_modules(MockBroadcastServer Core DBus)
1136+
1137+### SessionBroadcastTest
1138+add_executable(sessionbroadcasttestExec
1139+ ${CMAKE_SOURCE_DIR}/plugins/SessionBroadcast/SessionBroadcast.cpp
1140+ sessionbroadcasttest.cpp
1141+)
1142+qt5_use_modules(sessionbroadcasttestExec Test Core Qml DBus)
1143+
1144+add_unity8_unittest(SessionBroadcast dbus-test-runner
1145+ ARG_PREFIX "--parameter"
1146+ ARGS
1147+ --task $<TARGET_FILE:MockBroadcastServer>
1148+ --task-name server
1149+ --ignore-return
1150+ --task $<TARGET_FILE:sessionbroadcasttestExec>
1151+ --task-name client
1152+ --wait-for com.canonical.Unity.Greeter.Broadcast
1153+)
1154
1155=== added file 'tests/plugins/SessionBroadcast/interfaces.xml'
1156--- tests/plugins/SessionBroadcast/interfaces.xml 1970-01-01 00:00:00 +0000
1157+++ tests/plugins/SessionBroadcast/interfaces.xml 2016-08-11 17:58:52 +0000
1158@@ -0,0 +1,18 @@
1159+<node>
1160+ <interface name="com.canonical.Unity.Greeter.Broadcast">
1161+ <method name="RequestUrlStart">
1162+ <arg name="username" type="s" direction="in" />
1163+ <arg name="url" type="s" direction="in" />
1164+ </method>
1165+ <method name="RequestHomeShown">
1166+ <arg name="username" type="s" direction="in" />
1167+ </method>
1168+ <signal name="StartUrl">
1169+ <arg name="username" type="s" direction="out" />
1170+ <arg name="url" type="s" direction="out" />
1171+ </signal>
1172+ <signal name="ShowHome">
1173+ <arg name="username" type="s" direction="out" />
1174+ </signal>
1175+ </interface>
1176+</node>
1177
1178=== added file 'tests/plugins/SessionBroadcast/server.cpp'
1179--- tests/plugins/SessionBroadcast/server.cpp 1970-01-01 00:00:00 +0000
1180+++ tests/plugins/SessionBroadcast/server.cpp 2016-08-11 17:58:52 +0000
1181@@ -0,0 +1,37 @@
1182+/*
1183+ * Copyright 2016 Canonical Ltd.
1184+ *
1185+ * This program is free software: you can redistribute it and/or modify it
1186+ * under the terms of the GNU General Public License version 3, as published
1187+ * by the Free Software Foundation.
1188+ *
1189+ * This program is distributed in the hope that it will be useful, but
1190+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1191+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1192+ * PURPOSE. See the GNU General Public License for more details.
1193+ *
1194+ * You should have received a copy of the GNU General Public License
1195+ * version 3 along with this program. If not, see
1196+ * <http://www.gnu.org/licenses/>
1197+ */
1198+
1199+#include "BroadcastAdaptor.h"
1200+#include "BroadcastServer.h"
1201+#include <QCoreApplication>
1202+
1203+int main(int argc, char *argv[])
1204+{
1205+ QCoreApplication a(argc, argv);
1206+
1207+ auto broadcast = new BroadcastServer(&a);
1208+ new BroadcastAdaptor(broadcast);
1209+
1210+ // We use the session bus for testing. The real plugin uses the system bus
1211+ auto connection = QDBusConnection::sessionBus();
1212+ if (!connection.registerObject("/com/canonical/Unity/Greeter/Broadcast", broadcast))
1213+ return 1;
1214+ if (!connection.registerService("com.canonical.Unity.Greeter.Broadcast"))
1215+ return 1;
1216+
1217+ return a.exec();
1218+}
1219
1220=== added file 'tests/plugins/SessionBroadcast/sessionbroadcasttest.cpp'
1221--- tests/plugins/SessionBroadcast/sessionbroadcasttest.cpp 1970-01-01 00:00:00 +0000
1222+++ tests/plugins/SessionBroadcast/sessionbroadcasttest.cpp 2016-08-11 17:58:52 +0000
1223@@ -0,0 +1,111 @@
1224+/*
1225+ * Copyright 2016 Canonical Ltd.
1226+ *
1227+ * This program is free software; you can redistribute it and/or modify
1228+ * it under the terms of the GNU Lesser General Public License as published by
1229+ * the Free Software Foundation; version 3.
1230+ *
1231+ * This program is distributed in the hope that it will be useful,
1232+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1233+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1234+ * GNU Lesser General Public License for more details.
1235+ *
1236+ * You should have received a copy of the GNU Lesser General Public License
1237+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1238+ */
1239+
1240+#include <QtTest>
1241+#include <QDBusInterface>
1242+#include <QSignalSpy>
1243+
1244+#include <glib.h>
1245+
1246+#include "SessionBroadcast.h"
1247+
1248+class SessionBroadcastTest : public QObject
1249+{
1250+ Q_OBJECT
1251+
1252+private Q_SLOTS:
1253+
1254+ void initTestCase() {
1255+ broadcastServer = new QDBusInterface("com.canonical.Unity.Greeter.Broadcast",
1256+ "/com/canonical/Unity/Greeter/Broadcast",
1257+ "com.canonical.Unity.Greeter.Broadcast",
1258+ QDBusConnection::sessionBus(), this);
1259+ serverStartUrlSpy = new QSignalSpy(broadcastServer,
1260+ SIGNAL(StartUrl(const QString &, const QString &)));
1261+ serverShowHomeSpy = new QSignalSpy(broadcastServer,
1262+ SIGNAL(ShowHome(const QString &)));
1263+ user = QString(g_get_user_name());
1264+ otherUser = user + "2";
1265+ }
1266+
1267+ void init()
1268+ {
1269+ serverStartUrlSpy->clear();
1270+ serverShowHomeSpy->clear();
1271+
1272+ broadcastPlugin = new SessionBroadcast(this);
1273+ pluginStartUrlSpy = new QSignalSpy(broadcastPlugin,
1274+ SIGNAL(startUrl(const QString &)));
1275+ pluginShowHomeSpy = new QSignalSpy(broadcastPlugin,
1276+ SIGNAL(showHome()));
1277+ }
1278+
1279+ void cleanup()
1280+ {
1281+ delete broadcastPlugin;
1282+ }
1283+
1284+ void testReceiveUrlStart() {
1285+ broadcastServer->call("RequestUrlStart", user, "test:");
1286+ QTRY_COMPARE(serverStartUrlSpy->count(), 1);
1287+ QCOMPARE(pluginStartUrlSpy->count(), 1);
1288+ QCOMPARE((*pluginStartUrlSpy)[0][0], QVariant("test:"));
1289+ }
1290+
1291+ void testReceiveUrlStartOtherUser() {
1292+ broadcastServer->call("RequestUrlStart", otherUser, "test:");
1293+ QTRY_COMPARE(serverStartUrlSpy->count(), 1);
1294+ QCOMPARE(pluginStartUrlSpy->count(), 0);
1295+ }
1296+
1297+ void testReceiveShowHome() {
1298+ broadcastServer->call("RequestHomeShown", user);
1299+ QTRY_COMPARE(serverShowHomeSpy->count(), 1);
1300+ QCOMPARE(pluginShowHomeSpy->count(), 1);
1301+ }
1302+
1303+ void testReceiveShowHomeOtherUser() {
1304+ broadcastServer->call("RequestHomeShown", otherUser);
1305+ QTRY_COMPARE(serverShowHomeSpy->count(), 1);
1306+ QCOMPARE(pluginShowHomeSpy->count(), 0);
1307+ }
1308+
1309+ void testSendUrlStart() {
1310+ broadcastPlugin->requestUrlStart(otherUser, "test:");
1311+ QTRY_COMPARE(serverStartUrlSpy->count(), 1);
1312+ QCOMPARE((*serverStartUrlSpy)[0][0], QVariant(otherUser));
1313+ QCOMPARE((*serverStartUrlSpy)[0][1], QVariant("test:"));
1314+ }
1315+
1316+ void testSendShowHome() {
1317+ broadcastPlugin->requestHomeShown(otherUser);
1318+ QTRY_COMPARE(serverShowHomeSpy->count(), 1);
1319+ QCOMPARE((*serverShowHomeSpy)[0][0], QVariant(otherUser));
1320+ }
1321+
1322+private:
1323+ QDBusInterface *broadcastServer;
1324+ SessionBroadcast *broadcastPlugin;
1325+ QSignalSpy *serverStartUrlSpy;
1326+ QSignalSpy *serverShowHomeSpy;
1327+ QSignalSpy *pluginStartUrlSpy;
1328+ QSignalSpy *pluginShowHomeSpy;
1329+ QString user;
1330+ QString otherUser;
1331+};
1332+
1333+QTEST_GUILESS_MAIN(SessionBroadcastTest)
1334+#include "sessionbroadcasttest.moc"
1335
1336=== modified file 'tests/plugins/Utils/CMakeLists.txt'
1337--- tests/plugins/Utils/CMakeLists.txt 2016-02-18 16:53:54 +0000
1338+++ tests/plugins/Utils/CMakeLists.txt 2016-08-11 17:58:52 +0000
1339@@ -23,3 +23,12 @@
1340
1341 # plain qml test
1342 add_unity8_qmlunittest(. UtilsStyle)
1343+
1344+# URLDispatcher test needs dbus-test-runner because it claims a dbus name
1345+add_executable(URLDispatcherTestExec URLDispatcherTest.cpp)
1346+qt5_use_modules(URLDispatcherTestExec Test Core Qml)
1347+target_link_libraries(URLDispatcherTestExec Utils-qml)
1348+add_unity8_unittest(URLDispatcher dbus-test-runner
1349+ ARG_PREFIX "--parameter"
1350+ ARGS --task $<TARGET_FILE:URLDispatcherTestExec>
1351+)
1352
1353=== added file 'tests/plugins/Utils/URLDispatcherTest.cpp'
1354--- tests/plugins/Utils/URLDispatcherTest.cpp 1970-01-01 00:00:00 +0000
1355+++ tests/plugins/Utils/URLDispatcherTest.cpp 2016-08-11 17:58:52 +0000
1356@@ -0,0 +1,78 @@
1357+/*
1358+ * Copyright (C) 2016 Canonical, Ltd.
1359+ *
1360+ * This program is free software; you can redistribute it and/or modify
1361+ * it under the terms of the GNU General Public License as published by
1362+ * the Free Software Foundation; version 3.
1363+ *
1364+ * This program is distributed in the hope that it will be useful,
1365+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1366+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1367+ * GNU General Public License for more details.
1368+ *
1369+ * You should have received a copy of the GNU General Public License
1370+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1371+ */
1372+
1373+#include "URLDispatcher.h"
1374+
1375+#include <QDBusInterface>
1376+#include <QSignalSpy>
1377+#include <QTest>
1378+
1379+class URLDispatcherTest : public QObject
1380+{
1381+ Q_OBJECT
1382+
1383+private Q_SLOTS:
1384+
1385+ void initTestCase() {
1386+ dispatchServer = new QDBusInterface("com.canonical.URLDispatcher",
1387+ "/com/canonical/URLDispatcher",
1388+ "com.canonical.URLDispatcher",
1389+ QDBusConnection::sessionBus(), this);
1390+ }
1391+
1392+ void init()
1393+ {
1394+ dispatcher = new URLDispatcher(this);
1395+ dispatchSpy = new QSignalSpy(dispatcher,
1396+ SIGNAL(urlRequested(const QString &)));
1397+ }
1398+
1399+ void cleanup()
1400+ {
1401+ delete dispatcher;
1402+ }
1403+
1404+ void testInactiveByDefault() {
1405+ QVERIFY(!dispatcher->active());
1406+ }
1407+
1408+ void testActiveRequest() {
1409+ dispatcher->setActive(true);
1410+ dispatchServer->call("DispatchURL", "test:", "package");
1411+ QCOMPARE(dispatchSpy->count(), 1);
1412+ QCOMPARE((*dispatchSpy)[0][0], QVariant("test:"));
1413+ }
1414+
1415+ void testInactiveRequest() {
1416+ dispatchServer->call("DispatchURL", "test:", "package");
1417+ QCOMPARE(dispatchSpy->count(), 0);
1418+ }
1419+
1420+ void testInactiveAfterActiveRequest() {
1421+ dispatcher->setActive(true);
1422+ dispatcher->setActive(false);
1423+ dispatchServer->call("DispatchURL", "test:", "package");
1424+ QCOMPARE(dispatchSpy->count(), 0);
1425+ }
1426+
1427+private:
1428+ QDBusInterface *dispatchServer;
1429+ URLDispatcher *dispatcher;
1430+ QSignalSpy *dispatchSpy;
1431+};
1432+
1433+QTEST_GUILESS_MAIN(URLDispatcherTest)
1434+#include "URLDispatcherTest.moc"
1435
1436=== modified file 'tests/qmltests/tst_Shell.qml'
1437--- tests/qmltests/tst_Shell.qml 2016-08-03 15:53:36 +0000
1438+++ tests/qmltests/tst_Shell.qml 2016-08-11 17:58:52 +0000
1439@@ -19,6 +19,7 @@
1440 import AccountsService 0.1
1441 import GSettings 1.0
1442 import LightDM.IntegratedLightDM 0.1 as LightDM
1443+import SessionBroadcast 0.1
1444 import Ubuntu.Components 1.3
1445 import Ubuntu.Components.ListItems 1.3 as ListItem
1446 import Ubuntu.Telephony 0.1 as Telephony
1447@@ -406,6 +407,18 @@
1448 }
1449
1450 SignalSpy {
1451+ id: broadcastUrlSpy
1452+ target: SessionBroadcast
1453+ signalName: "startUrl"
1454+ }
1455+
1456+ SignalSpy {
1457+ id: broadcastHomeSpy
1458+ target: SessionBroadcast
1459+ signalName: "showHome"
1460+ }
1461+
1462+ SignalSpy {
1463 id: unlockAllModemsSpy
1464 target: Connectivity
1465 signalName: "unlockingAllModems"
1466@@ -546,6 +559,8 @@
1467 LightDM.Greeter.authenticate(""); // reset greeter
1468
1469 sessionSpy.clear();
1470+ broadcastUrlSpy.clear();
1471+ broadcastHomeSpy.clear();
1472
1473 GSettingsController.setLifecycleExemptAppids([]);
1474
1475@@ -2410,6 +2425,66 @@
1476 compare(topmostSurfaceItem.touchReleaseCount, 2);
1477 }
1478
1479+ function test_greeterModeBroadcastsApp() {
1480+ setLightDMMockMode("single-pin");
1481+ shellLoader.mode = "greeter";
1482+ loadShell("phone");
1483+ shell.usageScenario = "phone";
1484+ waitForRendering(shell);
1485+
1486+ dragLauncherIntoView();
1487+ var appIcon = findChild(shell, "launcherDelegate0")
1488+ tap(appIcon);
1489+
1490+ tryCompare(broadcastUrlSpy, "count", 1);
1491+ compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
1492+ compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
1493+
1494+ var coverPage = findChild(shell, "coverPage");
1495+ tryCompare(coverPage, "showProgress", 0);
1496+ }
1497+
1498+ function test_greeterModeBroadcastsHome() {
1499+ setLightDMMockMode("single-pin");
1500+ shellLoader.mode = "greeter";
1501+ loadShell("phone");
1502+ shell.usageScenario = "phone";
1503+ waitForRendering(shell);
1504+
1505+ var gallerySurfaceId = topLevelSurfaceList.nextId;
1506+ var galleryApp = ApplicationManager.startApplication("gallery-app");
1507+ waitUntilAppWindowIsFullyLoaded(gallerySurfaceId);
1508+ compare(ApplicationManager.focusedApplicationId, "gallery-app");
1509+
1510+ dragLauncherIntoView();
1511+ tap(findChild(shell, "buttonShowDashHome"));
1512+
1513+ tryCompare(broadcastHomeSpy, "count", 1);
1514+ compare(ApplicationManager.focusedApplicationId, "gallery-app"); // confirm we didn't focus dash
1515+
1516+ var coverPage = findChild(shell, "coverPage");
1517+ tryCompare(coverPage, "showProgress", 0);
1518+ }
1519+
1520+ function test_greeterModeDispatchesURL() {
1521+ setLightDMMockMode("single-pin");
1522+ shellLoader.mode = "greeter";
1523+ loadShell("phone");
1524+ shell.usageScenario = "phone";
1525+ waitForRendering(shell);
1526+
1527+ var urlDispatcher = findInvisibleChild(shell, "urlDispatcher");
1528+ verify(urlDispatcher.active);
1529+ urlDispatcher.urlRequested("test:"); // force signal emission
1530+
1531+ tryCompare(broadcastUrlSpy, "count", 1);
1532+ compare(broadcastUrlSpy.signalArguments[0][0], "test:");
1533+ compare(ApplicationManager.count, 1); // confirm only dash is open, we didn't start new app
1534+
1535+ var coverPage = findChild(shell, "coverPage");
1536+ tryCompare(coverPage, "showProgress", 0);
1537+ }
1538+
1539 function test_switchKeymap() {
1540 // start with phone shell
1541 loadShell("phone");

Subscribers

People subscribed via source and target branches