Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/test/data/extensions/api_test/networking/test.js

Issue 14566009: Add NetworkConnectionHandler class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert Associating Stub change for test Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser_chromeos.gypi ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }));
OLDNEW
« no previous file with comments | « chrome/chrome_browser_chromeos.gypi ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698