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

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

Issue 267433005: Provide IPConfigs in networkingPrivate.GetProperties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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
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 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 assertEq([{ 128 assertEq([{
129 "ConnectionState": "Connected", 129 "ConnectionState": "Connected",
130 "Ethernet": { 130 "Ethernet": {
131 "Authentication": "None" 131 "Authentication": "None"
132 }, 132 },
133 "GUID": "stub_ethernet", 133 "GUID": "stub_ethernet",
134 "Name": "eth0", 134 "Name": "eth0",
135 "Type": "Ethernet" 135 "Type": "Ethernet"
136 }, 136 },
137 { 137 {
138 "Connectable": true,
138 "ConnectionState": "Connected", 139 "ConnectionState": "Connected",
139 "GUID": "stub_wifi1", 140 "GUID": "stub_wifi1",
140 "Name": "wifi1", 141 "Name": "wifi1",
141 "Type": "WiFi", 142 "Type": "WiFi",
142 "WiFi": { 143 "WiFi": {
143 "Security": "WEP-PSK", 144 "Security": "WEP-PSK",
144 "SignalStrength": 0 145 "SignalStrength": 40
145 } 146 }
146 }, 147 },
147 { 148 {
148 "ConnectionState": "Connected", 149 "ConnectionState": "Connected",
149 "GUID": "stub_vpn1", 150 "GUID": "stub_vpn1",
150 "Name": "vpn1", 151 "Name": "vpn1",
151 "Type": "VPN", 152 "Type": "VPN",
152 }, 153 },
153 { 154 {
155 "Connectable": true,
154 "ConnectionState": "NotConnected", 156 "ConnectionState": "NotConnected",
155 "GUID": "stub_wifi2", 157 "GUID": "stub_wifi2",
156 "Name": "wifi2_PSK", 158 "Name": "wifi2_PSK",
157 "Type": "WiFi", 159 "Type": "WiFi",
158 "WiFi": { 160 "WiFi": {
159 "Security": "WPA-PSK", 161 "Security": "WPA-PSK",
160 "SignalStrength": 80 162 "SignalStrength": 80
161 } 163 }
162 },
163 {
164 "Cellular": {
165 "ActivationState": "not-activated",
166 "NetworkTechnology": "GSM",
167 "RoamingState": "home"
168 },
169 "ConnectionState": "NotConnected",
170 "GUID": "stub_cellular1",
171 "Name": "cellular1",
172 "Type": "Cellular"
173 }], result); 164 }], result);
174 })); 165 }));
175 }, 166 },
176 function getVisibleNetworksWifi() { 167 function getVisibleNetworksWifi() {
177 chrome.networkingPrivate.getVisibleNetworks( 168 chrome.networkingPrivate.getVisibleNetworks(
178 "WiFi", 169 "WiFi",
179 callbackPass(function(result) { 170 callbackPass(function(result) {
180 assertEq([{ 171 assertEq([{
172 "Connectable": true,
181 "ConnectionState": "Connected", 173 "ConnectionState": "Connected",
182 "GUID": "stub_wifi1", 174 "GUID": "stub_wifi1",
183 "Name": "wifi1", 175 "Name": "wifi1",
184 "Type": "WiFi", 176 "Type": "WiFi",
185 "WiFi": { 177 "WiFi": {
186 "Security": "WEP-PSK", 178 "Security": "WEP-PSK",
187 "SignalStrength": 0 179 "SignalStrength": 40
188 } 180 }
189 }, 181 },
190 { 182 {
183 "Connectable": true,
191 "ConnectionState": "NotConnected", 184 "ConnectionState": "NotConnected",
192 "GUID": "stub_wifi2", 185 "GUID": "stub_wifi2",
193 "Name": "wifi2_PSK", 186 "Name": "wifi2_PSK",
194 "Type": "WiFi", 187 "Type": "WiFi",
195 "WiFi": { 188 "WiFi": {
196 "Security": "WPA-PSK", 189 "Security": "WPA-PSK",
197 "SignalStrength": 80 190 "SignalStrength": 80
198 } 191 }
199 } 192 }
200 ], result); 193 ], result);
201 })); 194 }));
202 }, 195 },
203 function requestNetworkScan() { 196 function requestNetworkScan() {
204 // Connected or Connecting networks should be listed first, sorted by type. 197 // Connected or Connecting networks should be listed first, sorted by type.
205 var expected = ["stub_ethernet", 198 var expected = ["stub_ethernet",
206 "stub_wifi1", 199 "stub_wifi1",
207 "stub_vpn1", 200 "stub_vpn1",
208 "stub_wifi2", 201 "stub_wifi2"];
209 "stub_cellular1"];
210 var done = chrome.test.callbackAdded(); 202 var done = chrome.test.callbackAdded();
211 var listener = new privateHelpers.listListener(expected, done); 203 var listener = new privateHelpers.listListener(expected, done);
212 chrome.networkingPrivate.onNetworkListChanged.addListener( 204 chrome.networkingPrivate.onNetworkListChanged.addListener(
213 listener.listenForChanges); 205 listener.listenForChanges);
214 chrome.networkingPrivate.requestNetworkScan(); 206 chrome.networkingPrivate.requestNetworkScan();
215 }, 207 },
216 function getProperties() { 208 function getProperties() {
217 chrome.networkingPrivate.getProperties( 209 chrome.networkingPrivate.getProperties(
218 "stub_wifi2", 210 "stub_wifi1",
219 callbackPass(function(result) { 211 callbackPass(function(result) {
220 assertEq({ 212 assertEq({ "Connectable": true,
221 "ConnectionState": "NotConnected", 213 "ConnectionState": "Connected",
222 "GUID": "stub_wifi2", 214 "GUID": "stub_wifi1",
223 "Name": "wifi2_PSK", 215 "IPConfigs": [{
216 "Gateway": "0.0.0.1",
217 "IPAddress": "0.0.0.0",
218 "RoutingPrefix": 0,
219 "Type": "IPv4"
220 }],
221 "Name": "wifi1",
224 "Type": "WiFi", 222 "Type": "WiFi",
225 "WiFi": { 223 "WiFi": {
226 "Frequency": 5000, 224 "Frequency": 2400,
227 "FrequencyList": [2400, 5000], 225 "FrequencyList": [2400],
228 "SSID": "wifi2_PSK", 226 "SSID": "wifi1",
229 "Security": "WPA-PSK", 227 "Security": "WEP-PSK",
230 "SignalStrength": 80 228 "SignalStrength": 40
231 } 229 }
232 }, result); 230 }, result);
233 })); 231 }));
234 }, 232 },
235 function getManagedProperties() { 233 function getManagedProperties() {
236 chrome.networkingPrivate.getManagedProperties( 234 chrome.networkingPrivate.getManagedProperties(
237 "stub_wifi2", 235 "stub_wifi2",
238 callbackPass(function(result) { 236 callbackPass(function(result) {
239 assertEq({ 237 assertEq({
238 "Connectable": {
239 "Active": true,
240 "Effective": "Unmanaged"
241 },
240 "ConnectionState": { 242 "ConnectionState": {
241 "Active": "NotConnected", 243 "Active": "NotConnected",
242 "Effective": "Unmanaged" 244 "Effective": "Unmanaged"
243 }, 245 },
244 "GUID": "stub_wifi2", 246 "GUID": "stub_wifi2",
245 "Name": { 247 "Name": {
246 "Active": "wifi2_PSK", 248 "Active": "wifi2_PSK",
247 "Effective": "UserPolicy", 249 "Effective": "UserPolicy",
248 "UserPolicy": "My WiFi Network" 250 "UserPolicy": "My WiFi Network"
249 }, 251 },
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 done(); 305 done();
304 })); 306 }));
305 })); 307 }));
306 })); 308 }));
307 }, 309 },
308 function getState() { 310 function getState() {
309 chrome.networkingPrivate.getState( 311 chrome.networkingPrivate.getState(
310 "stub_wifi2", 312 "stub_wifi2",
311 callbackPass(function(result) { 313 callbackPass(function(result) {
312 assertEq({ 314 assertEq({
315 "Connectable": true,
313 "ConnectionState": "NotConnected", 316 "ConnectionState": "NotConnected",
314 "GUID": "stub_wifi2", 317 "GUID": "stub_wifi2",
315 "Name": "wifi2_PSK", 318 "Name": "wifi2_PSK",
316 "Type": "WiFi", 319 "Type": "WiFi",
317 "WiFi": { 320 "WiFi": {
318 "Security": "WPA-PSK", 321 "Security": "WPA-PSK",
319 "SignalStrength": 80 322 "SignalStrength": 80
320 } 323 }
321 }, result); 324 }, result);
322 })); 325 }));
(...skipping 18 matching lines...) Expand all
341 var listener = 344 var listener =
342 new privateHelpers.watchForStateChanges(network, expectedStates, done); 345 new privateHelpers.watchForStateChanges(network, expectedStates, done);
343 chrome.networkingPrivate.startDisconnect(network, callbackPass()); 346 chrome.networkingPrivate.startDisconnect(network, callbackPass());
344 }, 347 },
345 function onNetworkListChangedEvent() { 348 function onNetworkListChangedEvent() {
346 // Connecting to wifi2 should set wifi1 to offline. Connected or Connecting 349 // Connecting to wifi2 should set wifi1 to offline. Connected or Connecting
347 // networks should be listed first, sorted by type. 350 // networks should be listed first, sorted by type.
348 var expected = ["stub_ethernet", 351 var expected = ["stub_ethernet",
349 "stub_wifi2", 352 "stub_wifi2",
350 "stub_vpn1", 353 "stub_vpn1",
351 "stub_wifi1", 354 "stub_wifi1"];
352 "stub_cellular1"];
353 var done = chrome.test.callbackAdded(); 355 var done = chrome.test.callbackAdded();
354 var listener = new privateHelpers.listListener(expected, done); 356 var listener = new privateHelpers.listListener(expected, done);
355 chrome.networkingPrivate.onNetworkListChanged.addListener( 357 chrome.networkingPrivate.onNetworkListChanged.addListener(
356 listener.listenForChanges); 358 listener.listenForChanges);
357 var network = "stub_wifi2"; 359 var network = "stub_wifi2";
358 chrome.networkingPrivate.startConnect(network, callbackPass()); 360 chrome.networkingPrivate.startConnect(network, callbackPass());
359 }, 361 },
360 function verifyDestination() { 362 function verifyDestination() {
361 chrome.networkingPrivate.verifyDestination( 363 chrome.networkingPrivate.verifyDestination(
362 verificationProperties, 364 verificationProperties,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 var listener = 418 var listener =
417 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done); 419 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done);
418 chrome.test.sendMessage('notifyPortalDetectorObservers'); 420 chrome.test.sendMessage('notifyPortalDetectorObservers');
419 }, 421 },
420 ]; 422 ];
421 423
422 var testToRun = window.location.search.substring(1); 424 var testToRun = window.location.search.substring(1);
423 chrome.test.runTests(availableTests.filter(function(op) { 425 chrome.test.runTests(availableTests.filter(function(op) {
424 return op.name == testToRun; 426 return op.name == testToRun;
425 })); 427 }));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698