Merge lp:~jonas-drange/ubuntu-system-settings/allow-insecure-hotspot into lp:ubuntu-system-settings
- allow-insecure-hotspot
- Merge into trunk
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Ken VanDine | ||||||||||||
Approved revision: | 1527 | ||||||||||||
Merged at revision: | 1526 | ||||||||||||
Proposed branch: | lp:~jonas-drange/ubuntu-system-settings/allow-insecure-hotspot | ||||||||||||
Merge into: | lp:ubuntu-system-settings | ||||||||||||
Diff against target: |
846 lines (+421/-106) 14 files modified
debian/control (+2/-2) plugins/hotspot/CMakeLists.txt (+2/-0) plugins/hotspot/HotspotSetup.qml (+95/-42) plugins/hotspot/PageComponent.qml (+3/-10) plugins/hotspot/hotspot.settings (+2/-1) plugins/hotspot/plugin/CMakeLists.txt (+8/-0) plugins/hotspot/plugin/hotspot-plugin.cpp (+88/-0) plugins/hotspot/plugin/hotspot-plugin.h (+39/-0) tests/autopilot/ubuntu_system_settings/__init__.py (+15/-0) tests/autopilot/ubuntu_system_settings/tests/__init__.py (+70/-41) tests/autopilot/ubuntu_system_settings/tests/connectivity.py (+12/-0) tests/autopilot/ubuntu_system_settings/tests/systemimage.py (+48/-0) tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py (+22/-9) tests/autopilot/ubuntu_system_settings/tests/test_plugins.py (+15/-1) |
||||||||||||
To merge this branch: | bzr merge lp:~jonas-drange/ubuntu-system-settings/allow-insecure-hotspot | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Ken VanDine | Approve | ||
Matthew Paul Thomas (community) | Needs Fixing | ||
Pete Woods | Pending | ||
Review via email: mp+269671@code.launchpad.net |
Commit message
[hotspot] allow insecure hotspot, hide hotspot for mako, make autopilot tests run on mako, and change packaging so we get a newer Connectivity API (provided by indicator-network).
Description of the change
* Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes
* Did you build your software in a clean sbuild/pbuilder chroot or ppa?
Yes
* Did you build your software in a clean sbuild/pbuilder armhf chroot or ppa?
Yes
* Has your component "TestPlan” been executed successfully on emulator, N4?
Yes
* Has a 5 minute exploratory testing run been executed on N4?
N/A
* If you changed the packaging (debian), did you subscribe a core-dev to this MP?
Yes, and Ken VanDine is subscribed.
* If you changed the UI, did you subscribe the design-reviewers to this MP?
Yes (mpt)
* What components might get impacted by your changes?
Hotspot
* Have you requested review by the teams of these owning components?
N/A
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1517
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1518
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
The latest CI run did have a hotspot related failure:
ubuntu_
The other failures look unrelated
Matthew Paul Thomas (mpt) wrote : | # |
Thanks for this refinement!
Jonas G. Drange (jonas-drange) wrote : | # |
> The latest CI run did have a hotspot related failure:
> ubuntu_
> etup
>
> The other failures look unrelated
Right, we need a newer Connectivity API for insecure setup to work, so this is expected. I'll bump deps to make the CI fail completely.
Jonas G. Drange (jonas-drange) wrote : | # |
On 3 September 2015 at 13:18, Matthew Paul Thomas <email address hidden> wrote:
> Review: Needs Fixing
>
> …
> If you check the checkbox, the password field should be focused
> automatically.
>
Not sure I understand your comment, but I've added a note about this being
a workaround with reference to lp:1415023
> How is settingsValid() ever true when passwordRequire
>
settingsValid tests if 1) ssid is a string (not "") and 2) if the
passwordRequired checkbox is checked, it sees if the password length is >=
8.
Could you file a bug about hexadecimal passwords so we can have a
discussion about it? I want to make sure NetworkManager/
handle it before implementing it. Thanks!
As for the rest, I would love another peek at the updated diff (r1519).
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1519
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1520. By Jonas G. Drange
-
create plugin for hotspot
- 1521. By Jonas G. Drange
-
refactor test classes for re-use, refactor dynamic visibility logic
- 1522. By Jonas G. Drange
-
remove mako exceptions in setup code now that the plugin is hidden altogether
- 1523. By Jonas G. Drange
-
remove visibility exception in test objects, prune diff
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1522
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Jonas G. Drange (jonas-drange) wrote : | # |
I, very informally, measured the start up time of System Settings on mako before and after adding the dynamic visibility of the hotspot entry.
Static hotspot visibility, start up time (in seconds):
4.8
4.7
4.7
4.6
4.6
5.1
Dynamic hotspot visibility, start up time (in seconds):
4.8
4.9
5.1
5.1
4.9
4.7
A 0.1 to 0.3 seconds penalty was added.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1523
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
See inline comment
- 1524. By Jonas G. Drange
-
unnecessary comment
- 1525. By Jonas G. Drange
-
make mako comment clearer
- 1526. By Jonas G. Drange
-
remove qstringlist and qdebug include
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1526
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
There are 2 places where the strings don't match the design (not necessarily part of this MR, but lets fix it here)
HotSpotSetup.qml
- i18n.tr("Change hotspot setup") : i18n.tr("Setup hotspot")
+ i18n.tr("Change Hotspot Setup") : i18n.tr("Set Up Hotspot")
PageComponent.qml
- i18n.tr("Change password/setup…") : i18n.tr("Set up hotspot…")
+ i18n.tr("Change Password/Setup…") : i18n.tr("Set Up Hotspot…")
- 1527. By Jonas G. Drange
-
be consistent in casing and setup vs set up
Ken VanDine (ken-vandine) wrote : | # |
Thanks, looks good!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1527
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2015-08-24 07:50:13 +0000 | |||
3 | +++ debian/control 2015-09-10 15:34:03 +0000 | |||
4 | @@ -23,7 +23,7 @@ | |||
5 | 23 | libunity-api-dev, | 23 | libunity-api-dev, |
6 | 24 | libupower-glib-dev, | 24 | libupower-glib-dev, |
7 | 25 | pkg-config, | 25 | pkg-config, |
9 | 26 | qml-module-ubuntu-connectivity (>= 0.5.3), | 26 | qml-module-ubuntu-connectivity (>= 0.5.4), |
10 | 27 | qt5-default, | 27 | qt5-default, |
11 | 28 | qtbase5-dev, | 28 | qtbase5-dev, |
12 | 29 | qtdeclarative5-dev, | 29 | qtdeclarative5-dev, |
13 | @@ -71,7 +71,7 @@ | |||
14 | 71 | powerd (>= 0.15) | gnome-settings-daemon, | 71 | powerd (>= 0.15) | gnome-settings-daemon, |
15 | 72 | qmenumodel-qml, | 72 | qmenumodel-qml, |
16 | 73 | qml-module-qt-labs-folderlistmodel, | 73 | qml-module-qt-labs-folderlistmodel, |
18 | 74 | qml-module-ubuntu-connectivity (>= 0.5.3), | 74 | qml-module-ubuntu-connectivity (>= 0.5.4), |
19 | 75 | qml-module-qtmultimedia | qml-module-qtmultimedia-gles, | 75 | qml-module-qtmultimedia | qml-module-qtmultimedia-gles, |
20 | 76 | qtdeclarative5-gsettings1.0 (>=0.1+14.10.20140801.1), | 76 | qtdeclarative5-gsettings1.0 (>=0.1+14.10.20140801.1), |
21 | 77 | qtdeclarative5-ofono0.2 (>=0.70~), | 77 | qtdeclarative5-ofono0.2 (>=0.70~), |
22 | 78 | 78 | ||
23 | === modified file 'plugins/hotspot/CMakeLists.txt' | |||
24 | --- plugins/hotspot/CMakeLists.txt 2015-08-12 15:06:37 +0000 | |||
25 | +++ plugins/hotspot/CMakeLists.txt 2015-09-10 15:34:03 +0000 | |||
26 | @@ -1,3 +1,5 @@ | |||
27 | 1 | add_subdirectory(plugin) | ||
28 | 2 | |||
29 | 1 | set(QML_SOURCES | 3 | set(QML_SOURCES |
30 | 2 | Common.qml | 4 | Common.qml |
31 | 3 | HotspotSetup.qml | 5 | HotspotSetup.qml |
32 | 4 | 6 | ||
33 | === modified file 'plugins/hotspot/HotspotSetup.qml' | |||
34 | --- plugins/hotspot/HotspotSetup.qml 2015-08-17 15:35:08 +0000 | |||
35 | +++ plugins/hotspot/HotspotSetup.qml 2015-09-10 15:34:03 +0000 | |||
36 | @@ -43,11 +43,21 @@ | |||
37 | 43 | anchorToKeyboard: true | 43 | anchorToKeyboard: true |
38 | 44 | 44 | ||
39 | 45 | function settingsValid() { | 45 | function settingsValid() { |
41 | 46 | return ssidField.text != "" && passwordField.length >= 8; | 46 | var ssidValid = ssidField.text !== ""; |
42 | 47 | var passwordValid = passwordRequiredToggle.checked ? | ||
43 | 48 | passwordField.length >= 8 : true; | ||
44 | 49 | return ssidValid && passwordValid; | ||
45 | 50 | } | ||
46 | 51 | |||
47 | 52 | function updateHotspotSettings () { | ||
48 | 53 | Connectivity.hotspotSsid = ssidField.text; | ||
49 | 54 | Connectivity.hotspotPassword = passwordField.text; | ||
50 | 55 | Connectivity.hotspotAuth = passwordRequiredToggle.checked ? | ||
51 | 56 | "wpa-psk" : "none"; | ||
52 | 47 | } | 57 | } |
53 | 48 | 58 | ||
54 | 49 | title: stored ? | 59 | title: stored ? |
56 | 50 | i18n.tr("Change hotspot setup") : i18n.tr("Setup hotspot") | 60 | i18n.tr("Change Hotspot Setup") : i18n.tr("Set Up Hotspot") |
57 | 51 | text: feedback.enabled ? feedback.text : ""; | 61 | text: feedback.enabled ? feedback.text : ""; |
58 | 52 | 62 | ||
59 | 53 | Common { | 63 | Common { |
60 | @@ -70,7 +80,11 @@ | |||
61 | 70 | enabled: false | 80 | enabled: false |
62 | 71 | } | 81 | } |
63 | 72 | PropertyChanges { | 82 | PropertyChanges { |
65 | 73 | target: passwordLabel | 83 | target: passwordRequired |
66 | 84 | enabled: false | ||
67 | 85 | } | ||
68 | 86 | PropertyChanges { | ||
69 | 87 | target: passwordRequiredLabel | ||
70 | 74 | opacity: 0.5 | 88 | opacity: 0.5 |
71 | 75 | } | 89 | } |
72 | 76 | PropertyChanges { | 90 | PropertyChanges { |
73 | @@ -117,14 +131,18 @@ | |||
74 | 117 | opacity: 0.5 | 131 | opacity: 0.5 |
75 | 118 | } | 132 | } |
76 | 119 | PropertyChanges { | 133 | PropertyChanges { |
77 | 134 | target: passwordRequired | ||
78 | 135 | enabled: false | ||
79 | 136 | } | ||
80 | 137 | PropertyChanges { | ||
81 | 138 | target: passwordRequiredLabel | ||
82 | 139 | opacity: 0.5 | ||
83 | 140 | } | ||
84 | 141 | PropertyChanges { | ||
85 | 120 | target: ssidField | 142 | target: ssidField |
86 | 121 | enabled: false | 143 | enabled: false |
87 | 122 | } | 144 | } |
88 | 123 | PropertyChanges { | 145 | PropertyChanges { |
89 | 124 | target: passwordLabel | ||
90 | 125 | opacity: 0.5 | ||
91 | 126 | } | ||
92 | 127 | PropertyChanges { | ||
93 | 128 | target: passwordField | 146 | target: passwordField |
94 | 129 | enabled: false | 147 | enabled: false |
95 | 130 | } | 148 | } |
96 | @@ -132,10 +150,6 @@ | |||
97 | 132 | target: confirmButton | 150 | target: confirmButton |
98 | 133 | enabled: false | 151 | enabled: false |
99 | 134 | } | 152 | } |
100 | 135 | PropertyChanges { | ||
101 | 136 | target: enableWifiCaption | ||
102 | 137 | visible: false | ||
103 | 138 | } | ||
104 | 139 | } | 153 | } |
105 | 140 | ] | 154 | ] |
106 | 141 | 155 | ||
107 | @@ -157,8 +171,8 @@ | |||
108 | 157 | 171 | ||
109 | 158 | Label { | 172 | Label { |
110 | 159 | id: ssidLabel | 173 | id: ssidLabel |
113 | 160 | text: i18n.tr("Hotspot name") | 174 | text: hotspotSetupDialog.stored ? i18n.tr("Hotspot name") : |
114 | 161 | fontSize: "medium" | 175 | i18n.tr("Choose a name") |
115 | 162 | font.bold: true | 176 | font.bold: true |
116 | 163 | color: Theme.palette.selected.backgroundText | 177 | color: Theme.palette.selected.backgroundText |
117 | 164 | elide: Text.ElideRight | 178 | elide: Text.ElideRight |
118 | @@ -173,43 +187,78 @@ | |||
119 | 173 | width: parent.width | 187 | width: parent.width |
120 | 174 | } | 188 | } |
121 | 175 | 189 | ||
138 | 176 | Label { | 190 | ListItem.Empty { |
139 | 177 | id: passwordLabel | 191 | id: passwordRequired |
140 | 178 | // TRANSLATORS: “Password (optional)” is hidden. | 192 | onClicked: passwordRequiredToggle.trigger() |
141 | 179 | text: showAllUI ? i18n.tr("Password (optional)") : | 193 | |
142 | 180 | i18n.tr("Key (must be 8 characters or longer)") | 194 | CheckBox { |
143 | 181 | fontSize: "medium" | 195 | id: passwordRequiredToggle |
144 | 182 | font.bold: true | 196 | objectName: "passwordRequiredToggle" |
145 | 183 | color: Theme.palette.selected.backgroundText | 197 | checked: Connectivity.hotspotAuth === "wpa-psk" |
146 | 184 | wrapMode: Text.WordWrap | 198 | anchors { |
147 | 185 | width: parent.width | 199 | left: parent.left |
148 | 186 | } | 200 | verticalCenter: parent.verticalCenter |
149 | 187 | 201 | } | |
150 | 188 | Label { | 202 | // FIXME: Workaround for lp:1415023 |
151 | 189 | visible: showAllUI | 203 | activeFocusOnPress: false |
152 | 190 | // TRANSLATORS: This string is hidden. | 204 | } |
153 | 191 | text: i18n.tr("If you do not enter a password, the hotspot will be insecure.") | 205 | |
154 | 206 | Label { | ||
155 | 207 | id: passwordRequiredLabel | ||
156 | 208 | anchors { | ||
157 | 209 | left: passwordRequiredToggle.right | ||
158 | 210 | leftMargin: units.gu(1) | ||
159 | 211 | right: parent.right | ||
160 | 212 | verticalCenter: parent.verticalCenter | ||
161 | 213 | } | ||
162 | 214 | |||
163 | 215 | // FIXME: Workaround for label not wrapping (lp:1442851) | ||
164 | 216 | wrapMode: Text.Wrap | ||
165 | 217 | text: i18n.tr("Require a password (recommended):") | ||
166 | 218 | } | ||
167 | 192 | } | 219 | } |
168 | 193 | 220 | ||
169 | 194 | TextField { | 221 | TextField { |
170 | 195 | id: passwordField | 222 | id: passwordField |
171 | 196 | objectName: "passwordField" | 223 | objectName: "passwordField" |
172 | 224 | enabled: passwordRequiredToggle.checked | ||
173 | 197 | text: Connectivity.hotspotPassword | 225 | text: Connectivity.hotspotPassword |
175 | 198 | echoMode: passwordVisibleSwitch.checked ? | 226 | echoMode: passwordVisibleToggle.checked ? |
176 | 199 | TextInput.Normal : TextInput.Password | 227 | TextInput.Normal : TextInput.Password |
177 | 200 | inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | 228 | inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText |
178 | 201 | width: parent.width | 229 | width: parent.width |
179 | 202 | } | 230 | } |
180 | 203 | 231 | ||
184 | 204 | ListItem.Standard { | 232 | ListItem.Empty { |
182 | 205 | // TRANSLATORS: “Show password” is hidden. | ||
183 | 206 | text: showAllUI ? i18n.tr("Show password") : i18n.tr("Show key") | ||
185 | 207 | id: passwordVisible | 233 | id: passwordVisible |
189 | 208 | onClicked: passwordVisibleSwitch.trigger() | 234 | enabled: passwordRequiredToggle.checked |
190 | 209 | control: Switch { | 235 | onClicked: passwordVisibleToggle.trigger() |
191 | 210 | id: passwordVisibleSwitch | 236 | |
192 | 237 | CheckBox { | ||
193 | 238 | id: passwordVisibleToggle | ||
194 | 239 | enabled: parent.enabled | ||
195 | 240 | anchors { | ||
196 | 241 | left: parent.left | ||
197 | 242 | verticalCenter: parent.verticalCenter | ||
198 | 243 | } | ||
199 | 244 | |||
200 | 245 | // FIXME: Workaround for lp:1415023 | ||
201 | 211 | activeFocusOnPress: false | 246 | activeFocusOnPress: false |
202 | 212 | } | 247 | } |
203 | 248 | |||
204 | 249 | Label { | ||
205 | 250 | id: passwordVisibleLabel | ||
206 | 251 | |||
207 | 252 | /* FIXME: use enabled when lp:1491802 is fixed, or use | ||
208 | 253 | CheckBox.text once lp:1323238 is fixed. */ | ||
209 | 254 | opacity: passwordRequiredToggle.checked ? 1 : 0.5 | ||
210 | 255 | anchors { | ||
211 | 256 | left: passwordVisibleToggle.right | ||
212 | 257 | leftMargin: units.gu(1) | ||
213 | 258 | verticalCenter: parent.verticalCenter | ||
214 | 259 | } | ||
215 | 260 | text: i18n.tr("Show password") | ||
216 | 261 | } | ||
217 | 213 | } | 262 | } |
218 | 214 | 263 | ||
219 | 215 | ListItem.Caption { | 264 | ListItem.Caption { |
220 | @@ -218,8 +267,10 @@ | |||
221 | 218 | left: parent.left | 267 | left: parent.left |
222 | 219 | right: parent.right | 268 | right: parent.right |
223 | 220 | } | 269 | } |
226 | 221 | text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.") | 270 | text: i18n.tr("Starting the hotspot will turn on Wi-Fi.") |
227 | 222 | visible: !Connectivity.wifiEnabled && !hotspotSetupDialog.stored | 271 | visible: !Connectivity.wifiEnabled && |
228 | 272 | !hotspotSetupDialog.stored && | ||
229 | 273 | hotspotSetupDialog.state !== "SUCCEEDED" | ||
230 | 223 | } | 274 | } |
231 | 224 | 275 | ||
232 | 225 | Row { | 276 | Row { |
233 | @@ -235,6 +286,8 @@ | |||
234 | 235 | id: cancelButton | 286 | id: cancelButton |
235 | 236 | width: (parent.width / 2) - units.gu(1) | 287 | width: (parent.width / 2) - units.gu(1) |
236 | 237 | text: i18n.tr("Cancel") | 288 | text: i18n.tr("Cancel") |
237 | 289 | |||
238 | 290 | // FIXME: Workaround for lp:1415023 | ||
239 | 238 | activeFocusOnPress: false | 291 | activeFocusOnPress: false |
240 | 239 | onClicked: PopupUtils.close(hotspotSetupDialog) | 292 | onClicked: PopupUtils.close(hotspotSetupDialog) |
241 | 240 | } | 293 | } |
242 | @@ -246,6 +299,8 @@ | |||
243 | 246 | text: hotspotSetupDialog.stored ? i18n.tr("Change") : | 299 | text: hotspotSetupDialog.stored ? i18n.tr("Change") : |
244 | 247 | i18n.tr("Start") | 300 | i18n.tr("Start") |
245 | 248 | enabled: settingsValid() | 301 | enabled: settingsValid() |
246 | 302 | |||
247 | 303 | // FIXME: Workaround for lp:1415023 | ||
248 | 249 | activeFocusOnPress: false | 304 | activeFocusOnPress: false |
249 | 250 | onClicked: { | 305 | onClicked: { |
250 | 251 | if (!Connectivity.wifiEnabled && | 306 | if (!Connectivity.wifiEnabled && |
251 | @@ -309,8 +364,7 @@ | |||
252 | 309 | } | 364 | } |
253 | 310 | } | 365 | } |
254 | 311 | 366 | ||
257 | 312 | Connectivity.hotspotSsid = ssidField.text; | 367 | hotspotSetupDialog.updateHotspotSettings(); |
256 | 313 | Connectivity.hotspotPassword = passwordField.text; | ||
258 | 314 | Connectivity.hotspotEnabledUpdated.connect(hotspotEnabledHandler); | 368 | Connectivity.hotspotEnabledUpdated.connect(hotspotEnabledHandler); |
259 | 315 | Connectivity.hotspotEnabled = true; | 369 | Connectivity.hotspotEnabled = true; |
260 | 316 | } | 370 | } |
261 | @@ -338,8 +392,7 @@ | |||
262 | 338 | } | 392 | } |
263 | 339 | } | 393 | } |
264 | 340 | 394 | ||
267 | 341 | Connectivity.hotspotSsid = ssidField.text; | 395 | hotspotSetupDialog.updateHotspotSettings(); |
266 | 342 | Connectivity.hotspotPassword = passwordField.text; | ||
268 | 343 | 396 | ||
269 | 344 | if (Connectivity.hotspotEnabled) { | 397 | if (Connectivity.hotspotEnabled) { |
270 | 345 | hotspotSetupDialog.state = "STARTING"; | 398 | hotspotSetupDialog.state = "STARTING"; |
271 | 346 | 399 | ||
272 | === modified file 'plugins/hotspot/PageComponent.qml' | |||
273 | --- plugins/hotspot/PageComponent.qml 2015-08-17 21:41:30 +0000 | |||
274 | +++ plugins/hotspot/PageComponent.qml 2015-09-10 15:34:03 +0000 | |||
275 | @@ -25,11 +25,6 @@ | |||
276 | 25 | import Ubuntu.Components.Popups 0.1 | 25 | import Ubuntu.Components.Popups 0.1 |
277 | 26 | import Ubuntu.Connectivity 1.0 | 26 | import Ubuntu.Connectivity 1.0 |
278 | 27 | 27 | ||
279 | 28 | /* This is a temporary solution to the issue of Hotspots failing on mako. If | ||
280 | 29 | the device is mako, we hide the hotspot entry. Will be removed once lp:1434591 | ||
281 | 30 | has been resolved. */ | ||
282 | 31 | import Ubuntu.SystemSettings.Update 1.0 | ||
283 | 32 | |||
284 | 33 | ItemPage { | 28 | ItemPage { |
285 | 34 | 29 | ||
286 | 35 | id: root | 30 | id: root |
287 | @@ -40,10 +35,8 @@ | |||
288 | 40 | State { | 35 | State { |
289 | 41 | name: "disabled" | 36 | name: "disabled" |
290 | 42 | // Undefined WifiEnabled means Connectivity is unavailable. | 37 | // Undefined WifiEnabled means Connectivity is unavailable. |
295 | 43 | // Disable for mako (see lp:1434591). | 38 | when: typeof Connectivity.wifiEnabled === "undefined" || |
296 | 44 | when: (typeof Connectivity.wifiEnabled === "undefined" || | 39 | Connectivity.FlightMode |
293 | 45 | UpdateManager.deviceName === "mako") || | ||
294 | 46 | Connectivity.FlightMode | ||
297 | 47 | PropertyChanges { | 40 | PropertyChanges { |
298 | 48 | target: hotspotItem | 41 | target: hotspotItem |
299 | 49 | enabled: false | 42 | enabled: false |
300 | @@ -124,7 +117,7 @@ | |||
301 | 124 | anchors.horizontalCenter: parent.horizontalCenter | 117 | anchors.horizontalCenter: parent.horizontalCenter |
302 | 125 | width: parent.width - units.gu(4) | 118 | width: parent.width - units.gu(4) |
303 | 126 | text: Connectivity.hotspotStored ? | 119 | text: Connectivity.hotspotStored ? |
305 | 127 | i18n.tr("Change password/setup…") : i18n.tr("Set up hotspot…") | 120 | i18n.tr("Change Password/Setup…") : i18n.tr("Set Up Hotspot…") |
306 | 128 | onClicked: { | 121 | onClicked: { |
307 | 129 | setup.setSource(Qt.resolvedUrl("HotspotSetup.qml")); | 122 | setup.setSource(Qt.resolvedUrl("HotspotSetup.qml")); |
308 | 130 | PopupUtils.open(setup.item, root, {}); | 123 | PopupUtils.open(setup.item, root, {}); |
309 | 131 | 124 | ||
310 | === modified file 'plugins/hotspot/hotspot.settings' | |||
311 | --- plugins/hotspot/hotspot.settings 2015-08-12 15:06:37 +0000 | |||
312 | +++ plugins/hotspot/hotspot.settings 2015-09-10 15:34:03 +0000 | |||
313 | @@ -1,6 +1,7 @@ | |||
314 | 1 | { | 1 | { |
315 | 2 | "icon": "preferences-network-hotspot-symbolic", | 2 | "icon": "preferences-network-hotspot-symbolic", |
316 | 3 | "name": "Hotspot", | 3 | "name": "Hotspot", |
317 | 4 | "plugin": "hotspot-plugin", | ||
318 | 4 | "translations": "ubuntu-system-settings", | 5 | "translations": "ubuntu-system-settings", |
319 | 5 | "category": "network", | 6 | "category": "network", |
320 | 6 | "priority": 2, | 7 | "priority": 2, |
321 | @@ -13,6 +14,6 @@ | |||
322 | 13 | "tethering" | 14 | "tethering" |
323 | 14 | ], | 15 | ], |
324 | 15 | "has-dynamic-keywords": false, | 16 | "has-dynamic-keywords": false, |
326 | 16 | "has-dynamic-visibility": false, | 17 | "has-dynamic-visibility": true, |
327 | 17 | "page-component": "PageComponent.qml" | 18 | "page-component": "PageComponent.qml" |
328 | 18 | } | 19 | } |
329 | 19 | 20 | ||
330 | === added directory 'plugins/hotspot/plugin' | |||
331 | === added file 'plugins/hotspot/plugin/CMakeLists.txt' | |||
332 | --- plugins/hotspot/plugin/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
333 | +++ plugins/hotspot/plugin/CMakeLists.txt 2015-09-10 15:34:03 +0000 | |||
334 | @@ -0,0 +1,8 @@ | |||
335 | 1 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
336 | 2 | |||
337 | 3 | add_definitions(-DQT_NO_KEYWORDS) | ||
338 | 4 | |||
339 | 5 | add_library(hotspot-plugin SHARED hotspot-plugin.h hotspot-plugin.cpp) | ||
340 | 6 | qt5_use_modules(hotspot-plugin Core Qml DBus) | ||
341 | 7 | target_link_libraries(hotspot-plugin SystemSettings) | ||
342 | 8 | install(TARGETS hotspot-plugin DESTINATION ${PLUGIN_MODULE_DIR}) | ||
343 | 0 | 9 | ||
344 | === added file 'plugins/hotspot/plugin/hotspot-plugin.cpp' | |||
345 | --- plugins/hotspot/plugin/hotspot-plugin.cpp 1970-01-01 00:00:00 +0000 | |||
346 | +++ plugins/hotspot/plugin/hotspot-plugin.cpp 2015-09-10 15:34:03 +0000 | |||
347 | @@ -0,0 +1,88 @@ | |||
348 | 1 | /* | ||
349 | 2 | * This file is part of system-settings | ||
350 | 3 | * | ||
351 | 4 | * Copyright (C) 2015 Canonical Ltd. | ||
352 | 5 | * | ||
353 | 6 | * Contact: Jonas G. Drange <jonas.drange@canonical.com> | ||
354 | 7 | * | ||
355 | 8 | * This program is free software: you can redistribute it and/or modify it | ||
356 | 9 | * under the terms of the GNU General Public License version 3, as published | ||
357 | 10 | * by the Free Software Foundation. | ||
358 | 11 | * | ||
359 | 12 | * This program is distributed in the hope that it will be useful, but | ||
360 | 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
361 | 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
362 | 15 | * PURPOSE. See the GNU General Public License for more details. | ||
363 | 16 | * | ||
364 | 17 | * You should have received a copy of the GNU General Public License along | ||
365 | 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
366 | 19 | * | ||
367 | 20 | */ | ||
368 | 21 | |||
369 | 22 | #include "hotspot-plugin.h" | ||
370 | 23 | |||
371 | 24 | #include <QDBusInterface> | ||
372 | 25 | #include <QDBusPendingReply> | ||
373 | 26 | #include <QProcessEnvironment> | ||
374 | 27 | #include <QtDBus> | ||
375 | 28 | #include <SystemSettings/ItemBase> | ||
376 | 29 | |||
377 | 30 | using namespace SystemSettings; | ||
378 | 31 | |||
379 | 32 | typedef QMap<QString,QString> VersionDetail; | ||
380 | 33 | Q_DECLARE_METATYPE(VersionDetail) | ||
381 | 34 | |||
382 | 35 | class HotspotItem: public ItemBase | ||
383 | 36 | { | ||
384 | 37 | Q_OBJECT | ||
385 | 38 | |||
386 | 39 | public: | ||
387 | 40 | explicit HotspotItem(const QVariantMap &staticData, QObject *parent = 0); | ||
388 | 41 | void setVisibility(bool visible); | ||
389 | 42 | }; | ||
390 | 43 | |||
391 | 44 | |||
392 | 45 | HotspotItem::HotspotItem(const QVariantMap &staticData, QObject *parent): | ||
393 | 46 | ItemBase(staticData, parent) | ||
394 | 47 | { | ||
395 | 48 | qDBusRegisterMetaType<VersionDetail>(); | ||
396 | 49 | |||
397 | 50 | QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | ||
398 | 51 | if (env.contains(QLatin1String("USS_SHOW_ALL_UI"))) { | ||
399 | 52 | QString showAllS = env.value("USS_SHOW_ALL_UI", QString()); | ||
400 | 53 | |||
401 | 54 | if(!showAllS.isEmpty()) { | ||
402 | 55 | setVisibility(true); | ||
403 | 56 | return; | ||
404 | 57 | } | ||
405 | 58 | } | ||
406 | 59 | |||
407 | 60 | bool supportedDevice(true); | ||
408 | 61 | |||
409 | 62 | // TODO: Remove check for mako (lp:1434591). | ||
410 | 63 | QDBusInterface m_SystemServiceIface("com.canonical.SystemImage", | ||
411 | 64 | "/Service", | ||
412 | 65 | "com.canonical.SystemImage", | ||
413 | 66 | QDBusConnection::systemBus()); | ||
414 | 67 | QDBusPendingReply<int, QString, QString, QString, QMap<QString, QString> > reply = m_SystemServiceIface.call("Info"); | ||
415 | 68 | reply.waitForFinished(); | ||
416 | 69 | if (reply.isValid()) { | ||
417 | 70 | QString device = reply.argumentAt<1>(); | ||
418 | 71 | supportedDevice = !(device == "mako" || device == "flo"); | ||
419 | 72 | } | ||
420 | 73 | |||
421 | 74 | setVisibility(supportedDevice); | ||
422 | 75 | } | ||
423 | 76 | |||
424 | 77 | void HotspotItem::setVisibility(bool visible) | ||
425 | 78 | { | ||
426 | 79 | setVisible(visible); | ||
427 | 80 | } | ||
428 | 81 | |||
429 | 82 | ItemBase *HotspotPlugin::createItem(const QVariantMap &staticData, | ||
430 | 83 | QObject *parent) | ||
431 | 84 | { | ||
432 | 85 | return new HotspotItem(staticData, parent); | ||
433 | 86 | } | ||
434 | 87 | |||
435 | 88 | #include "hotspot-plugin.moc" | ||
436 | 0 | 89 | ||
437 | === added file 'plugins/hotspot/plugin/hotspot-plugin.h' | |||
438 | --- plugins/hotspot/plugin/hotspot-plugin.h 1970-01-01 00:00:00 +0000 | |||
439 | +++ plugins/hotspot/plugin/hotspot-plugin.h 2015-09-10 15:34:03 +0000 | |||
440 | @@ -0,0 +1,39 @@ | |||
441 | 1 | /* | ||
442 | 2 | * This file is part of system-settings | ||
443 | 3 | * | ||
444 | 4 | * Copyright (C) 2015 Canonical Ltd. | ||
445 | 5 | * | ||
446 | 6 | * Contact: Jonas G. Drange <jonas.drange@canonical.com> | ||
447 | 7 | * | ||
448 | 8 | * This program is free software: you can redistribute it and/or modify it | ||
449 | 9 | * under the terms of the GNU General Public License version 3, as published | ||
450 | 10 | * by the Free Software Foundation. | ||
451 | 11 | * | ||
452 | 12 | * This program is distributed in the hope that it will be useful, but | ||
453 | 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
454 | 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
455 | 15 | * PURPOSE. See the GNU General Public License for more details. | ||
456 | 16 | * | ||
457 | 17 | * You should have received a copy of the GNU General Public License along | ||
458 | 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
459 | 19 | * | ||
460 | 20 | */ | ||
461 | 21 | |||
462 | 22 | #ifndef SYSTEM_SETTINGS_HOTSPOT_PLUGIN_H | ||
463 | 23 | #define SYSTEM_SETTINGS_HOTSPOT_PLUGIN_H | ||
464 | 24 | |||
465 | 25 | #include <QObject> | ||
466 | 26 | #include <SystemSettings/PluginInterface> | ||
467 | 27 | |||
468 | 28 | class HotspotPlugin: public QObject, public SystemSettings::PluginInterface2 | ||
469 | 29 | { | ||
470 | 30 | Q_OBJECT | ||
471 | 31 | Q_PLUGIN_METADATA(IID "com.ubuntu.SystemSettings.PluginInterface/2.0") | ||
472 | 32 | Q_INTERFACES(SystemSettings::PluginInterface2) | ||
473 | 33 | |||
474 | 34 | public: | ||
475 | 35 | SystemSettings::ItemBase *createItem(const QVariantMap &staticData, | ||
476 | 36 | QObject *parent = 0); | ||
477 | 37 | }; | ||
478 | 38 | |||
479 | 39 | #endif // SYSTEM_SETTINGS_HOTSPOT_PLUGIN_H | ||
480 | 0 | 40 | ||
481 | === modified file 'tests/autopilot/ubuntu_system_settings/__init__.py' | |||
482 | --- tests/autopilot/ubuntu_system_settings/__init__.py 2015-08-25 14:09:22 +0000 | |||
483 | +++ tests/autopilot/ubuntu_system_settings/__init__.py 2015-09-10 15:34:03 +0000 | |||
484 | @@ -394,8 +394,11 @@ | |||
485 | 394 | if config: | 394 | if config: |
486 | 395 | if 'ssid' in config: | 395 | if 'ssid' in config: |
487 | 396 | setup.set_ssid(config['ssid']) | 396 | setup.set_ssid(config['ssid']) |
488 | 397 | if 'auth' in config: | ||
489 | 398 | setup.set_auth(config['auth']) | ||
490 | 397 | if 'password' in config: | 399 | if 'password' in config: |
491 | 398 | setup.set_password(config['password']) | 400 | setup.set_password(config['password']) |
492 | 401 | utils.dismiss_osk() | ||
493 | 399 | setup.enable() | 402 | setup.enable() |
494 | 400 | if setup: | 403 | if setup: |
495 | 401 | setup.wait_until_destroyed() | 404 | setup.wait_until_destroyed() |
496 | @@ -456,6 +459,11 @@ | |||
497 | 456 | return self.wait_select_single( | 459 | return self.wait_select_single( |
498 | 457 | 'Button', objectName='confirmButton') | 460 | 'Button', objectName='confirmButton') |
499 | 458 | 461 | ||
500 | 462 | @property | ||
501 | 463 | def _password_required_check(self): | ||
502 | 464 | return self.wait_select_single( | ||
503 | 465 | 'CheckBox', objectName='passwordRequiredToggle') | ||
504 | 466 | |||
505 | 459 | @autopilot.logging.log_action(logger.debug) | 467 | @autopilot.logging.log_action(logger.debug) |
506 | 460 | def set_ssid(self, ssid): | 468 | def set_ssid(self, ssid): |
507 | 461 | self._ssid_field.write(ssid) | 469 | self._ssid_field.write(ssid) |
508 | @@ -465,6 +473,13 @@ | |||
509 | 465 | self._password_field.write(password) | 473 | self._password_field.write(password) |
510 | 466 | 474 | ||
511 | 467 | @autopilot.logging.log_action(logger.debug) | 475 | @autopilot.logging.log_action(logger.debug) |
512 | 476 | def set_auth(self, auth): | ||
513 | 477 | if auth == 'wpa-psk': | ||
514 | 478 | self._password_required_check.check() | ||
515 | 479 | else: | ||
516 | 480 | self._password_required_check.uncheck() | ||
517 | 481 | |||
518 | 482 | @autopilot.logging.log_action(logger.debug) | ||
519 | 468 | def enable(self): | 483 | def enable(self): |
520 | 469 | self.pointing_device.click_object(self._enable_button) | 484 | self.pointing_device.click_object(self._enable_button) |
521 | 470 | 485 | ||
522 | 471 | 486 | ||
523 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py' | |||
524 | --- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-08-06 20:05:56 +0000 | |||
525 | +++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-09-10 15:34:03 +0000 | |||
526 | @@ -173,6 +173,75 @@ | |||
527 | 173 | self.add_mock_battery() | 173 | self.add_mock_battery() |
528 | 174 | 174 | ||
529 | 175 | 175 | ||
530 | 176 | class UbuntuSystemSettingsHotspotTestCase(UbuntuSystemSettingsTestCase, | ||
531 | 177 | dbusmock.DBusTestCase): | ||
532 | 178 | """Base class for tests that tests the hotspot functionality.""" | ||
533 | 179 | connectivity_parameters = {} | ||
534 | 180 | indicatornetwork_parameters = {} | ||
535 | 181 | systemimage_parameters = {'device': 'ideal'} | ||
536 | 182 | |||
537 | 183 | @classmethod | ||
538 | 184 | def setUpClass(cls): | ||
539 | 185 | cls.session_con = cls.get_dbus(False) | ||
540 | 186 | |||
541 | 187 | cls.start_system_bus() | ||
542 | 188 | |||
543 | 189 | si_tmpl = os.path.join(os.path.dirname(__file__), 'systemimage.py') | ||
544 | 190 | (cls.si_mock, cls.si_obj) = cls.spawn_server_template( | ||
545 | 191 | si_tmpl, parameters=cls.systemimage_parameters, | ||
546 | 192 | stdout=subprocess.PIPE) | ||
547 | 193 | |||
548 | 194 | super(UbuntuSystemSettingsHotspotTestCase, cls).setUpClass() | ||
549 | 195 | |||
550 | 196 | def setUp(self): | ||
551 | 197 | if is_process_running(INDICATOR_NETWORK): | ||
552 | 198 | _stop_process(INDICATOR_NETWORK) | ||
553 | 199 | self.addCleanup(_start_process, INDICATOR_NETWORK) | ||
554 | 200 | |||
555 | 201 | ctv_tmpl = os.path.join(os.path.dirname(__file__), 'connectivity.py') | ||
556 | 202 | (self.ctv_mock, self.obj_ctv) = self.spawn_server_template( | ||
557 | 203 | ctv_tmpl, parameters=self.connectivity_parameters, | ||
558 | 204 | stdout=subprocess.PIPE) | ||
559 | 205 | |||
560 | 206 | self.ctv_private = dbus.Interface( | ||
561 | 207 | self.session_con.get_object(CTV_IFACE, CTV_PRIV_OBJ), | ||
562 | 208 | 'org.freedesktop.DBus.Properties') | ||
563 | 209 | |||
564 | 210 | self.ctv_nets = dbus.Interface( | ||
565 | 211 | self.session_con.get_object(CTV_IFACE, CTV_NETS_OBJ), | ||
566 | 212 | 'org.freedesktop.DBus.Properties') | ||
567 | 213 | |||
568 | 214 | inetwork = os.path.join( | ||
569 | 215 | os.path.dirname(__file__), 'indicatornetwork.py' | ||
570 | 216 | ) | ||
571 | 217 | (self.inetwork_mock, self.obj_inetwork) = self.spawn_server_template( | ||
572 | 218 | inetwork, parameters=self.indicatornetwork_parameters, | ||
573 | 219 | stdout=subprocess.PIPE) | ||
574 | 220 | |||
575 | 221 | super(UbuntuSystemSettingsHotspotTestCase, self).setUp() | ||
576 | 222 | |||
577 | 223 | def tearDown(self): | ||
578 | 224 | self.ctv_mock.terminate() | ||
579 | 225 | self.ctv_mock.wait() | ||
580 | 226 | self.inetwork_mock.terminate() | ||
581 | 227 | self.inetwork_mock.wait() | ||
582 | 228 | super(UbuntuSystemSettingsHotspotTestCase, self).tearDown() | ||
583 | 229 | |||
584 | 230 | @classmethod | ||
585 | 231 | def tearDownClass(cls): | ||
586 | 232 | cls.si_mock.terminate() | ||
587 | 233 | cls.si_mock.wait() | ||
588 | 234 | if dbusmock.DBusTestCase.system_bus_pid is not None: | ||
589 | 235 | cls.stop_dbus(dbusmock.DBusTestCase.system_bus_pid) | ||
590 | 236 | del os.environ['DBUS_SYSTEM_BUS_ADDRESS'] | ||
591 | 237 | dbusmock.DBusTestCase.system_bus_pid = None | ||
592 | 238 | if dbusmock.DBusTestCase.session_bus_pid is not None: | ||
593 | 239 | cls.stop_dbus(dbusmock.DBusTestCase.session_bus_pid) | ||
594 | 240 | del os.environ['DBUS_SESSION_BUS_ADDRESS'] | ||
595 | 241 | dbusmock.DBusTestCase.session_bus_pid = None | ||
596 | 242 | super(UbuntuSystemSettingsHotspotTestCase, cls).tearDownClass() | ||
597 | 243 | |||
598 | 244 | |||
599 | 176 | class UbuntuSystemSettingsOfonoTestCase(UbuntuSystemSettingsTestCase, | 245 | class UbuntuSystemSettingsOfonoTestCase(UbuntuSystemSettingsTestCase, |
600 | 177 | dbusmock.DBusTestCase): | 246 | dbusmock.DBusTestCase): |
601 | 178 | """Class for cellular tests which sets up an Ofono mock """ | 247 | """Class for cellular tests which sets up an Ofono mock """ |
602 | @@ -395,52 +464,12 @@ | |||
603 | 395 | context.SetProperty(key, value) | 464 | context.SetProperty(key, value) |
604 | 396 | 465 | ||
605 | 397 | 466 | ||
616 | 398 | class HotspotBaseTestCase(UbuntuSystemSettingsTestCase, | 467 | class HotspotBaseTestCase(UbuntuSystemSettingsHotspotTestCase): |
607 | 399 | dbusmock.DBusTestCase): | ||
608 | 400 | |||
609 | 401 | connectivity_parameters = {} | ||
610 | 402 | indicatornetwork_parameters = {} | ||
611 | 403 | |||
612 | 404 | @classmethod | ||
613 | 405 | def setUpClass(cls): | ||
614 | 406 | cls.session_con = cls.get_dbus(False) | ||
615 | 407 | super(HotspotBaseTestCase, cls).setUpClass() | ||
617 | 408 | 468 | ||
618 | 409 | def setUp(self): | 469 | def setUp(self): |
619 | 410 | if is_process_running(INDICATOR_NETWORK): | ||
620 | 411 | _stop_process(INDICATOR_NETWORK) | ||
621 | 412 | self.addCleanup(_start_process, INDICATOR_NETWORK) | ||
622 | 413 | |||
623 | 414 | ctv_tmpl = os.path.join(os.path.dirname(__file__), 'connectivity.py') | ||
624 | 415 | (self.ctv_mock, self.obj_ctv) = self.spawn_server_template( | ||
625 | 416 | ctv_tmpl, parameters=self.connectivity_parameters, | ||
626 | 417 | stdout=subprocess.PIPE) | ||
627 | 418 | |||
628 | 419 | self.ctv_private = dbus.Interface( | ||
629 | 420 | self.session_con.get_object(CTV_IFACE, CTV_PRIV_OBJ), | ||
630 | 421 | 'org.freedesktop.DBus.Properties') | ||
631 | 422 | |||
632 | 423 | self.ctv_nets = dbus.Interface( | ||
633 | 424 | self.session_con.get_object(CTV_IFACE, CTV_NETS_OBJ), | ||
634 | 425 | 'org.freedesktop.DBus.Properties') | ||
635 | 426 | |||
636 | 427 | inetwork = os.path.join( | ||
637 | 428 | os.path.dirname(__file__), 'indicatornetwork.py' | ||
638 | 429 | ) | ||
639 | 430 | (self.inetwork_mock, self.obj_inetwork) = self.spawn_server_template( | ||
640 | 431 | inetwork, parameters=self.indicatornetwork_parameters, | ||
641 | 432 | stdout=subprocess.PIPE) | ||
642 | 433 | |||
643 | 434 | super(HotspotBaseTestCase, self).setUp() | 470 | super(HotspotBaseTestCase, self).setUp() |
644 | 435 | self.hotspot_page = self.main_view.go_to_hotspot_page() | 471 | self.hotspot_page = self.main_view.go_to_hotspot_page() |
645 | 436 | 472 | ||
646 | 437 | def tearDown(self): | ||
647 | 438 | self.ctv_mock.terminate() | ||
648 | 439 | self.ctv_mock.wait() | ||
649 | 440 | self.inetwork_mock.terminate() | ||
650 | 441 | self.inetwork_mock.wait() | ||
651 | 442 | super(HotspotBaseTestCase, self).tearDown() | ||
652 | 443 | |||
653 | 444 | 473 | ||
654 | 445 | class BluetoothBaseTestCase(UbuntuSystemSettingsTestCase): | 474 | class BluetoothBaseTestCase(UbuntuSystemSettingsTestCase): |
655 | 446 | 475 | ||
656 | 447 | 476 | ||
657 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/connectivity.py' | |||
658 | --- tests/autopilot/ubuntu_system_settings/tests/connectivity.py 2015-08-17 15:35:08 +0000 | |||
659 | +++ tests/autopilot/ubuntu_system_settings/tests/connectivity.py 2015-09-10 15:34:03 +0000 | |||
660 | @@ -47,6 +47,10 @@ | |||
661 | 47 | self.SetProperty(PRIV_OBJ, PRIV_IFACE, 'HotspotPassword', value) | 47 | self.SetProperty(PRIV_OBJ, PRIV_IFACE, 'HotspotPassword', value) |
662 | 48 | 48 | ||
663 | 49 | 49 | ||
664 | 50 | def set_hotspot_auth(self, value): | ||
665 | 51 | self.SetProperty(PRIV_OBJ, PRIV_IFACE, 'HotspotAuth', value) | ||
666 | 52 | |||
667 | 53 | |||
668 | 50 | def set_wifi_enabled(self, value): | 54 | def set_wifi_enabled(self, value): |
669 | 51 | self.SetProperty(NETS_OBJ, NETS_IFACE, 'WifiEnabled', value) | 55 | self.SetProperty(NETS_OBJ, NETS_IFACE, 'WifiEnabled', value) |
670 | 52 | 56 | ||
671 | @@ -59,6 +63,7 @@ | |||
672 | 59 | mock.set_hotspot_ssid = set_hotspot_ssid | 63 | mock.set_hotspot_ssid = set_hotspot_ssid |
673 | 60 | mock.set_hotspot_password = set_hotspot_password | 64 | mock.set_hotspot_password = set_hotspot_password |
674 | 61 | mock.set_wifi_enabled = set_wifi_enabled | 65 | mock.set_wifi_enabled = set_wifi_enabled |
675 | 66 | mock.set_hotspot_auth = set_hotspot_auth | ||
676 | 62 | 67 | ||
677 | 63 | mock.AddObject( | 68 | mock.AddObject( |
678 | 64 | NETS_OBJ, | 69 | NETS_OBJ, |
679 | @@ -95,6 +100,9 @@ | |||
680 | 95 | { | 100 | { |
681 | 96 | 'HotspotPassword': _parameters.get( | 101 | 'HotspotPassword': _parameters.get( |
682 | 97 | 'HotspotPassword', dbus.String('abcdefgh') | 102 | 'HotspotPassword', dbus.String('abcdefgh') |
683 | 103 | ), | ||
684 | 104 | 'HotspotAuth': _parameters.get( | ||
685 | 105 | 'HotspotAuth', dbus.String('wpa-psk') | ||
686 | 98 | ) | 106 | ) |
687 | 99 | }, | 107 | }, |
688 | 100 | [ | 108 | [ |
689 | @@ -123,6 +131,10 @@ | |||
690 | 123 | 'objects["/"].set_hotspot_password(self, args[0])' | 131 | 'objects["/"].set_hotspot_password(self, args[0])' |
691 | 124 | ), | 132 | ), |
692 | 125 | ( | 133 | ( |
693 | 134 | 'SetHotspotAuth', 's', '', | ||
694 | 135 | 'objects["/"].set_hotspot_auth(self, args[0])' | ||
695 | 136 | ), | ||
696 | 137 | ( | ||
697 | 126 | 'SetHotspotEnabled', 'b', '', | 138 | 'SetHotspotEnabled', 'b', '', |
698 | 127 | 'objects["/"].set_hotspot_enabled(self, args[0])' | 139 | 'objects["/"].set_hotspot_enabled(self, args[0])' |
699 | 128 | ), | 140 | ), |
700 | 129 | 141 | ||
701 | === added file 'tests/autopilot/ubuntu_system_settings/tests/systemimage.py' | |||
702 | --- tests/autopilot/ubuntu_system_settings/tests/systemimage.py 1970-01-01 00:00:00 +0000 | |||
703 | +++ tests/autopilot/ubuntu_system_settings/tests/systemimage.py 2015-09-10 15:34:03 +0000 | |||
704 | @@ -0,0 +1,48 @@ | |||
705 | 1 | '''system image D-BUS mock template''' | ||
706 | 2 | |||
707 | 3 | # This program is free software; you can redistribute it and/or modify it under | ||
708 | 4 | # the terms of the GNU Lesser General Public License as published by the Free | ||
709 | 5 | # Software Foundation; either version 3 of the License, or (at your option) any | ||
710 | 6 | # later version. See http://www.gnu.org/copyleft/lgpl.html for the full text | ||
711 | 7 | # of the license. | ||
712 | 8 | import dbus | ||
713 | 9 | |||
714 | 10 | __author__ = 'Jonas G. Drange' | ||
715 | 11 | __email__ = 'jonas.drange@canonical.com' | ||
716 | 12 | __copyright__ = '(c) 2015 Canonical Ltd.' | ||
717 | 13 | __license__ = 'LGPL 3+' | ||
718 | 14 | |||
719 | 15 | BUS_NAME = 'com.canonical.SystemImage' | ||
720 | 16 | MAIN_IFACE = 'com.canonical.SystemImage' | ||
721 | 17 | MAIN_OBJ = '/Service' | ||
722 | 18 | SYSTEM_BUS = True | ||
723 | 19 | |||
724 | 20 | |||
725 | 21 | def load(mock, parameters): | ||
726 | 22 | global _parameters | ||
727 | 23 | _parameters = parameters | ||
728 | 24 | |||
729 | 25 | mock.props = { | ||
730 | 26 | 'build_number': _parameters.get('build_number', 0), | ||
731 | 27 | 'device': _parameters.get('device', ''), | ||
732 | 28 | 'channel': _parameters.get('channel', ''), | ||
733 | 29 | 'last_update_date': _parameters.get('last_update_date', ''), | ||
734 | 30 | 'last_check_date': _parameters.get('last_check_date', ''), | ||
735 | 31 | 'target_build_number': _parameters.get('target_build_number', -1), | ||
736 | 32 | 'target_version_detail': _parameters.get('target_version_detail', ''), | ||
737 | 33 | 'version_detail': _parameters.get( | ||
738 | 34 | 'version_detail', dbus.Dictionary({}, signature='ss') | ||
739 | 35 | ) | ||
740 | 36 | } | ||
741 | 37 | |||
742 | 38 | |||
743 | 39 | @dbus.service.method(MAIN_IFACE, | ||
744 | 40 | in_signature='', out_signature='isssa{ss}') | ||
745 | 41 | def Info(self): | ||
746 | 42 | return ( | ||
747 | 43 | self.props['build_number'], | ||
748 | 44 | self.props['device'], | ||
749 | 45 | self.props['channel'], | ||
750 | 46 | self.props['last_update_date'], | ||
751 | 47 | self.props['version_detail'] | ||
752 | 48 | ) | ||
753 | 0 | 49 | ||
754 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py' | |||
755 | --- tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py 2015-08-17 15:35:08 +0000 | |||
756 | +++ tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py 2015-09-10 15:34:03 +0000 | |||
757 | @@ -56,6 +56,26 @@ | |||
758 | 56 | Eventually(Equals(True)) | 56 | Eventually(Equals(True)) |
759 | 57 | ) | 57 | ) |
760 | 58 | 58 | ||
761 | 59 | def test_insecure_setup(self): | ||
762 | 60 | ssid = 'bar' | ||
763 | 61 | auth = 'none' | ||
764 | 62 | config = {'ssid': ssid, 'auth': auth} | ||
765 | 63 | |||
766 | 64 | self.hotspot_page.setup_hotspot(config) | ||
767 | 65 | |||
768 | 66 | # Assert that the switch is on. | ||
769 | 67 | self.assertTrue(self.hotspot_page.get_hotspot_status()) | ||
770 | 68 | |||
771 | 69 | self.assertThat( | ||
772 | 70 | lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotAuth'), | ||
773 | 71 | Eventually(Equals(auth)) | ||
774 | 72 | ) | ||
775 | 73 | |||
776 | 74 | self.assertThat( | ||
777 | 75 | lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'), | ||
778 | 76 | Eventually(Equals(True)) | ||
779 | 77 | ) | ||
780 | 78 | |||
781 | 59 | 79 | ||
782 | 60 | class HotspotExistsTestCase(HotspotBaseTestCase): | 80 | class HotspotExistsTestCase(HotspotBaseTestCase): |
783 | 61 | 81 | ||
784 | @@ -80,8 +100,7 @@ | |||
785 | 80 | 100 | ||
786 | 81 | def test_changing(self): | 101 | def test_changing(self): |
787 | 82 | ssid = 'bar' | 102 | ssid = 'bar' |
790 | 83 | password = 'zomgzomg' | 103 | config = {'ssid': ssid} |
789 | 84 | config = {'ssid': ssid, 'password': password} | ||
791 | 85 | self.hotspot_page.setup_hotspot(config) | 104 | self.hotspot_page.setup_hotspot(config) |
792 | 86 | 105 | ||
793 | 87 | self.assertThat( | 106 | self.assertThat( |
794 | @@ -91,11 +110,6 @@ | |||
795 | 91 | Eventually(Equals(ssid)) | 110 | Eventually(Equals(ssid)) |
796 | 92 | ) | 111 | ) |
797 | 93 | 112 | ||
798 | 94 | self.assertThat( | ||
799 | 95 | lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'), | ||
800 | 96 | Eventually(Equals(password)) | ||
801 | 97 | ) | ||
802 | 98 | |||
803 | 99 | 113 | ||
804 | 100 | class HotspotRunningTestCase(HotspotBaseTestCase): | 114 | class HotspotRunningTestCase(HotspotBaseTestCase): |
805 | 101 | 115 | ||
806 | @@ -166,8 +180,7 @@ | |||
807 | 166 | 180 | ||
808 | 167 | def test_setup(self): | 181 | def test_setup(self): |
809 | 168 | ssid = 'bar' | 182 | ssid = 'bar' |
812 | 169 | password = 'zomgzomg' | 183 | config = {'ssid': ssid} |
811 | 170 | config = {'ssid': ssid, 'password': password} | ||
813 | 171 | 184 | ||
814 | 172 | self.assertThat( | 185 | self.assertThat( |
815 | 173 | lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'), | 186 | lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'), |
816 | 174 | 187 | ||
817 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_plugins.py' | |||
818 | --- tests/autopilot/ubuntu_system_settings/tests/test_plugins.py 2015-08-13 13:31:31 +0000 | |||
819 | +++ tests/autopilot/ubuntu_system_settings/tests/test_plugins.py 2015-09-10 15:34:03 +0000 | |||
820 | @@ -12,7 +12,8 @@ | |||
821 | 12 | from ubuntu_system_settings.tests import ( | 12 | from ubuntu_system_settings.tests import ( |
822 | 13 | UbuntuSystemSettingsTestCase, | 13 | UbuntuSystemSettingsTestCase, |
823 | 14 | UbuntuSystemSettingsUpowerTestCase, | 14 | UbuntuSystemSettingsUpowerTestCase, |
825 | 15 | UbuntuSystemSettingsBatteryTestCase | 15 | UbuntuSystemSettingsBatteryTestCase, |
826 | 16 | UbuntuSystemSettingsHotspotTestCase | ||
827 | 16 | ) | 17 | ) |
828 | 17 | from ubuntu_system_settings.utils.i18n import ugettext as _ | 18 | from ubuntu_system_settings.utils.i18n import ugettext as _ |
829 | 18 | 19 | ||
830 | @@ -175,3 +176,16 @@ | |||
831 | 175 | objectName='entryComponent-battery' | 176 | objectName='entryComponent-battery' |
832 | 176 | ) | 177 | ) |
833 | 177 | self.assertThat(plugin, NotEquals(None)) | 178 | self.assertThat(plugin, NotEquals(None)) |
834 | 179 | |||
835 | 180 | |||
836 | 181 | class SystemSettingsHotspotTestCases(UbuntuSystemSettingsHotspotTestCase): | ||
837 | 182 | systemimage_parameters = {'device': 'mako'} | ||
838 | 183 | |||
839 | 184 | # TODO: remove once lp:1434591 has been resolved. | ||
840 | 185 | def test_hotspot_plugin(self): | ||
841 | 186 | """ Checks that the Hotspot plugin is not available | ||
842 | 187 | as it is broken on mako.""" | ||
843 | 188 | self.assertThat(lambda: self.main_view.select_single( | ||
844 | 189 | objectName='entryComponent-hotspot'), | ||
845 | 190 | raises(StateNotFoundError) | ||
846 | 191 | ) |
FAILED: Continuous integration, rev:1515 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/2379/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 3934 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- vivid-amd64- ci/154 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- vivid-i386- ci/563 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- vivid-mako/ 3220 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 3931 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 3931/artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 22965
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/2379/ rebuild
http://