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 assertEq = chrome.test.assertEq; | 8 var assertEq = chrome.test.assertEq; |
9 | 9 |
10 // Test properties for the verification API. | 10 // Test properties for the verification API. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 done(); | 53 done(); |
54 }; | 54 }; |
55 } | 55 } |
56 }; | 56 }; |
57 | 57 |
58 var availableTests = [ | 58 var availableTests = [ |
59 function startConnect() { | 59 function startConnect() { |
60 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass()); | 60 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass()); |
61 }, | 61 }, |
62 function startDisconnect() { | 62 function startDisconnect() { |
63 chrome.networkingPrivate.startDisconnect("stub_wifi2", callbackPass()); | 63 // Must connect to a network before we can disconnect from it. |
| 64 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass( |
| 65 function() { |
| 66 chrome.networkingPrivate.startDisconnect("stub_wifi2", callbackPass()); |
| 67 })); |
64 }, | 68 }, |
65 function startConnectNonexistent() { | 69 function startConnectNonexistent() { |
66 chrome.networkingPrivate.startConnect( | 70 chrome.networkingPrivate.startConnect( |
67 "nonexistent_path", | 71 "nonexistent_path", |
68 callbackFail("Error.InvalidService")); | 72 callbackFail("not-found")); |
69 }, | 73 }, |
70 function startDisconnectNonexistent() { | 74 function startDisconnectNonexistent() { |
71 chrome.networkingPrivate.startDisconnect( | 75 chrome.networkingPrivate.startDisconnect( |
72 "nonexistent_path", | 76 "nonexistent_path", |
73 callbackFail("Error.InvalidService")); | 77 callbackFail("not-found")); |
74 }, | 78 }, |
75 function startGetPropertiesNonexistent() { | 79 function startGetPropertiesNonexistent() { |
76 chrome.networkingPrivate.getProperties( | 80 chrome.networkingPrivate.getProperties( |
77 "nonexistent_path", | 81 "nonexistent_path", |
78 callbackFail("Error.DBusFailed")); | 82 callbackFail("Error.DBusFailed")); |
79 }, | 83 }, |
80 function getVisibleNetworks() { | 84 function getVisibleNetworks() { |
81 chrome.networkingPrivate.getVisibleNetworks( | 85 chrome.networkingPrivate.getVisibleNetworks( |
82 "All", | 86 "All", |
83 callbackPass(function(result) { | 87 callbackPass(function(result) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 "AutoConnect": false, | 273 "AutoConnect": false, |
270 "Security": "WPA-PSK", | 274 "Security": "WPA-PSK", |
271 "SignalStrength": 80 | 275 "SignalStrength": 80 |
272 } | 276 } |
273 }, result); | 277 }, result); |
274 })); | 278 })); |
275 }, | 279 }, |
276 function onNetworksChangedEventConnect() { | 280 function onNetworksChangedEventConnect() { |
277 var network = "stub_wifi2"; | 281 var network = "stub_wifi2"; |
278 var done = chrome.test.callbackAdded(); | 282 var done = chrome.test.callbackAdded(); |
279 var expectedStates = ["Connected", "Connecting"]; | 283 var expectedStates = ["Connected"]; |
280 var listener = | 284 var listener = |
281 new privateHelpers.watchForStateChanges(network, expectedStates, done); | 285 new privateHelpers.watchForStateChanges(network, expectedStates, done); |
282 chrome.networkingPrivate.startConnect(network, callbackPass()); | 286 chrome.networkingPrivate.startConnect(network, callbackPass()); |
283 }, | 287 }, |
284 function onNetworksChangedEventDisconnect() { | 288 function onNetworksChangedEventDisconnect() { |
285 var network = "stub_wifi1"; | 289 var network = "stub_wifi1"; |
286 var done = chrome.test.callbackAdded(); | 290 var done = chrome.test.callbackAdded(); |
287 var expectedStates = ["NotConnected"]; | 291 var expectedStates = ["NotConnected"]; |
288 var listener = | 292 var listener = |
289 new privateHelpers.watchForStateChanges(network, expectedStates, done); | 293 new privateHelpers.watchForStateChanges(network, expectedStates, done); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 callbackPass(function(result) { | 328 callbackPass(function(result) { |
325 assertEq("encrypted_data", result); | 329 assertEq("encrypted_data", result); |
326 })); | 330 })); |
327 } | 331 } |
328 ]; | 332 ]; |
329 | 333 |
330 var testToRun = window.location.search.substring(1); | 334 var testToRun = window.location.search.substring(1); |
331 chrome.test.runTests(availableTests.filter(function(op) { | 335 chrome.test.runTests(availableTests.filter(function(op) { |
332 return op.name == testToRun; | 336 return op.name == testToRun; |
333 })); | 337 })); |
OLD | NEW |