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

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

Issue 12188027: This adds the onNetworkChanged event to networkingPrivate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing virtual keyword Created 7 years, 10 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/common/extensions/api/networking_private.json ('k') | no next file » | 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 chrome.test.runTests([ 10 chrome.test.runTests([
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 function getProperties() { 73 function getProperties() {
74 chrome.networkingPrivate.getProperties( 74 chrome.networkingPrivate.getProperties(
75 "stub_wifi2", 75 "stub_wifi2",
76 callbackPass(function(result) { 76 callbackPass(function(result) {
77 assertTrue(!!result); 77 assertTrue(!!result);
78 assertEq("wifi2_PSK", result.Name); 78 assertEq("wifi2_PSK", result.Name);
79 assertEq("NotConnected", result.ConnectionState); 79 assertEq("NotConnected", result.ConnectionState);
80 assertEq("WiFi", result.Type); 80 assertEq("WiFi", result.Type);
81 })); 81 }));
82 }, 82 },
83 function propertiesChangeEvent() {
84 var done = chrome.test.callbackAdded();
85 chrome.networkingPrivate.onNetworkChanged.addListener(
86 function (properties) {
87 assertEq(
88 [
89 {
90 "ConnectionState": "Connected",
91 "GUID": "stub_ethernet",
92 "Name": "eth0",
93 "Type": "Ethernet"
94 },
95 {
96 "ConnectionState": "Connecting",
97 "GUID": "stub_wifi1",
98 "Name": "wifi1",
99 "Type": "WiFi"
100 },
101 {
102 "ConnectionState": "NotConnected",
103 "GUID": "stub_wifi2",
104 "Name": "wifi2_PSK",
105 "Type": "WiFi"
106 },
107 {
108 "ConnectionState": "NotConnected",
109 "GUID": "stub_cellular1",
110 "Name": "cellular1",
111 "Type": "Cellular"
112 }
113 ], properties);
114 done();
115 });
116 chrome.networkingPrivate.startConnect("stub_wifi1",
117 callbackPass(function() {}));
118 },
83 function startConnect() { 119 function startConnect() {
84 chrome.networkingPrivate.startConnect("stub_wifi2", 120 chrome.networkingPrivate.startConnect("stub_wifi2",
85 callbackPass(function() {})); 121 callbackPass(function() {}));
86 }, 122 },
87 function startDisconnect() { 123 function startDisconnect() {
88 chrome.networkingPrivate.startDisconnect("stub_wifi2", 124 chrome.networkingPrivate.startDisconnect("stub_wifi2",
89 callbackPass(function() {})); 125 callbackPass(function() {}));
90 }, 126 },
91 function startConnectNonexistent() { 127 function startConnectNonexistent() {
92 // Make sure we get an error when we try to connect to a nonexistent 128 // Make sure we get an error when we try to connect to a nonexistent
93 // network. 129 // network.
94 chrome.networkingPrivate.startConnect( 130 chrome.networkingPrivate.startConnect(
95 "nonexistent_path", 131 "nonexistent_path",
96 callbackFail("Error.InvalidService", function() {})); 132 callbackFail("Error.InvalidService", function() {}));
97 } 133 }
98 ]); 134 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/networking_private.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698