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 // Note: the expectations in this test are shared by both the Chrome OS and | 5 // Note: the expectations in this test are shared by both the Chrome OS and |
6 // Win/Mac (ServiceClient) implementations. TODO(stevenjb): Set up a way for | 6 // Win/Mac (ServiceClient) implementations. TODO(stevenjb): Set up a way for |
7 // the test code to specify the correct expectations. | 7 // the test code to specify the correct expectations. |
8 | 8 |
9 var callbackPass = chrome.test.callbackPass; | 9 var callbackPass = chrome.test.callbackPass; |
10 var callbackFail = chrome.test.callbackFail; | 10 var callbackFail = chrome.test.callbackFail; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 listener.listenForChanges); | 278 listener.listenForChanges); |
279 chrome.networkingPrivate.requestNetworkScan(); | 279 chrome.networkingPrivate.requestNetworkScan(); |
280 }, | 280 }, |
281 function getProperties() { | 281 function getProperties() { |
282 chrome.networkingPrivate.getProperties( | 282 chrome.networkingPrivate.getProperties( |
283 "stub_wifi1_guid", | 283 "stub_wifi1_guid", |
284 callbackPass(function(result) { | 284 callbackPass(function(result) { |
285 assertEq({ "Connectable": true, | 285 assertEq({ "Connectable": true, |
286 "ConnectionState": "Connected", | 286 "ConnectionState": "Connected", |
287 "GUID": "stub_wifi1_guid", | 287 "GUID": "stub_wifi1_guid", |
288 "MacAddress": "00:11:22:AA:BB:CC", | |
289 "IPConfigs": [{ | 288 "IPConfigs": [{ |
290 "Gateway": "0.0.0.1", | 289 "Gateway": "0.0.0.1", |
291 "IPAddress": "0.0.0.0", | 290 "IPAddress": "0.0.0.0", |
292 "RoutingPrefix": 0, | 291 "RoutingPrefix": 0, |
293 "Type": "IPv4" | 292 "Type": "IPv4" |
294 }], | 293 }], |
294 "IPConfigType": "Static", | |
295 "MacAddress": "00:11:22:AA:BB:CC", | |
295 "Name": "wifi1", | 296 "Name": "wifi1", |
297 "StaticIPConfig": { | |
298 "IPAddress": "1.2.3.4", | |
299 "Type": "IPv4" | |
300 }, | |
296 "Type": "WiFi", | 301 "Type": "WiFi", |
297 "WiFi": { | 302 "WiFi": { |
298 "Frequency": 2400, | 303 "Frequency": 2400, |
299 "FrequencyList": [2400], | 304 "FrequencyList": [2400], |
300 "SSID": "wifi1", | 305 "SSID": "wifi1", |
301 "Security": "WEP-PSK", | 306 "Security": "WEP-PSK", |
302 "SignalStrength": 40 | 307 "SignalStrength": 40 |
303 } | 308 } |
304 }, result); | 309 }, result); |
305 })); | 310 })); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 var done = chrome.test.callbackAdded(); | 382 var done = chrome.test.callbackAdded(); |
378 var network_guid = "stub_wifi1_guid"; | 383 var network_guid = "stub_wifi1_guid"; |
379 chrome.networkingPrivate.getProperties( | 384 chrome.networkingPrivate.getProperties( |
380 network_guid, | 385 network_guid, |
381 callbackPass(function(result) { | 386 callbackPass(function(result) { |
382 assertEq(network_guid, result.GUID); | 387 assertEq(network_guid, result.GUID); |
383 var new_properties = { | 388 var new_properties = { |
384 Priority: 1, | 389 Priority: 1, |
385 WiFi: { | 390 WiFi: { |
386 AutoConnect: true | 391 AutoConnect: true |
392 }, | |
393 IPConfigType: 'Static', | |
pneubeck (no reviews)
2014/12/05 09:47:46
should this have been 'DHCP' to test that case als
stevenjb
2015/01/08 00:44:39
The above tests getting, this tests setting. The S
| |
394 StaticIPConfig: { | |
395 IPAddress: '1.2.3.4' | |
387 } | 396 } |
388 }; | 397 }; |
389 chrome.networkingPrivate.setProperties( | 398 chrome.networkingPrivate.setProperties( |
390 network_guid, | 399 network_guid, |
391 new_properties, | 400 new_properties, |
392 callbackPass(function() { | 401 callbackPass(function() { |
393 chrome.networkingPrivate.getProperties( | 402 chrome.networkingPrivate.getProperties( |
394 network_guid, | 403 network_guid, |
395 callbackPass(function(result) { | 404 callbackPass(function(result) { |
405 // Ensure that the GUID doesn't change. | |
406 assertEq(network_guid, result.GUID); | |
396 // Ensure that the properties were set. | 407 // Ensure that the properties were set. |
397 assertEq(1, result['Priority']); | 408 assertEq(1, result['Priority']); |
398 assertTrue('WiFi' in result); | 409 assertTrue('WiFi' in result); |
399 assertTrue('AutoConnect' in result['WiFi']); | 410 assertTrue('AutoConnect' in result['WiFi']); |
400 assertEq(true, result['WiFi']['AutoConnect']); | 411 assertEq(true, result['WiFi']['AutoConnect']); |
401 // Ensure that the GUID doesn't change. | 412 assertTrue('StaticIPConfig' in result); |
402 assertEq(network_guid, result.GUID); | 413 assertEq('1.2.3.4', |
414 result['StaticIPConfig']['IPAddress']); | |
403 done(); | 415 done(); |
404 })); | 416 })); |
405 })); | 417 })); |
406 })); | 418 })); |
407 }, | 419 }, |
408 function setVPNProperties() { | 420 function setVPNProperties() { |
409 var done = chrome.test.callbackAdded(); | 421 var done = chrome.test.callbackAdded(); |
410 var network_guid = "stub_vpn1_guid"; | 422 var network_guid = "stub_vpn1_guid"; |
411 chrome.networkingPrivate.getProperties( | 423 chrome.networkingPrivate.getProperties( |
412 network_guid, | 424 network_guid, |
413 callbackPass(function(result) { | 425 callbackPass(function(result) { |
414 assertEq(network_guid, result.GUID); | 426 assertEq(network_guid, result.GUID); |
415 var new_properties = { | 427 var new_properties = { |
416 Priority: 1, | 428 Priority: 1, |
417 VPN: { | 429 VPN: { |
418 Host: 'vpn.host1' | 430 Host: 'vpn.host1' |
419 } | 431 } |
420 }; | 432 }; |
421 chrome.networkingPrivate.setProperties( | 433 chrome.networkingPrivate.setProperties( |
422 network_guid, | 434 network_guid, |
423 new_properties, | 435 new_properties, |
424 callbackPass(function() { | 436 callbackPass(function() { |
425 chrome.networkingPrivate.getProperties( | 437 chrome.networkingPrivate.getProperties( |
426 network_guid, | 438 network_guid, |
427 callbackPass(function(result) { | 439 callbackPass(function(result) { |
428 console.log('Result: ' + JSON.stringify(result)); | |
429 // Ensure that the properties were set. | 440 // Ensure that the properties were set. |
430 assertEq(1, result['Priority']); | 441 assertEq(1, result['Priority']); |
431 assertTrue('VPN' in result); | 442 assertTrue('VPN' in result); |
432 assertTrue('Host' in result['VPN']); | 443 assertTrue('Host' in result['VPN']); |
433 assertEq('vpn.host1', result['VPN']['Host']); | 444 assertEq('vpn.host1', result['VPN']['Host']); |
434 // Ensure that the GUID doesn't change. | 445 // Ensure that the GUID doesn't change. |
435 assertEq(network_guid, result.GUID); | 446 assertEq(network_guid, result.GUID); |
436 done(); | 447 done(); |
437 })); | 448 })); |
438 })); | 449 })); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
552 new privateHelpers.watchForCaptivePortalState( | 563 new privateHelpers.watchForCaptivePortalState( |
553 'wifi_guid', 'Online', done); | 564 'wifi_guid', 'Online', done); |
554 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 565 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
555 }, | 566 }, |
556 ]; | 567 ]; |
557 | 568 |
558 var testToRun = window.location.search.substring(1); | 569 var testToRun = window.location.search.substring(1); |
559 chrome.test.runTests(availableTests.filter(function(op) { | 570 chrome.test.runTests(availableTests.filter(function(op) { |
560 return op.name == testToRun; | 571 return op.name == testToRun; |
561 })); | 572 })); |
OLD | NEW |