OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var callbackPass = chrome.test.callbackPass; | 5 var callbackPass = chrome.test.callbackPass; |
6 var callbackFail = chrome.test.callbackFail; | 6 var callbackFail = chrome.test.callbackFail; |
7 var assertTrue = chrome.test.assertTrue; | 7 var assertTrue = chrome.test.assertTrue; |
8 var assertFalse = chrome.test.assertFalse; | 8 var assertFalse = chrome.test.assertFalse; |
9 var assertEq = chrome.test.assertEq; | 9 var assertEq = chrome.test.assertEq; |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 chrome.networkingPrivate.getProperties( | 114 chrome.networkingPrivate.getProperties( |
115 guid, | 115 guid, |
116 callbackPass(function(properties) { | 116 callbackPass(function(properties) { |
117 assertEq("WiFi", properties.Type); | 117 assertEq("WiFi", properties.Type); |
118 assertEq(guid, properties.GUID); | 118 assertEq(guid, properties.GUID); |
119 assertEq("wifi_created", properties.WiFi.SSID); | 119 assertEq("wifi_created", properties.WiFi.SSID); |
120 assertEq("WEP-PSK", properties.WiFi.Security); | 120 assertEq("WEP-PSK", properties.WiFi.Security); |
121 })); | 121 })); |
122 })); | 122 })); |
123 }, | 123 }, |
124 function getNetworks() { | |
125 // Test 'type' and 'configured'. | |
pneubeck (no reviews)
2014/05/15 18:28:37
testing 'visible: true' too?
stevenjb
2014/05/15 20:12:41
Hmm, we're not actually testing that and should, I
| |
126 chrome.networkingPrivate.getNetworks( | |
127 { "type": "WiFi", "visible": false, "configured": true }, | |
128 callbackPass(function(result) { | |
129 assertEq([{ | |
130 "Connectable": true, | |
131 "ConnectionState": "Connected", | |
pneubeck (no reviews)
2014/05/15 18:28:37
if such network states are common over several tes
stevenjb
2014/05/15 20:12:41
If I did that I'd want to move the entire default
| |
132 "GUID": "stub_wifi1", | |
133 "Name": "wifi1", | |
134 "Type": "WiFi", | |
135 "WiFi": { | |
136 "Security": "WEP-PSK", | |
137 "SignalStrength": 40 | |
138 } | |
139 }, { | |
140 "Connectable": true, | |
141 "ConnectionState": "NotConnected", | |
142 "GUID": "stub_wifi2", | |
143 "Name": "wifi2_PSK", | |
144 "Type": "WiFi", | |
145 "WiFi": { | |
146 "Security": "WPA-PSK", | |
147 "SignalStrength": 80 | |
148 } | |
149 }], result); | |
150 // Test 'limit'. | |
151 chrome.networkingPrivate.getNetworks( | |
152 { "type": "All", "visible": false, "configured": true, "limit": 1 }, | |
153 callbackPass(function(result) { | |
154 assertEq([{ | |
155 "ConnectionState": "Connected", | |
156 "Ethernet": { | |
157 "Authentication": "None" | |
158 }, | |
159 "GUID": "stub_ethernet", | |
160 "Name": "eth0", | |
161 "Type": "Ethernet" | |
162 }], result); | |
163 })); | |
164 })); | |
165 }, | |
124 function getVisibleNetworks() { | 166 function getVisibleNetworks() { |
125 chrome.networkingPrivate.getVisibleNetworks( | 167 chrome.networkingPrivate.getVisibleNetworks( |
126 "All", | 168 "All", |
127 callbackPass(function(result) { | 169 callbackPass(function(result) { |
128 assertEq([{ | 170 assertEq([{ |
129 "ConnectionState": "Connected", | 171 "ConnectionState": "Connected", |
130 "Ethernet": { | 172 "Ethernet": { |
131 "Authentication": "None" | 173 "Authentication": "None" |
132 }, | 174 }, |
133 "GUID": "stub_ethernet", | 175 "GUID": "stub_ethernet", |
134 "Name": "eth0", | 176 "Name": "eth0", |
135 "Type": "Ethernet" | 177 "Type": "Ethernet" |
136 }, | 178 }, |
137 { | 179 { |
138 "Connectable": true, | 180 "Connectable": true, |
139 "ConnectionState": "Connected", | 181 "ConnectionState": "Connected", |
140 "GUID": "stub_wifi1", | 182 "GUID": "stub_wifi1", |
141 "Name": "wifi1", | 183 "Name": "wifi1", |
142 "Type": "WiFi", | 184 "Type": "WiFi", |
143 "WiFi": { | 185 "WiFi": { |
144 "Security": "WEP-PSK", | 186 "Security": "WEP-PSK", |
145 "SignalStrength": 40 | 187 "SignalStrength": 40 |
146 } | 188 } |
147 }, | 189 }, |
148 { | 190 { |
149 "ConnectionState": "Connected", | 191 "ConnectionState": "Connected", |
150 "GUID": "stub_vpn1", | 192 "GUID": "stub_vpn1", |
151 "Name": "vpn1", | 193 "Name": "vpn1", |
152 "Type": "VPN", | 194 "Type": "VPN" |
153 }, | 195 }, |
154 { | 196 { |
155 "Connectable": true, | 197 "Connectable": true, |
156 "ConnectionState": "NotConnected", | 198 "ConnectionState": "NotConnected", |
157 "GUID": "stub_wifi2", | 199 "GUID": "stub_wifi2", |
158 "Name": "wifi2_PSK", | 200 "Name": "wifi2_PSK", |
159 "Type": "WiFi", | 201 "Type": "WiFi", |
160 "WiFi": { | 202 "WiFi": { |
161 "Security": "WPA-PSK", | 203 "Security": "WPA-PSK", |
162 "SignalStrength": 80 | 204 "SignalStrength": 80 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 "Effective": "Unmanaged" | 333 "Effective": "Unmanaged" |
292 } | 334 } |
293 } | 335 } |
294 }, result); | 336 }, result); |
295 })); | 337 })); |
296 }, | 338 }, |
297 function setProperties() { | 339 function setProperties() { |
298 var done = chrome.test.callbackAdded(); | 340 var done = chrome.test.callbackAdded(); |
299 var network_guid = "stub_wifi2"; | 341 var network_guid = "stub_wifi2"; |
300 chrome.networkingPrivate.getProperties( | 342 chrome.networkingPrivate.getProperties( |
301 network_guid, | 343 network_guid, |
302 callbackPass(function(result) { | 344 callbackPass(function(result) { |
303 assertEq(network_guid, result.GUID); | 345 assertEq(network_guid, result.GUID); |
304 result.WiFi.Security = "WEP-PSK"; | 346 result.WiFi.Security = "WEP-PSK"; |
305 chrome.networkingPrivate.setProperties("stub_wifi2", result, | 347 chrome.networkingPrivate.setProperties( |
306 callbackPass(function() { | 348 network_guid, |
307 chrome.networkingPrivate.getProperties( | 349 result, |
308 "stub_wifi2", | 350 callbackPass(function() { |
309 callbackPass(function(result) { | 351 chrome.networkingPrivate.getProperties( |
310 // Ensure that the property was set. | 352 network_guid, |
311 assertEq("WEP-PSK", result.WiFi.Security); | 353 callbackPass(function(result) { |
312 // Ensure that the GUID doesn't change. | 354 // Ensure that the property was set. |
313 assertEq(network_guid, result.GUID); | 355 assertEq("WEP-PSK", result.WiFi.Security); |
314 done(); | 356 // Ensure that the GUID doesn't change. |
357 assertEq(network_guid, result.GUID); | |
358 done(); | |
359 })); | |
315 })); | 360 })); |
316 })); | 361 })); |
317 })); | |
318 }, | 362 }, |
319 function getState() { | 363 function getState() { |
320 chrome.networkingPrivate.getState( | 364 chrome.networkingPrivate.getState( |
321 "stub_wifi2", | 365 "stub_wifi2", |
322 callbackPass(function(result) { | 366 callbackPass(function(result) { |
323 assertEq({ | 367 assertEq({ |
324 "Connectable": true, | 368 "Connectable": true, |
325 "ConnectionState": "NotConnected", | 369 "ConnectionState": "NotConnected", |
326 "GUID": "stub_wifi2", | 370 "GUID": "stub_wifi2", |
327 "Name": "wifi2_PSK", | 371 "Name": "wifi2_PSK", |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 var listener = | 472 var listener = |
429 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done); | 473 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done); |
430 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 474 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
431 }, | 475 }, |
432 ]; | 476 ]; |
433 | 477 |
434 var testToRun = window.location.search.substring(1); | 478 var testToRun = window.location.search.substring(1); |
435 chrome.test.runTests(availableTests.filter(function(op) { | 479 chrome.test.runTests(availableTests.filter(function(op) { |
436 return op.name == testToRun; | 480 return op.name == testToRun; |
437 })); | 481 })); |
OLD | NEW |