Merge lp:~jonas-drange/ubuntu-system-settings/hotspots-new-design into lp:~jonas-drange/ubuntu-system-settings/hotspots

Proposed by Jonas G. Drange
Status: Superseded
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/hotspots-new-design
Merge into: lp:~jonas-drange/ubuntu-system-settings/hotspots
Diff against target: 1638 lines (+746/-326)
21 files modified
debian/changelog (+8/-0)
debian/control (+1/-1)
plugins/CMakeLists.txt (+1/-0)
plugins/cellular/CMakeLists.txt (+0/-3)
plugins/cellular/Components/MultiSim.qml (+0/-19)
plugins/cellular/Components/SingleSim.qml (+0/-24)
plugins/cellular/cellular.settings (+1/-3)
plugins/hotspot/CMakeLists.txt (+12/-0)
plugins/hotspot/HotspotSetup.qml (+31/-7)
plugins/hotspot/PageComponent.qml (+146/-79)
plugins/hotspot/hotspot.settings (+18/-0)
plugins/hotspot/qmldir (+2/-0)
plugins/hotspot/settings-hotspot.svg (+182/-0)
tests/autopilot/ubuntu_system_settings/__init__.py (+46/-48)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+3/-1)
tests/autopilot/ubuntu_system_settings/tests/connectivity.py (+15/-2)
tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py (+14/-4)
tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+1/-105)
tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py (+228/-0)
tests/autopilot/ubuntu_system_settings/tests/test_phone.py (+30/-30)
tests/autopilot/ubuntu_system_settings/tests/test_plugins.py (+7/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/hotspots-new-design
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Jonas G. Drange Pending
Review via email: mp+267256@code.launchpad.net

This proposal has been superseded by a proposal from 2015-08-14.

Commit message

debs

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1499. By Jonas G. Drange

change icon, attempt switch majigger

1500. By Jonas G. Drange

bzr merge ../fix-pep8/

1501. By Jonas G. Drange

sync with dep

1502. By Jonas G. Drange

fix dep merge properly

1503. By Jonas G. Drange

use connectivity for wifi on/off sniff

1504. By Jonas G. Drange

rename wifieneabled

1505. By Jonas G. Drange

implement enabling wifi on setup, as well as happy path test for it

1506. By Jonas G. Drange

make tests quicker, and fix bug where you couldn't close the enable-wifi diag

1507. By Jonas G. Drange

sync with trunk

1508. By Jonas G. Drange

fix bad merge with trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1509. By Jonas G. Drange

fix json error in cellular.settings

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1510. By Jonas G. Drange

add hotspot test plugin

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1511. By Jonas G. Drange

use new connectivity props to enable/disable user actions and add new tests + refactor existing.

1512. By Jonas G. Drange

it is not necessary to disable the back button anymore, so remove that piece

1513. By Jonas G. Drange

prune mp

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1514. By Jonas G. Drange

use lower case prop names for consistency and cut the USC prop sync

1515. By Jonas G. Drange

we don't need to toggle the hotspot switch directly after enabling wifi. Also, we need to listen for change events directly for the switch to work properly.

1516. By Jonas G. Drange

we need a newer suru icon theme for the hotspot icon

1517. By Jonas G. Drange

improve the logic here

1518. By Jonas G. Drange

use new lower case names

1519. By Jonas G. Drange

revert phone changes, and use flightMode flag

1520. By Jonas G. Drange

revert indicatornetwork stuff we don't use

1521. By Jonas G. Drange

no 1.3 imports

1522. By Jonas G. Drange

unpollute diff

1523. By Jonas G. Drange

bump package dep

Unmerged revisions

1523. By Jonas G. Drange

bump package dep

1522. By Jonas G. Drange

unpollute diff

1521. By Jonas G. Drange

no 1.3 imports

1520. By Jonas G. Drange

revert indicatornetwork stuff we don't use

1519. By Jonas G. Drange

revert phone changes, and use flightMode flag

1518. By Jonas G. Drange

use new lower case names

1517. By Jonas G. Drange

improve the logic here

1516. By Jonas G. Drange

we need a newer suru icon theme for the hotspot icon

1515. By Jonas G. Drange

we don't need to toggle the hotspot switch directly after enabling wifi. Also, we need to listen for change events directly for the switch to work properly.

1514. By Jonas G. Drange

use lower case prop names for consistency and cut the USC prop sync

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-08-10 13:20:25 +0000
3+++ debian/changelog 2015-08-14 11:52:44 +0000
4@@ -1,3 +1,11 @@
5+ubuntu-system-settings (0.3+15.10.20150812-0ubuntu1) wily; urgency=medium
6+
7+ [ jonas-drange ]
8+ * [cellular] add hotspot support by use of the Connectivity API (LP:
9+ #1477300, #1421583)
10+
11+ -- CI Train Bot <ci-train-bot@canonical.com> Wed, 12 Aug 2015 12:20:19 +0000
12+
13 ubuntu-system-settings (0.3+15.10.20150810-0ubuntu1) wily; urgency=medium
14
15 [ Ken VanDine ]
16
17=== modified file 'debian/control'
18--- debian/control 2015-07-16 09:22:42 +0000
19+++ debian/control 2015-08-14 11:52:44 +0000
20@@ -23,7 +23,7 @@
21 libunity-api-dev,
22 libupower-glib-dev,
23 pkg-config,
24- qml-module-ubuntu-connectivity (>= 0.5.2),
25+ qml-module-ubuntu-connectivity (>= 0.5.3),
26 qt5-default,
27 qtbase5-dev,
28 qtdeclarative5-dev,
29
30=== modified file 'plugins/CMakeLists.txt'
31--- plugins/CMakeLists.txt 2014-07-09 01:05:29 +0000
32+++ plugins/CMakeLists.txt 2015-08-14 11:52:44 +0000
33@@ -9,6 +9,7 @@
34 add_subdirectory(cellular)
35 add_subdirectory(example)
36 add_subdirectory(flight-mode)
37+add_subdirectory(hotspot)
38 add_subdirectory(language)
39 add_subdirectory(notifications)
40 add_subdirectory(orientation-lock)
41
42=== modified file 'plugins/cellular/CMakeLists.txt'
43--- plugins/cellular/CMakeLists.txt 2015-08-06 10:33:16 +0000
44+++ plugins/cellular/CMakeLists.txt 2015-08-14 11:52:44 +0000
45@@ -7,15 +7,12 @@
46 apn_manager.js
47 apn_editor.js
48 carriers.js
49- Common.qml
50 PageApnEditor.qml
51 PageChooseApn.qml
52 PageChooseCarrier.qml
53 PageCarrierAndApn.qml
54 PageCarriersAndApns.qml
55 PageComponent.qml
56- Hotspot.qml
57- HotspotSetup.qml
58 sims.js
59 )
60
61
62=== modified file 'plugins/cellular/Components/MultiSim.qml'
63--- plugins/cellular/Components/MultiSim.qml 2015-07-24 20:00:06 +0000
64+++ plugins/cellular/Components/MultiSim.qml 2015-08-14 11:52:44 +0000
65@@ -53,25 +53,6 @@
66 anchors { left: parent.left; right: parent.right }
67 }
68
69- ListItem.SingleValue {
70- text : i18n.tr("Hotspot disabled because Wi-Fi is off.")
71- visible: !hotspotItem.visible &&
72- UpdateManager.deviceName !== "mako"
73- }
74-
75- ListItem.SingleValue {
76- id: hotspotItem
77- text: i18n.tr("Wi-Fi hotspot")
78- progression: true
79- onClicked: {
80- pageStack.push(Qt.resolvedUrl("../Hotspot.qml"))
81- }
82- visible: (actionGroup.actionObject.valid ?
83- actionGroup.actionObject.state : false) &&
84- UpdateManager.deviceName !== "mako"
85-
86- }
87-
88 ListItem.Standard {
89 id: dataUsage
90 text: i18n.tr("Data usage statistics")
91
92=== modified file 'plugins/cellular/Components/SingleSim.qml'
93--- plugins/cellular/Components/SingleSim.qml 2015-07-24 20:00:06 +0000
94+++ plugins/cellular/Components/SingleSim.qml 2015-08-14 11:52:44 +0000
95@@ -22,11 +22,6 @@
96 import Ubuntu.Components 0.1
97 import Ubuntu.Components.ListItems 0.1 as ListItem
98
99-/* This is a temporary solution to the issue of Hotspots failing on mako. If
100-the device is mako, we hide the hotspot entry. Will be removed once lp:1434591
101-has been resolved. */
102-import Ubuntu.SystemSettings.Update 1.0
103-
104 Column {
105
106 objectName: "singleSim"
107@@ -64,25 +59,6 @@
108 }
109 }
110
111- ListItem.SingleValue {
112- text : i18n.tr("Hotspot disabled because Wi-Fi is off.")
113- visible: !hotspotItem.visible &&
114- UpdateManager.deviceName !== "mako"
115- }
116-
117- ListItem.SingleValue {
118- id: hotspotItem
119- objectName: "hotspotEntry"
120- text: i18n.tr("Wi-Fi hotspot")
121- progression: true
122- onClicked: {
123- pageStack.push(Qt.resolvedUrl("../Hotspot.qml"))
124- }
125- visible: (actionGroup.actionObject.valid ?
126- actionGroup.actionObject.state : false) &&
127- UpdateManager.deviceName !== "mako"
128- }
129-
130 ListItem.Standard {
131 text: i18n.tr("Data usage statistics")
132 progression: true
133
134=== modified file 'plugins/cellular/cellular.settings'
135--- plugins/cellular/cellular.settings 2015-08-10 09:27:01 +0000
136+++ plugins/cellular/cellular.settings 2015-08-14 11:52:44 +0000
137@@ -20,9 +20,7 @@
138 "lte",
139 "apn",
140 "roam",
141- "sim",
142- "hotspot",
143- "tethering"
144+ "sim"
145 ],
146 "has-dynamic-keywords": false,
147 "has-dynamic-visibility": false,
148
149=== added directory 'plugins/hotspot'
150=== added file 'plugins/hotspot/CMakeLists.txt'
151--- plugins/hotspot/CMakeLists.txt 1970-01-01 00:00:00 +0000
152+++ plugins/hotspot/CMakeLists.txt 2015-08-14 11:52:44 +0000
153@@ -0,0 +1,12 @@
154+set(QML_SOURCES
155+ Common.qml
156+ HotspotSetup.qml
157+ PageComponent.qml
158+)
159+
160+set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Hotspot)
161+
162+install(FILES qmldir DESTINATION ${PLUG_DIR})
163+install(FILES hotspot.settings DESTINATION ${PLUGIN_MANIFEST_DIR})
164+install(FILES settings-hotspot.svg DESTINATION ${PLUGIN_MANIFEST_DIR}/icons)
165+install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/hotspot)
166
167=== renamed file 'plugins/cellular/Common.qml' => 'plugins/hotspot/Common.qml'
168=== renamed file 'plugins/cellular/HotspotSetup.qml' => 'plugins/hotspot/HotspotSetup.qml'
169--- plugins/cellular/HotspotSetup.qml 2015-08-10 20:04:29 +0000
170+++ plugins/hotspot/HotspotSetup.qml 2015-08-14 11:52:44 +0000
171@@ -208,6 +208,17 @@
172 }
173 }
174
175+ ListItem.Caption {
176+ anchors {
177+ left: parent.left
178+ right: parent.right
179+ leftMargin: units.gu(1)
180+ rightMargin: units.gu(1)
181+ }
182+ text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.")
183+ visible: !Connectivity.WifiEnabled
184+ }
185+
186 Row {
187
188 anchors {
189@@ -230,11 +241,14 @@
190 objectName: "confirmButton"
191 width: (parent.width / 2) - units.gu(1)
192 text: hotspotSetupDialog.stored ? i18n.tr("Change") :
193- i18n.tr("Enable")
194+ i18n.tr("Start")
195 enabled: settingsValid()
196 activeFocusOnPress: false
197 onClicked: {
198- if (hotspotSetupDialog.stored) {
199+ if (!Connectivity.WifiEnabled &&
200+ !hotspotSetupDialog.stored) {
201+ enableWifiAction.trigger();
202+ } else if (hotspotSetupDialog.stored) {
203 changeAction.trigger()
204 } else {
205 enableAction.trigger();
206@@ -259,12 +273,22 @@
207 height: parent.height - units.gu(1.5)
208 }
209 }
210-
211- Button {
212- visible: showAllUI
213- // TRANSLATORS: This string is hidden.
214- text: i18n.tr("Start")
215+ }
216+ }
217+
218+ Action {
219+ id: enableWifiAction
220+ onTriggered: {
221+ hotspotSetupDialog.state = "STARTING";
222+
223+ // As soon as Wi-Fi has been turned on, trigger enableAction.
224+ function wifiUpdated (updated) {
225+ Connectivity.wifiEnabledUpdated.disconnect(wifiUpdated);
226+ enableAction.trigger();
227 }
228+
229+ Connectivity.wifiEnabledUpdated.connect(wifiUpdated);
230+ Connectivity.setwifiEnabled(true);
231 }
232 }
233
234
235=== renamed file 'plugins/cellular/Hotspot.qml' => 'plugins/hotspot/PageComponent.qml'
236--- plugins/cellular/Hotspot.qml 2015-08-10 20:04:29 +0000
237+++ plugins/hotspot/PageComponent.qml 2015-08-14 11:52:44 +0000
238@@ -1,7 +1,9 @@
239 /*
240 * This file is part of system-settings
241 *
242- * Copyright (C) 2014 Canonical Ltd.
243+ * Copyright (C) 2015 Canonical Ltd.
244+ *
245+ * Contact: Jonas G. Drange <jonas.drange@canonical.com>
246 *
247 * This program is free software: you can redistribute it and/or modify it
248 * under the terms of the GNU General Public License version 3, as published
249@@ -17,99 +19,167 @@
250 */
251
252 import QtQuick 2.0
253+import QMenuModel 0.1
254 import SystemSettings 1.0
255-import Ubuntu.Components 0.1
256-import Ubuntu.Components.ListItems 0.1 as ListItem
257+import Ubuntu.Components 1.3
258+import Ubuntu.Components.ListItems 1.3 as ListItem
259 import Ubuntu.Components.Popups 0.1
260 import Ubuntu.Connectivity 1.0
261 import Ubuntu.Settings.Components 0.1 as USC
262-import Ubuntu.SystemSettings.Cellular 1.0
263+
264+/* This is a temporary solution to the issue of Hotspots failing on mako. If
265+the device is mako, we hide the hotspot entry. Will be removed once lp:1434591
266+has been resolved. */
267+import Ubuntu.SystemSettings.Update 1.0
268
269 ItemPage {
270
271- id: hotspot
272+ id: root
273 objectName: "hotspotPage"
274-
275- // TRANSLATORS: “Hotspot” is hidden.
276- title: showAllUI ? i18n.tr("Hotspot") : i18n.tr("Wi-Fi hotspot")
277-
278- // We disable the back action while a hotspot is in the process of either
279- // being enabled or disabled.
280- head.backAction: Action {
281- iconName: "back"
282- enabled: !Connectivity.unstoppableOperationHappening
283- onTriggered: {
284- pageStack.pop();
285+ title: i18n.tr("Hotspot")
286+
287+ states: [
288+ State {
289+ name: "disabled"
290+ // Undefined WifiEnabled means Connectivity is unavailable.
291+ when: (typeof Connectivity.WifiEnabled === "undefined" &&
292+ UpdateManager.deviceName !== "mako")
293+ PropertyChanges {
294+ target: hotspotItem
295+ enabled: false
296+ }
297+ PropertyChanges {
298+ target: hotspotSetupButton
299+ enabled: false
300+ }
301+ },
302+ State {
303+ name: "nowifi"
304+ when: (typeof Connectivity.WifiEnabled === "boolean" &&
305+ !Connectivity.WifiEnabled)
306+ PropertyChanges {
307+ target: hotspotSwitchWhenWifiDisabled
308+ visible: true
309+ }
310 }
311- }
312+ ]
313
314 Loader {
315 id: setup
316 asynchronous: false
317 }
318
319- Column {
320+ Flickable {
321+ id: flick
322
323 anchors.fill: parent
324- spacing: units.gu(2)
325-
326- ListItem.Standard {
327- text: i18n.tr("Hotspot")
328- enabled: Connectivity.hotspotStored
329- control: Switch {
330- id: hotspotSwitch
331- objectName: "hotspotSwitch"
332- enabled: !switchSync.syncWaiting
333-
334- USC.ServerPropertySynchroniser {
335- id: switchSync
336- userTarget: hotspotSwitch
337- userProperty: "checked"
338- serverTarget: Connectivity
339- serverProperty: "hotspotEnabled"
340- useWaitBuffer: true
341-
342- // Since this blocks the UI thread, we wait until
343- // the UI has completed the checkbox animation before we
344- // ask the server to uipdate.
345- onSyncTriggered: {
346- triggerTimer.value = value;
347- triggerTimer.start();
348- }
349- }
350-
351- Timer {
352- id: triggerTimer
353- property bool value
354- interval: 250; repeat: false
355- onTriggered: Connectivity.hotspotEnabled = value
356- }
357- }
358- }
359-
360- ListItem.Caption {
361+ contentWidth: parent.width
362+ contentHeight: contentItem.childrenRect.height
363+ boundsBehavior: (contentHeight > root.height) ?
364+ Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
365+
366+ Column {
367 anchors {
368 left: parent.left
369 right: parent.right
370- leftMargin: units.gu(2)
371- rightMargin: units.gu(2)
372- }
373- text : hotspotSwitch.stored ?
374- i18n.tr("When hotspot is on, other devices can use your cellular data connection over Wi-Fi. Normal data charges apply.")
375- : i18n.tr("Other devices can use your cellular data connection over the Wi-Fi network. Normal data charges apply.")
376+ }
377+ spacing: units.gu(2)
378+
379+ ListItem.Standard {
380+ text: i18n.tr("Hotspot")
381+ enabled: (Connectivity.hotspotStored &&
382+ Connectivity.HotspotSwitchEnabled)
383+ control: Switch {
384+ id: hotspotSwitch
385+ objectName: "hotspotSwitch"
386+ enabled: Connectivity.HotspotSwitchEnabled
387+
388+ USC.ServerPropertySynchroniser {
389+ id: switchSync
390+ userTarget: hotspotSwitch
391+ userProperty: "checked"
392+ serverTarget: Connectivity
393+ serverProperty: "hotspotEnabled"
394+ useWaitBuffer: true
395+
396+ // Since this blocks the UI thread, we wait until
397+ // the UI has completed the checkbox animation before we
398+ // ask the server to uipdate.
399+ onSyncTriggered: {
400+ triggerTimer.value = value;
401+ triggerTimer.start();
402+ }
403+ }
404+
405+ // Catch taps if Wi-Fi is disable and prompt user.
406+ MouseArea {
407+ id: hotspotSwitchWhenWifiDisabled
408+ anchors.fill: parent
409+ visible: false
410+ onClicked: enableWifiAction.diag = PopupUtils.open(
411+ enableWifiDialog
412+ );
413+ }
414+
415+ Timer {
416+ id: triggerTimer
417+ property bool value
418+ interval: 250; repeat: false
419+ onTriggered: Connectivity.hotspotEnabled = value
420+ }
421+ }
422+ }
423+
424+ ListItem.Caption {
425+ anchors {
426+ left: parent.left
427+ right: parent.right
428+ leftMargin: units.gu(2)
429+ rightMargin: units.gu(2)
430+ }
431+ text : Connectivity.hotspotStored ?
432+ i18n.tr("When hotspot is on, other devices can use your cellular data connection over Wi-Fi. Normal data charges apply.")
433+ : i18n.tr("Other devices can use your cellular data connection over the Wi-Fi network. Normal data charges apply.")
434+ }
435+
436+ Button {
437+ id: hotspotSetupButton
438+ objectName: "hotspotSetupButton"
439+ anchors.horizontalCenter: parent.horizontalCenter
440+ width: parent.width - units.gu(4)
441+
442+ // If the hotspot is stored, we allow it to be changed. If it's
443+ // non-existent, we only allow setup if it can be turned on.
444+ // This is a by product of the current design.
445+ enabled: (Connectivity.hotspotStored ||
446+ Connectivity.HotspotSwitchEnabled)
447+ text: Connectivity.hotspotStored ?
448+ i18n.tr("Change password/setup…") : i18n.tr("Set up hotspot…")
449+
450+ onClicked: {
451+ setup.setSource(Qt.resolvedUrl("HotspotSetup.qml"));
452+ PopupUtils.open(setup.item, root, {});
453+ }
454+ }
455 }
456-
457- Button {
458- objectName: "hotspotSetupEntry"
459- anchors.horizontalCenter: parent.horizontalCenter
460- width: parent.width - units.gu(4)
461- text: Connectivity.hotspotStored ?
462- i18n.tr("Change password/setup…") : i18n.tr("Set up hotspot…")
463-
464- onClicked: {
465- setup.setSource(Qt.resolvedUrl("HotspotSetup.qml"));
466- PopupUtils.open(setup.item, hotspot, {
467- });
468+ }
469+
470+ Action {
471+ id: enableWifiAction
472+ property var diag
473+ onTriggered: {
474+ // As soon as Wi-Fi has been turned on, activate the USC
475+ // synchroniser.
476+ function wifiUpdated (updated) {
477+ Connectivity.wifiEnabledUpdated.disconnect(wifiUpdated);
478+ switchSync.activate();
479+ PopupUtils.close(diag);
480+ }
481+
482+ if (!Connectivity.wifiEnabled) {
483+ Connectivity.wifiEnabledUpdated.connect(wifiUpdated);
484+ hotspotSwitch.checked = true;
485+ Connectivity.setwifiEnabled(true);
486 }
487 }
488 }
489@@ -117,23 +187,20 @@
490 Component {
491 id: enableWifiDialog
492 Dialog {
493- id: dialogue
494+ id: dialog
495 objectName: "enableWifiDialog"
496- // TRANSLATORS: This string is hidden.
497 title: i18n.tr("Wi-Fi is off")
498- // TRANSLATORS: This string is hidden.
499 text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.")
500- visible: showAllUI
501
502 Button {
503 text: i18n.tr("Cancel")
504- onClicked: PopupUtils.close(dialogue)
505+ onClicked: PopupUtils.close(dialog)
506 }
507
508 Button {
509 objectName: "confirmEnable"
510- // TRANSLATORS: This string is hidden.
511 text: i18n.tr("Turn on Wi-Fi")
512+ onClicked: enableWifiAction.trigger()
513 }
514 }
515 }
516
517=== added file 'plugins/hotspot/hotspot.settings'
518--- plugins/hotspot/hotspot.settings 1970-01-01 00:00:00 +0000
519+++ plugins/hotspot/hotspot.settings 2015-08-14 11:52:44 +0000
520@@ -0,0 +1,18 @@
521+{
522+ "icon": "preferences-network-hotspot-symbolic",
523+ "name": "Hotspot",
524+ "translations": "ubuntu-system-settings",
525+ "category": "network",
526+ "priority": 2,
527+ "form-factors": [
528+ "phone"
529+ ],
530+ "keywords": [
531+ "network",
532+ "hotspot",
533+ "tethering"
534+ ],
535+ "has-dynamic-keywords": false,
536+ "has-dynamic-visibility": false,
537+ "page-component": "PageComponent.qml"
538+}
539
540=== added file 'plugins/hotspot/qmldir'
541--- plugins/hotspot/qmldir 1970-01-01 00:00:00 +0000
542+++ plugins/hotspot/qmldir 2015-08-14 11:52:44 +0000
543@@ -0,0 +1,2 @@
544+module Ubuntu.SystemSettings.Hotspot
545+plugin UbuntuHotspotPanel
546
547=== added file 'plugins/hotspot/settings-hotspot.svg'
548--- plugins/hotspot/settings-hotspot.svg 1970-01-01 00:00:00 +0000
549+++ plugins/hotspot/settings-hotspot.svg 2015-08-14 11:52:44 +0000
550@@ -0,0 +1,182 @@
551+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
552+<!-- Created with Inkscape (http://www.inkscape.org/) -->
553+
554+<svg
555+ xmlns:dc="http://purl.org/dc/elements/1.1/"
556+ xmlns:cc="http://creativecommons.org/ns#"
557+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
558+ xmlns:svg="http://www.w3.org/2000/svg"
559+ xmlns="http://www.w3.org/2000/svg"
560+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
561+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
562+ width="96"
563+ height="96"
564+ id="svg4874"
565+ version="1.1"
566+ inkscape:version="0.91+devel r"
567+ viewBox="0 0 96 96.000001"
568+ sodipodi:docname="preferences-network-hotspot-symbolic.svg">
569+ <defs
570+ id="defs4876" />
571+ <sodipodi:namedview
572+ id="base"
573+ pagecolor="#ffffff"
574+ bordercolor="#666666"
575+ borderopacity="1.0"
576+ inkscape:pageopacity="0.0"
577+ inkscape:pageshadow="2"
578+ inkscape:zoom="5.6199991"
579+ inkscape:cx="-39.092542"
580+ inkscape:cy="39.181476"
581+ inkscape:document-units="px"
582+ inkscape:current-layer="g4780"
583+ showgrid="true"
584+ showborder="true"
585+ fit-margin-top="0"
586+ fit-margin-left="0"
587+ fit-margin-right="0"
588+ fit-margin-bottom="0"
589+ inkscape:snap-bbox="true"
590+ inkscape:bbox-paths="true"
591+ inkscape:bbox-nodes="true"
592+ inkscape:snap-bbox-edge-midpoints="true"
593+ inkscape:snap-bbox-midpoints="true"
594+ inkscape:object-paths="true"
595+ inkscape:snap-intersection-paths="true"
596+ inkscape:object-nodes="true"
597+ inkscape:snap-smooth-nodes="true"
598+ inkscape:snap-midpoints="true"
599+ inkscape:snap-object-midpoints="true"
600+ inkscape:snap-center="true"
601+ showguides="true"
602+ inkscape:guide-bbox="true"
603+ inkscape:snap-global="true">
604+ <inkscape:grid
605+ type="xygrid"
606+ id="grid5451"
607+ empspacing="8" />
608+ <sodipodi:guide
609+ orientation="1,0"
610+ position="8,-8.0000001"
611+ id="guide4063" />
612+ <sodipodi:guide
613+ orientation="1,0"
614+ position="4,-8.0000001"
615+ id="guide4065" />
616+ <sodipodi:guide
617+ orientation="0,1"
618+ position="-8,88.000001"
619+ id="guide4067" />
620+ <sodipodi:guide
621+ orientation="0,1"
622+ position="-8,92.000001"
623+ id="guide4069" />
624+ <sodipodi:guide
625+ orientation="0,1"
626+ position="104,4"
627+ id="guide4071" />
628+ <sodipodi:guide
629+ orientation="0,1"
630+ position="-5,8.0000001"
631+ id="guide4073" />
632+ <sodipodi:guide
633+ orientation="1,0"
634+ position="88,-8.0000001"
635+ id="guide4077" />
636+ <sodipodi:guide
637+ orientation="0,1"
638+ position="-8,84.000001"
639+ id="guide4074" />
640+ <sodipodi:guide
641+ orientation="1,0"
642+ position="12,-8.0000001"
643+ id="guide4076" />
644+ <sodipodi:guide
645+ orientation="1,0"
646+ position="84,-8.0000001"
647+ id="guide4080" />
648+ <sodipodi:guide
649+ position="48,-8.0000001"
650+ orientation="1,0"
651+ id="guide4170" />
652+ <sodipodi:guide
653+ position="-8,48"
654+ orientation="0,1"
655+ id="guide4172" />
656+ <sodipodi:guide
657+ position="92,-8.0000001"
658+ orientation="1,0"
659+ id="guide4760" />
660+ <sodipodi:guide
661+ position="106,12"
662+ orientation="0,1"
663+ id="guide4211" />
664+ </sodipodi:namedview>
665+ <metadata
666+ id="metadata4879">
667+ <rdf:RDF>
668+ <cc:Work
669+ rdf:about="">
670+ <dc:format>image/svg+xml</dc:format>
671+ <dc:type
672+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
673+ <dc:title></dc:title>
674+ </cc:Work>
675+ </rdf:RDF>
676+ </metadata>
677+ <g
678+ inkscape:label="Layer 1"
679+ inkscape:groupmode="layer"
680+ id="layer1"
681+ transform="translate(67.857146,-78.50504)">
682+ <g
683+ transform="matrix(0,-1,-1,0,373.50506,516.50504)"
684+ id="g4845"
685+ style="display:inline">
686+ <g
687+ inkscape:export-ydpi="90"
688+ inkscape:export-xdpi="90"
689+ inkscape:export-filename="next01.png"
690+ transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
691+ id="g4778"
692+ inkscape:label="Layer 1">
693+ <g
694+ transform="matrix(-1,0,0,1,575.99999,611)"
695+ id="g4780"
696+ style="display:inline">
697+ <rect
698+ style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
699+ id="rect4782"
700+ width="96.037987"
701+ height="96"
702+ x="-438.00244"
703+ y="345.36221"
704+ transform="scale(-1,1)" />
705+ <ellipse
706+ style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.60031652;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
707+ id="path4213"
708+ cx="-393.36221"
709+ cy="-389.98346"
710+ transform="matrix(0,-1,-1,0,0,0)"
711+ rx="7.9999995"
712+ ry="8.0031652" />
713+ <path
714+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
715+ d="m 349.9668,391.36133 v 4.00195 h 40.01758 v -4.00195 z"
716+ id="path4215"
717+ inkscape:connector-curvature="0" />
718+ <path
719+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
720+ d="m 415.98047,393.36133 c 0,6.65833 -2.5351,13.31837 -7.60547,18.38672 -10.14073,10.13669 -26.64247,10.13669 -36.7832,0 l 2.82812,-2.83008 c 8.61153,8.6081 22.51542,8.6081 31.12696,0 8.61153,-8.60811 8.61153,-22.50322 0,-31.11133 -8.61154,-8.6081 -22.51543,-8.6081 -31.12696,0 l -2.82812,-2.83008 c 10.14073,-10.1367 26.64247,-10.1367 36.7832,0 5.07037,5.06835 7.60547,11.72644 7.60547,18.38477 z"
721+ id="ellipse4202"
722+ inkscape:connector-curvature="0" />
723+ <path
724+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
725+ d="m 431.98828,393.36133 c 0,10.75327 -4.09896,21.50653 -12.29492,29.69922 -16.39192,16.38537 -43.02801,16.38537 -59.41992,0 l 2.82812,-2.82813 c 14.86272,14.85678 38.90096,14.85678 53.76367,0 14.86272,-14.85678 14.86272,-38.88345 0,-53.74023 -14.86271,-14.85679 -38.90095,-14.85679 -53.76367,0 l -2.82812,-2.83008 c 16.39191,-16.38538 43.028,-16.38538 59.41992,0 8.19596,8.19269 12.29492,18.94594 12.29492,29.69922 z"
726+ id="ellipse4204"
727+ inkscape:connector-curvature="0" />
728+ </g>
729+ </g>
730+ </g>
731+ </g>
732+</svg>
733
734=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
735--- tests/autopilot/ubuntu_system_settings/__init__.py 2015-08-10 20:05:22 +0000
736+++ tests/autopilot/ubuntu_system_settings/__init__.py 2015-08-14 11:52:44 +0000
737@@ -87,6 +87,10 @@
738 return self._go_to_page('entryComponent-cellular', 'cellularPage')
739
740 @autopilot.logging.log_action(logger.debug)
741+ def go_to_hotspot_page(self):
742+ return self._go_to_page('entryComponent-hotspot', 'hotspotPage')
743+
744+ @autopilot.logging.log_action(logger.debug)
745 def go_to_bluetooth_page(self):
746 return self._go_to_page('entryComponent-bluetooth', 'bluetoothPage')
747
748@@ -333,52 +337,8 @@
749 field.write(name)
750 self.pointing_device.click_object(ok)
751
752- """
753- :returns: Whether or not hotspot can be used.
754- """
755- @autopilot.logging.log_action(logger.debug)
756- def have_hotspot(self):
757- return self.wait_select_single(objectName='hotspotEntry').visible
758-
759- """
760- :param: Configuration with keys ssid and password.
761- :returns: Hotspot page.
762- """
763- @autopilot.logging.log_action(logger.debug)
764- def setup_hotspot(self, config=None):
765- hotspot_page = self._enter_hotspot()
766- hotspot_page.setup_hotspot(config)
767- return hotspot_page
768-
769- """
770- Enables hotspot.
771- :returns: Hotspot page.
772- """
773- @autopilot.logging.log_action(logger.debug)
774- def enable_hotspot(self):
775- hotspot_page = self._enter_hotspot()
776- hotspot_page.enable_hotspot()
777- return hotspot_page
778-
779- """
780- Disables hotspot.
781- :returns: Hotspot page.
782- """
783- @autopilot.logging.log_action(logger.debug)
784- def disable_hotspot(self):
785- hotspot_page = self._enter_hotspot()
786- hotspot_page.disable_hotspot()
787- return hotspot_page
788-
789- @autopilot.logging.log_action(logger.debug)
790- def _enter_hotspot(self):
791- obj = self.wait_select_single(objectName="hotspotEntry")
792- self.pointing_device.click_object(obj)
793- return self.get_root_instance().wait_select_single(
794- objectName='hotspotPage')
795-
796-
797-class Hotspot(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
798+
799+class HotspotPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
800
801 """Autopilot helper for Hotspot page."""
802
803@@ -398,7 +358,23 @@
804
805 @autopilot.logging.log_action(logger.debug)
806 def enable_hotspot(self):
807- self._switch.check()
808+ # We assume that the following AssertionError is due to the panel
809+ # instantly setting checked to False, prompting the user to turn on
810+ # Wi-Fi instead.
811+ try:
812+ self._switch.check(timeout=2)
813+ except AssertionError:
814+ pass
815+
816+ try:
817+ prompt = self.get_root_instance().wait_select_single(
818+ objectName='enableWifiDialog')
819+ except StateNotFoundError:
820+ prompt = None
821+
822+ if prompt:
823+ prompt.confirm_enable()
824+ prompt.wait_until_destroyed(timeout=5)
825
826 @autopilot.logging.log_action(logger.debug)
827 def disable_hotspot(self):
828@@ -406,7 +382,7 @@
829
830 @autopilot.logging.log_action(logger.debug)
831 def setup_hotspot(self, config):
832- obj = self.select_single(objectName='hotspotSetupEntry')
833+ obj = self.select_single(objectName='hotspotSetupButton')
834 self.pointing_device.click_object(obj)
835 setup = self.get_root_instance().wait_select_single(
836 objectName='hotspotSetup')
837@@ -423,6 +399,28 @@
838 def get_hotspot_status(self):
839 return self._switch.checked
840
841+ @autopilot.logging.log_action(logger.debug)
842+ def get_hotspot_possible(self):
843+ return self._switch.enabled
844+
845+
846+class HotspotEnableWifiDialog(
847+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
848+ """Autopilot helper for the 'Turn on Wi-Fi' dialog in hotspot panel."""
849+
850+ @classmethod
851+ def validate_dbus_object(cls, path, state):
852+ name = introspection.get_classname_from_path(path)
853+ if name == b'Dialog':
854+ if state['objectName'][1] == 'enableWifiDialog':
855+ return True
856+ return False
857+
858+ @autopilot.logging.log_action(logger.debug)
859+ def confirm_enable(self):
860+ button = self.select_single('Button', objectName='confirmEnable')
861+ self.pointing_device.click_object(button)
862+
863
864 class HotspotSetup(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
865
866
867=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
868--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-08-06 17:15:50 +0000
869+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-08-14 11:52:44 +0000
870@@ -395,7 +395,8 @@
871 context.SetProperty(key, value)
872
873
874-class HotspotBaseTestCase(CellularBaseTestCase):
875+class HotspotBaseTestCase(UbuntuSystemSettingsTestCase,
876+ dbusmock.DBusTestCase):
877
878 connectivity_parameters = {}
879 indicatornetwork_parameters = {}
880@@ -431,6 +432,7 @@
881 stdout=subprocess.PIPE)
882
883 super(HotspotBaseTestCase, self).setUp()
884+ self.hotspot_page = self.main_view.go_to_hotspot_page()
885
886 def tearDown(self):
887 self.ctv_mock.terminate()
888
889=== modified file 'tests/autopilot/ubuntu_system_settings/tests/connectivity.py'
890--- tests/autopilot/ubuntu_system_settings/tests/connectivity.py 2015-08-10 11:01:34 +0000
891+++ tests/autopilot/ubuntu_system_settings/tests/connectivity.py 2015-08-14 11:52:44 +0000
892@@ -47,6 +47,10 @@
893 self.SetProperty(PRIV_OBJ, PRIV_IFACE, 'HotspotPassword', value)
894
895
896+def set_wifi_enabled(self, value):
897+ self.SetProperty(NETS_OBJ, NETS_IFACE, 'WifiEnabled', value)
898+
899+
900 def load(mock, parameters):
901 global _parameters
902 _parameters = parameters
903@@ -54,6 +58,7 @@
904 mock.set_hotspot_enabled = set_hotspot_enabled
905 mock.set_hotspot_ssid = set_hotspot_ssid
906 mock.set_hotspot_password = set_hotspot_password
907+ mock.set_wifi_enabled = set_wifi_enabled
908
909 mock.AddObject(
910 NETS_OBJ,
911@@ -67,7 +72,15 @@
912 'HotspotStored': _parameters.get(
913 'HotspotStored', dbus.Boolean(False)
914 ),
915- 'UnstoppableOperationHappening': dbus.Boolean(False),
916+ 'FlightModeSwitchEnabled': _parameters.get(
917+ 'FlightModeSwitchEnabled', dbus.Boolean(False)
918+ ),
919+ 'WifiSwitchEnabled': _parameters.get(
920+ 'WifiSwitchEnabled', dbus.Boolean(False)
921+ ),
922+ 'HotspotSwitchEnabled': _parameters.get(
923+ 'HotspotSwitchEnabled', dbus.Boolean(False)
924+ ),
925 'WifiEnabled': _parameters.get('WifiEnabled', dbus.Boolean(False)),
926 # One of online, offline and connecting.
927 'Status': _parameters.get('Status', 'offline')
928@@ -98,7 +111,7 @@
929 ),
930 (
931 'SetWifiEnabled', 'b', '',
932- ''
933+ 'objects["/"].set_wifi_enabled(self, args[0])'
934 ),
935 (
936 'SetHotspotSsid', 'ay', '',
937
938=== modified file 'tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py'
939--- tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py 2015-08-10 11:01:34 +0000
940+++ tests/autopilot/ubuntu_system_settings/tests/indicatornetwork.py 2015-08-14 11:52:44 +0000
941@@ -26,7 +26,16 @@
942
943
944 def activate(self, action_name, parameters, platform_data):
945- pass
946+
947+ if action_name == 'wifi.enable':
948+ enabled, sig, states = self.actions[action_name]
949+ state = dbus.Boolean(not states[0], variant_level=1)
950+ new_struct = (enabled, sig, [state])
951+ self.actions[action_name] = new_struct
952+ self.Changes(dbus.Array([], signature='s'),
953+ dbus.Dictionary({}, signature='sb'),
954+ dbus.Dictionary({action_name: state}, signature='sv'),
955+ dbus.Dictionary({}, signature='s(bgav)'))
956
957
958 def describe(self, action_name):
959@@ -52,19 +61,19 @@
960 obj.EmitSignal(MAIN_IFACE, 'Changed', 'asa{sb}a{sv}a{s(bgav)}', [
961 removals, enable_changes, state_changes, additions
962 ])
963- pass
964
965
966 def load(mock, parameters):
967 global _parameters
968 _parameters = parameters
969
970+ mock.activate = activate
971 mock.describe = describe
972 mock.describe_all = describe_all
973 mock.list_actions = list_actions
974 mock.set_state = set_state
975
976- mock.actions = parameters.get('actions', {
977+ mock.actions = _parameters.get('actions', {
978 'wifi.enable': (True, '', [True]),
979 })
980
981@@ -72,7 +81,8 @@
982 MAIN_IFACE,
983 [
984 (
985- 'Activate', 'sava{sv}', '', ''
986+ 'Activate', 'sava{sv}', '',
987+ 'self.activate(self, args[0], args[1], args[2])'
988 ),
989 (
990 'Describe', 's', '(bgav)',
991
992=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py'
993--- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2015-08-10 20:05:22 +0000
994+++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2015-08-14 11:52:44 +0000
995@@ -13,14 +13,10 @@
996 from testtools.matchers import Equals, raises, StartsWith
997
998 from ubuntu_system_settings.tests import (
999- CellularBaseTestCase, HotspotBaseTestCase, CONNMAN_IFACE, RDO_IFACE,
1000+ CellularBaseTestCase, CONNMAN_IFACE, RDO_IFACE,
1001 NETREG_IFACE)
1002
1003
1004-from ubuntu_system_settings.tests.connectivity import (
1005- PRIV_IFACE as CTV_PRIV_IFACE, NETS_IFACE as CTV_NETS_IFACE
1006-)
1007-
1008 DEV_IFACE = 'org.freedesktop.NetworkManager.Device'
1009
1010
1011@@ -307,106 +303,6 @@
1012 Eventually(Equals('/ril_1')))
1013
1014
1015-class HotspotNonExistantTestCase(HotspotBaseTestCase):
1016-
1017- connectivity_parameters = {
1018- 'HotspotEnabled': False,
1019- 'HotspotStored': False
1020- }
1021-
1022- def test_setup(self):
1023- ssid = 'bar'
1024- password = 'zomgzomg'
1025- config = {'ssid': ssid, 'password': password}
1026-
1027- hotspot_page = self.cellular_page.setup_hotspot(config)
1028-
1029- # Assert that the switch is on.
1030- self.assertTrue(hotspot_page.get_hotspot_status())
1031-
1032- self.assertThat(
1033- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1034- Eventually(Equals(True))
1035- )
1036-
1037- self.assertThat(
1038- lambda: bytearray(
1039- self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1040- ).decode('UTF-8'),
1041- Eventually(Equals(ssid))
1042- )
1043-
1044- self.assertThat(
1045- lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1046- Eventually(Equals(password))
1047- )
1048-
1049- self.assertThat(
1050- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1051- Eventually(Equals(True))
1052- )
1053-
1054-
1055-class HotspotExistsTestCase(HotspotBaseTestCase):
1056-
1057- connectivity_parameters = {
1058- 'HotspotStored': True
1059- }
1060-
1061- def test_enabling(self):
1062- self.assertThat(
1063- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1064- Eventually(Equals(False))
1065- )
1066-
1067- self.cellular_page.enable_hotspot()
1068-
1069- self.assertThat(
1070- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1071- Eventually(Equals(True))
1072- )
1073-
1074- def test_changing(self):
1075- ssid = 'bar'
1076- password = 'zomgzomg'
1077- config = {'ssid': ssid, 'password': password}
1078- self.cellular_page.setup_hotspot(config)
1079-
1080- self.assertThat(
1081- lambda: bytearray(
1082- self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1083- ).decode('UTF-8'),
1084- Eventually(Equals(ssid))
1085- )
1086-
1087- self.assertThat(
1088- lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1089- Eventually(Equals(password))
1090- )
1091-
1092-
1093-class HotspotEnabledTestCase(HotspotBaseTestCase):
1094-
1095- connectivity_parameters = {
1096- 'HotspotStored': True,
1097- 'HotspotEnabled': True
1098- }
1099-
1100- def test_disabling(self):
1101-
1102- self.assertThat(
1103- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1104- Eventually(Equals(True))
1105- )
1106-
1107- self.cellular_page.disable_hotspot()
1108-
1109- self.assertThat(
1110- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1111- Eventually(Equals(False))
1112- )
1113-
1114-
1115 class ApnTestCase(CellularBaseTestCase):
1116
1117 def test_remove_apn(self):
1118
1119=== added file 'tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py'
1120--- tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py 1970-01-01 00:00:00 +0000
1121+++ tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py 2015-08-14 11:52:44 +0000
1122@@ -0,0 +1,228 @@
1123+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1124+# Copyright 2014 Canonical
1125+#
1126+# This program is free software: you can redistribute it and/or modify it
1127+# under the terms of the GNU General Public License version 3, as published
1128+# by the Free Software Foundation.
1129+
1130+from autopilot.matchers import Eventually
1131+from testtools.matchers import Equals
1132+
1133+from ubuntu_system_settings.tests import HotspotBaseTestCase
1134+
1135+from ubuntu_system_settings.tests.connectivity import (
1136+ PRIV_IFACE as CTV_PRIV_IFACE, NETS_IFACE as CTV_NETS_IFACE
1137+)
1138+
1139+
1140+class HotspotSetupTestCase(HotspotBaseTestCase):
1141+
1142+ connectivity_parameters = {
1143+ 'HotspotEnabled': False,
1144+ 'HotspotStored': False,
1145+ 'WifiEnabled': True,
1146+ 'HotspotSwitchEnabled': True
1147+ }
1148+
1149+ def test_setup(self):
1150+ ssid = 'bar'
1151+ password = 'zomgzomg'
1152+ config = {'ssid': ssid, 'password': password}
1153+
1154+ self.hotspot_page.setup_hotspot(config)
1155+
1156+ # Assert that the switch is on.
1157+ self.assertTrue(self.hotspot_page.get_hotspot_status())
1158+
1159+ self.assertThat(
1160+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1161+ Eventually(Equals(True))
1162+ )
1163+
1164+ self.assertThat(
1165+ lambda: bytearray(
1166+ self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1167+ ).decode('UTF-8'),
1168+ Eventually(Equals(ssid))
1169+ )
1170+
1171+ self.assertThat(
1172+ lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1173+ Eventually(Equals(password))
1174+ )
1175+
1176+ self.assertThat(
1177+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1178+ Eventually(Equals(True))
1179+ )
1180+
1181+
1182+class HotspotExistsTestCase(HotspotBaseTestCase):
1183+
1184+ connectivity_parameters = {
1185+ 'HotspotStored': True,
1186+ 'WifiEnabled': True,
1187+ 'HotspotSwitchEnabled': True
1188+ }
1189+
1190+ def test_enabling(self):
1191+ self.assertThat(
1192+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1193+ Eventually(Equals(False))
1194+ )
1195+
1196+ self.hotspot_page.enable_hotspot()
1197+
1198+ self.assertThat(
1199+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1200+ Eventually(Equals(True))
1201+ )
1202+
1203+ def test_changing(self):
1204+ ssid = 'bar'
1205+ password = 'zomgzomg'
1206+ config = {'ssid': ssid, 'password': password}
1207+ self.hotspot_page.setup_hotspot(config)
1208+
1209+ self.assertThat(
1210+ lambda: bytearray(
1211+ self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1212+ ).decode('UTF-8'),
1213+ Eventually(Equals(ssid))
1214+ )
1215+
1216+ self.assertThat(
1217+ lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1218+ Eventually(Equals(password))
1219+ )
1220+
1221+
1222+class HotspotRunningTestCase(HotspotBaseTestCase):
1223+
1224+ connectivity_parameters = {
1225+ 'HotspotStored': True,
1226+ 'HotspotEnabled': True,
1227+ 'WifiEnabled': True,
1228+ 'HotspotSwitchEnabled': True
1229+ }
1230+
1231+ def test_disabling(self):
1232+
1233+ self.assertThat(
1234+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1235+ Eventually(Equals(True))
1236+ )
1237+
1238+ self.hotspot_page.disable_hotspot()
1239+
1240+ self.assertThat(
1241+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1242+ Eventually(Equals(False))
1243+ )
1244+
1245+
1246+class HotspotChangeNoWiFiTestCase(HotspotBaseTestCase):
1247+
1248+ connectivity_parameters = {
1249+ 'HotspotStored': True,
1250+ 'HotspotEnabled': False,
1251+ 'WifiEnabled': False,
1252+ 'HotspotSwitchEnabled': True
1253+ }
1254+
1255+ def test_enabling(self):
1256+
1257+ self.assertThat(
1258+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1259+ Eventually(Equals(False))
1260+ )
1261+
1262+ self.assertThat(
1263+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1264+ Eventually(Equals(False))
1265+ )
1266+
1267+ self.hotspot_page.enable_hotspot()
1268+
1269+ self.assertThat(
1270+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1271+ Eventually(Equals(True))
1272+ )
1273+
1274+ self.assertThat(
1275+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1276+ Eventually(Equals(True))
1277+ )
1278+
1279+
1280+class HotspotSetupNoWiFiTestCase(HotspotBaseTestCase):
1281+
1282+ connectivity_parameters = {
1283+ 'HotspotStored': False,
1284+ 'HotspotEnabled': False,
1285+ 'WifiEnabled': False,
1286+ 'HotspotSwitchEnabled': True
1287+ }
1288+
1289+ def test_setup(self):
1290+ ssid = 'bar'
1291+ password = 'zomgzomg'
1292+ config = {'ssid': ssid, 'password': password}
1293+
1294+ self.assertThat(
1295+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1296+ Eventually(Equals(False))
1297+ )
1298+
1299+ self.assertThat(
1300+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1301+ Eventually(Equals(False))
1302+ )
1303+
1304+ self.hotspot_page.setup_hotspot(config)
1305+
1306+ self.assertThat(
1307+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1308+ Eventually(Equals(True))
1309+ )
1310+
1311+ self.assertThat(
1312+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1313+ Eventually(Equals(True))
1314+ )
1315+
1316+ self.assertThat(
1317+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1318+ Eventually(Equals(True))
1319+ )
1320+
1321+
1322+class HotspotChangeInFlightModeTestCase(HotspotBaseTestCase):
1323+
1324+ connectivity_parameters = {
1325+ 'HotspotStored': True,
1326+ 'HotspotEnabled': False,
1327+ 'WifiEnabled': True,
1328+ 'HotspotSwitchEnabled': False
1329+ }
1330+
1331+ def test_switch_disabled(self):
1332+ self.assertFalse(self.hotspot_page.get_hotspot_possible())
1333+
1334+
1335+class HotspotSetupInFlightModeTestCase(
1336+ HotspotBaseTestCase):
1337+
1338+ connectivity_parameters = {
1339+ 'HotspotStored': False,
1340+ 'HotspotEnabled': False,
1341+ 'WifiEnabled': True,
1342+ 'HotspotSwitchEnabled': False
1343+ }
1344+
1345+ def test_setup_disabled(self):
1346+ setup = self.hotspot_page.select_single(
1347+ objectName='hotspotSetupButton'
1348+ )
1349+ self.assertFalse(setup.enabled)
1350+ self.assertFalse(self.hotspot_page.get_hotspot_possible())
1351
1352=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_phone.py'
1353--- tests/autopilot/ubuntu_system_settings/tests/test_phone.py 2015-08-05 13:19:19 +0000
1354+++ tests/autopilot/ubuntu_system_settings/tests/test_phone.py 2015-08-14 11:52:44 +0000
1355@@ -31,7 +31,7 @@
1356
1357 # Check that the forward has been set
1358 self.assertThat(
1359- call_fwd_page.get_forward_unconditionally,
1360+ call_fwd_page.get_forward_unconditionally(),
1361 Eventually(Equals('41444424')))
1362
1363 # Check that dbus properties have been updated
1364@@ -53,7 +53,7 @@
1365
1366 # Check that the forward has been unset
1367 self.assertThat(
1368- call_fwd_page.get_forward_unconditionally,
1369+ call_fwd_page.get_forward_unconditionally(),
1370 Eventually(Equals('')))
1371
1372 # Check that dbus properties have been updated
1373@@ -67,7 +67,7 @@
1374
1375 # Check that the forward has been set
1376 self.assertThat(
1377- call_fwd_page.get_forward_on_busy,
1378+ call_fwd_page.get_forward_on_busy(),
1379 Eventually(Equals('41444424')))
1380
1381 # Check that dbus properties have been updated
1382@@ -80,7 +80,7 @@
1383
1384 # Check that the forward has been unset
1385 self.assertThat(
1386- call_fwd_page.get_forward_on_busy,
1387+ call_fwd_page.get_forward_on_busy(),
1388 Eventually(Equals('')))
1389
1390 # Check that dbus properties have been updated
1391@@ -94,7 +94,7 @@
1392
1393 # Check that the forward has been set
1394 self.assertThat(
1395- call_fwd_page.get_forward_when_no_answer,
1396+ call_fwd_page.get_forward_when_no_answer(),
1397 Eventually(Equals('41444424')))
1398
1399 # Check that dbus properties have been updated
1400@@ -107,7 +107,7 @@
1401
1402 # Check that the forward has been unset
1403 self.assertThat(
1404- call_fwd_page.get_forward_when_no_answer,
1405+ call_fwd_page.get_forward_when_no_answer(),
1406 Eventually(Equals('')))
1407
1408 # Check that dbus properties have been updated
1409@@ -123,7 +123,7 @@
1410
1411 # Check that the forward has been set
1412 self.assertThat(
1413- call_fwd_page.get_forward_when_unreachable,
1414+ call_fwd_page.get_forward_when_unreachable(),
1415 Eventually(Equals('41444424')))
1416
1417 # Check that dbus properties have been updated
1418@@ -136,7 +136,7 @@
1419
1420 # Check that the forward has been unset
1421 self.assertThat(
1422- call_fwd_page.get_forward_when_unreachable,
1423+ call_fwd_page.get_forward_when_unreachable(),
1424 Eventually(Equals('')))
1425
1426 # Check that dbus properties have been updated
1427@@ -174,7 +174,7 @@
1428 # TODO: Test the Services page itself.
1429 def test_sim_services(self):
1430 self.assertThat(
1431- self.phone_page.get_sim_services_enabled,
1432+ self.phone_page.get_sim_services_enabled(),
1433 Eventually(Equals(True)))
1434 self.phone_page.go_to_sim_services()
1435 self.main_view.go_back()
1436@@ -182,7 +182,7 @@
1437 SIM_IFACE, 'PropertyChanged', 'sv',
1438 ['ServiceNumbers', ''])
1439 self.assertThat(
1440- self.phone_page.get_sim_services_enabled,
1441+ self.phone_page.get_sim_services_enabled(),
1442 Eventually(Equals(False)))
1443
1444
1445@@ -199,7 +199,7 @@
1446
1447 # Check that the forward has been set
1448 self.assertThat(
1449- call_fwd_page.get_forward_unconditionally,
1450+ call_fwd_page.get_forward_unconditionally(),
1451 Eventually(Equals('41444424')))
1452
1453 # Check that dbus properties have been updated
1454@@ -221,7 +221,7 @@
1455
1456 # Check that the forward has been unset
1457 self.assertThat(
1458- call_fwd_page.get_forward_unconditionally,
1459+ call_fwd_page.get_forward_unconditionally(),
1460 Eventually(Equals('')))
1461
1462 # Check that dbus properties have been updated
1463@@ -236,7 +236,7 @@
1464
1465 # Check that the forward has been set
1466 self.assertThat(
1467- call_fwd_page.get_forward_on_busy,
1468+ call_fwd_page.get_forward_on_busy(),
1469 Eventually(Equals('41444424')))
1470
1471 # Check that dbus properties have been updated
1472@@ -249,7 +249,7 @@
1473
1474 # Check that the forward has been unset
1475 self.assertThat(
1476- call_fwd_page.get_forward_on_busy,
1477+ call_fwd_page.get_forward_on_busy(),
1478 Eventually(Equals('')))
1479
1480 # Check that dbus properties have been updated
1481@@ -264,7 +264,7 @@
1482
1483 # Check that the forward has been set
1484 self.assertThat(
1485- call_fwd_page.get_forward_when_no_answer,
1486+ call_fwd_page.get_forward_when_no_answer(),
1487 Eventually(Equals('41444424')))
1488
1489 # Check that dbus properties have been updated
1490@@ -277,7 +277,7 @@
1491
1492 # Check that the forward has been unset
1493 self.assertThat(
1494- call_fwd_page.get_forward_when_no_answer,
1495+ call_fwd_page.get_forward_when_no_answer(),
1496 Eventually(Equals('')))
1497
1498 # Check that dbus properties have been updated
1499@@ -293,7 +293,7 @@
1500
1501 # Check that the forward has been set
1502 self.assertThat(
1503- call_fwd_page.get_forward_when_unreachable,
1504+ call_fwd_page.get_forward_when_unreachable(),
1505 Eventually(Equals('41444424')))
1506
1507 # Check that dbus properties have been updated
1508@@ -306,7 +306,7 @@
1509
1510 # Check that the forward has been unset
1511 self.assertThat(
1512- call_fwd_page.get_forward_when_unreachable,
1513+ call_fwd_page.get_forward_when_unreachable(),
1514 Eventually(Equals('')))
1515
1516 # Check that dbus properties have been updated
1517@@ -324,7 +324,7 @@
1518
1519 # Check that the forward has been set
1520 self.assertThat(
1521- call_fwd_page.get_forward_unconditionally,
1522+ call_fwd_page.get_forward_unconditionally(),
1523 Eventually(Equals('41444424')))
1524
1525 # Check that dbus properties have been updated
1526@@ -346,7 +346,7 @@
1527
1528 # Check that the forward has been unset
1529 self.assertThat(
1530- call_fwd_page.get_forward_unconditionally,
1531+ call_fwd_page.get_forward_unconditionally(),
1532 Eventually(Equals('')))
1533
1534 # Check that dbus properties have been updated
1535@@ -361,7 +361,7 @@
1536
1537 # Check that the forward has been set
1538 self.assertThat(
1539- call_fwd_page.get_forward_on_busy,
1540+ call_fwd_page.get_forward_on_busy(),
1541 Eventually(Equals('41444424')))
1542
1543 # Check that dbus properties have been updated
1544@@ -374,7 +374,7 @@
1545
1546 # Check that the forward has been unset
1547 self.assertThat(
1548- call_fwd_page.get_forward_on_busy,
1549+ call_fwd_page.get_forward_on_busy(),
1550 Eventually(Equals('')))
1551
1552 # Check that dbus properties have been updated
1553@@ -389,7 +389,7 @@
1554
1555 # Check that the forward has been set
1556 self.assertThat(
1557- call_fwd_page.get_forward_when_no_answer,
1558+ call_fwd_page.get_forward_when_no_answer(),
1559 Eventually(Equals('41444424')))
1560
1561 # Check that dbus properties have been updated
1562@@ -402,7 +402,7 @@
1563
1564 # Check that the forward has been unset
1565 self.assertThat(
1566- call_fwd_page.get_forward_when_no_answer,
1567+ call_fwd_page.get_forward_when_no_answer(),
1568 Eventually(Equals('')))
1569
1570 # Check that dbus properties have been updated
1571@@ -418,7 +418,7 @@
1572
1573 # Check that the forward has been set
1574 self.assertThat(
1575- call_fwd_page.get_forward_when_unreachable,
1576+ call_fwd_page.get_forward_when_unreachable(),
1577 Eventually(Equals('41444424')))
1578
1579 # Check that dbus properties have been updated
1580@@ -431,7 +431,7 @@
1581
1582 # Check that the forward has been unset
1583 self.assertThat(
1584- call_fwd_page.get_forward_when_unreachable,
1585+ call_fwd_page.get_forward_when_unreachable(),
1586 Eventually(Equals('')))
1587
1588 # Check that dbus properties have been updated
1589@@ -495,7 +495,7 @@
1590 # TODO: Test the Services page itself.
1591 def test_sim_services_sim_1(self):
1592 self.assertThat(
1593- lambda: self.phone_page.get_sim_services_enabled(sim=0),
1594+ self.phone_page.get_sim_services_enabled(sim=0),
1595 Eventually(Equals(True)))
1596 self.phone_page.go_to_sim_services(sim=0)
1597 self.main_view.go_back()
1598@@ -503,13 +503,13 @@
1599 SIM_IFACE, 'PropertyChanged', 'sv',
1600 ['ServiceNumbers', ''])
1601 self.assertThat(
1602- lambda: self.phone_page.get_sim_services_enabled(sim=0),
1603+ self.phone_page.get_sim_services_enabled(sim=0),
1604 Eventually(Equals(False)))
1605
1606 # TODO: Test the Services page itself.
1607 def test_sim_services_sim_2(self):
1608 self.assertThat(
1609- lambda: self.phone_page.get_sim_services_enabled(sim=1),
1610+ self.phone_page.get_sim_services_enabled(sim=1),
1611 Eventually(Equals(True)))
1612 self.phone_page.go_to_sim_services(sim=1)
1613 self.main_view.go_back()
1614@@ -517,5 +517,5 @@
1615 SIM_IFACE, 'PropertyChanged', 'sv',
1616 ['ServiceNumbers', ''])
1617 self.assertThat(
1618- lambda: self.phone_page.get_sim_services_enabled(sim=1),
1619+ self.phone_page.get_sim_services_enabled(sim=1),
1620 Eventually(Equals(False)))
1621
1622=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_plugins.py'
1623--- tests/autopilot/ubuntu_system_settings/tests/test_plugins.py 2014-12-02 06:40:54 +0000
1624+++ tests/autopilot/ubuntu_system_settings/tests/test_plugins.py 2015-08-14 11:52:44 +0000
1625@@ -87,6 +87,13 @@
1626 )
1627 self.assertThat(plugin, NotEquals(None))
1628
1629+ def test_hotspot_plugin(self):
1630+ """ Checks whether the Hotspot plugin is available """
1631+ plugin = self.main_view.select_single(
1632+ objectName='entryComponent-hotspot'
1633+ )
1634+ self.assertThat(plugin, NotEquals(None))
1635+
1636 def test_background_plugin(self):
1637 """ Checks whether the Background plugin is available """
1638 plugin = self.main_view.select_single(

Subscribers

People subscribed via source and target branches

to all changes: