| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 "ConnectionState": "Connected", | 197 "ConnectionState": "Connected", |
| 198 "GUID": "stub_wifi1_guid", | 198 "GUID": "stub_wifi1_guid", |
| 199 "Name": "wifi1", | 199 "Name": "wifi1", |
| 200 "Type": "WiFi", | 200 "Type": "WiFi", |
| 201 "WiFi": { | 201 "WiFi": { |
| 202 "Security": "WEP-PSK", | 202 "Security": "WEP-PSK", |
| 203 "SignalStrength": 40 | 203 "SignalStrength": 40 |
| 204 } | 204 } |
| 205 }, | 205 }, |
| 206 { | 206 { |
| 207 "Connectable": true, |
| 208 "ConnectionState": "Connected", |
| 209 "GUID": "stub_wimax_guid", |
| 210 "Name": "wimax", |
| 211 "Type": "WiMAX", |
| 212 "WiMAX": { |
| 213 "SignalStrength": 40 |
| 214 } |
| 215 }, |
| 216 { |
| 207 "ConnectionState": "Connected", | 217 "ConnectionState": "Connected", |
| 208 "GUID": "stub_vpn1_guid", | 218 "GUID": "stub_vpn1_guid", |
| 209 "Name": "vpn1", | 219 "Name": "vpn1", |
| 210 "Type": "VPN" | 220 "Type": "VPN" |
| 211 }, | 221 }, |
| 212 { | 222 { |
| 213 "Connectable": true, | 223 "Connectable": true, |
| 214 "ConnectionState": "NotConnected", | 224 "ConnectionState": "NotConnected", |
| 215 "GUID": "stub_wifi2_guid", | 225 "GUID": "stub_wifi2_guid", |
| 216 "Name": "wifi2_PSK", | 226 "Name": "wifi2_PSK", |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 "SignalStrength": 80 | 258 "SignalStrength": 80 |
| 249 } | 259 } |
| 250 } | 260 } |
| 251 ], result); | 261 ], result); |
| 252 })); | 262 })); |
| 253 }, | 263 }, |
| 254 function requestNetworkScan() { | 264 function requestNetworkScan() { |
| 255 // Connected or Connecting networks should be listed first, sorted by type. | 265 // Connected or Connecting networks should be listed first, sorted by type. |
| 256 var expected = ["stub_ethernet_guid", | 266 var expected = ["stub_ethernet_guid", |
| 257 "stub_wifi1_guid", | 267 "stub_wifi1_guid", |
| 268 "stub_wimax_guid", |
| 258 "stub_vpn1_guid", | 269 "stub_vpn1_guid", |
| 259 "stub_wifi2_guid"]; | 270 "stub_wifi2_guid"]; |
| 260 var done = chrome.test.callbackAdded(); | 271 var done = chrome.test.callbackAdded(); |
| 261 var listener = new privateHelpers.listListener(expected, done); | 272 var listener = new privateHelpers.listListener(expected, done); |
| 262 chrome.networkingPrivate.onNetworkListChanged.addListener( | 273 chrome.networkingPrivate.onNetworkListChanged.addListener( |
| 263 listener.listenForChanges); | 274 listener.listenForChanges); |
| 264 chrome.networkingPrivate.requestNetworkScan(); | 275 chrome.networkingPrivate.requestNetworkScan(); |
| 265 }, | 276 }, |
| 266 function getProperties() { | 277 function getProperties() { |
| 267 chrome.networkingPrivate.getProperties( | 278 chrome.networkingPrivate.getProperties( |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 var expectedStates = ["NotConnected"]; | 429 var expectedStates = ["NotConnected"]; |
| 419 var listener = | 430 var listener = |
| 420 new privateHelpers.watchForStateChanges(network, expectedStates, done); | 431 new privateHelpers.watchForStateChanges(network, expectedStates, done); |
| 421 chrome.networkingPrivate.startDisconnect(network, callbackPass()); | 432 chrome.networkingPrivate.startDisconnect(network, callbackPass()); |
| 422 }, | 433 }, |
| 423 function onNetworkListChangedEvent() { | 434 function onNetworkListChangedEvent() { |
| 424 // Connecting to wifi2 should set wifi1 to offline. Connected or Connecting | 435 // Connecting to wifi2 should set wifi1 to offline. Connected or Connecting |
| 425 // networks should be listed first, sorted by type. | 436 // networks should be listed first, sorted by type. |
| 426 var expected = ["stub_ethernet_guid", | 437 var expected = ["stub_ethernet_guid", |
| 427 "stub_wifi2_guid", | 438 "stub_wifi2_guid", |
| 439 "stub_wimax_guid", |
| 428 "stub_vpn1_guid", | 440 "stub_vpn1_guid", |
| 429 "stub_wifi1_guid"]; | 441 "stub_wifi1_guid"]; |
| 430 var done = chrome.test.callbackAdded(); | 442 var done = chrome.test.callbackAdded(); |
| 431 var listener = new privateHelpers.listListener(expected, done); | 443 var listener = new privateHelpers.listListener(expected, done); |
| 432 chrome.networkingPrivate.onNetworkListChanged.addListener( | 444 chrome.networkingPrivate.onNetworkListChanged.addListener( |
| 433 listener.listenForChanges); | 445 listener.listenForChanges); |
| 434 var network = "stub_wifi2_guid"; | 446 var network = "stub_wifi2_guid"; |
| 435 chrome.networkingPrivate.startConnect(network, callbackPass()); | 447 chrome.networkingPrivate.startConnect(network, callbackPass()); |
| 436 }, | 448 }, |
| 437 function verifyDestination() { | 449 function verifyDestination() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 new privateHelpers.watchForCaptivePortalState( | 507 new privateHelpers.watchForCaptivePortalState( |
| 496 'wifi_guid', 'Online', done); | 508 'wifi_guid', 'Online', done); |
| 497 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 509 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
| 498 }, | 510 }, |
| 499 ]; | 511 ]; |
| 500 | 512 |
| 501 var testToRun = window.location.search.substring(1); | 513 var testToRun = window.location.search.substring(1); |
| 502 chrome.test.runTests(availableTests.filter(function(op) { | 514 chrome.test.runTests(availableTests.filter(function(op) { |
| 503 return op.name == testToRun; | 515 return op.name == testToRun; |
| 504 })); | 516 })); |
| OLD | NEW |