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 // The expectations in this test for the Chrome OS implementation. See | 5 // The expectations in this test for the Chrome OS implementation. See |
6 // networking_private_chromeos_apitest.cc for more info. | 6 // networking_private_chromeos_apitest.cc for more info. |
7 | 7 |
8 var callbackPass = chrome.test.callbackPass; | 8 var callbackPass = chrome.test.callbackPass; |
9 var callbackFail = chrome.test.callbackFail; | 9 var callbackFail = chrome.test.callbackFail; |
10 var assertTrue = chrome.test.assertTrue; | 10 var assertTrue = chrome.test.assertTrue; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 Name: 'wifi2_PSK', | 333 Name: 'wifi2_PSK', |
334 Source: 'User', | 334 Source: 'User', |
335 Type: NetworkType.WiFi, | 335 Type: NetworkType.WiFi, |
336 WiFi: { | 336 WiFi: { |
337 Security: 'WPA-PSK', | 337 Security: 'WPA-PSK', |
338 SignalStrength: 80 | 338 SignalStrength: 80 |
339 } | 339 } |
340 }], result); | 340 }], result); |
341 })); | 341 })); |
342 }, | 342 }, |
343 function getDeviceStates() { | |
344 chrome.networkingPrivate.getDeviceStates(callbackPass(function(result) { | |
345 assertEq([ | |
346 {Scanning: false, State: 'Enabled', Type: 'WiFi'}, | |
347 {State: 'Uninitialized', Type: 'Cellular'}, | |
348 {State: 'Enabled', Type: 'Ethernet'}, | |
pneubeck (no reviews)
2015/04/09 09:41:21
you documentation of the API states that this shou
stevenjb
2015/04/09 16:20:24
Actually, this is a bug in the fake implementation
| |
349 {State: 'Disabled', Type: 'WiMAX'}, | |
350 ], | |
351 result); | |
352 })); | |
353 }, | |
343 function requestNetworkScan() { | 354 function requestNetworkScan() { |
344 // Connected or Connecting networks should be listed first, sorted by type. | 355 // Connected or Connecting networks should be listed first, sorted by type. |
345 var expected = ['stub_ethernet_guid', | 356 var expected = ['stub_ethernet_guid', |
346 'stub_wifi1_guid', | 357 'stub_wifi1_guid', |
347 'stub_wimax_guid', | 358 'stub_wimax_guid', |
348 'stub_vpn1_guid', | 359 'stub_vpn1_guid', |
349 'stub_vpn2_guid', | 360 'stub_vpn2_guid', |
350 'stub_wifi2_guid']; | 361 'stub_wifi2_guid']; |
351 var done = chrome.test.callbackAdded(); | 362 var done = chrome.test.callbackAdded(); |
352 var listener = new privateHelpers.listListener(expected, done); | 363 var listener = new privateHelpers.listListener(expected, done); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
609 'stub_vpn1_guid', | 620 'stub_vpn1_guid', |
610 'stub_wifi1_guid', | 621 'stub_wifi1_guid', |
611 'stub_vpn2_guid']; | 622 'stub_vpn2_guid']; |
612 var done = chrome.test.callbackAdded(); | 623 var done = chrome.test.callbackAdded(); |
613 var listener = new privateHelpers.listListener(expected, done); | 624 var listener = new privateHelpers.listListener(expected, done); |
614 chrome.networkingPrivate.onNetworkListChanged.addListener( | 625 chrome.networkingPrivate.onNetworkListChanged.addListener( |
615 listener.listenForChanges); | 626 listener.listenForChanges); |
616 var network = 'stub_wifi2_guid'; | 627 var network = 'stub_wifi2_guid'; |
617 chrome.networkingPrivate.startConnect(network, callbackPass()); | 628 chrome.networkingPrivate.startConnect(network, callbackPass()); |
618 }, | 629 }, |
630 function onDeviceStateListChangedEvent() { | |
631 console.log('onDeviceStateListChangedEvent'); | |
pneubeck (no reviews)
2015/04/09 09:41:21
nit: remove
stevenjb
2015/04/09 16:20:24
Done.
| |
632 var done = chrome.test.callbackAdded(); | |
633 var listener = function() { | |
pneubeck (no reviews)
2015/04/09 09:41:21
instead of using callbackAdded, you can wrap the l
stevenjb
2015/04/09 16:20:25
Done.
| |
634 chrome.networkingPrivate.onDeviceStateListChanged.removeListener( | |
635 listener); | |
636 done(); | |
pneubeck (no reviews)
2015/04/09 09:41:21
not sure if that makes sense with the stub impleme
stevenjb
2015/04/09 16:20:25
I'd just as soon not test behavior that isn't dire
| |
637 }; | |
638 chrome.networkingPrivate.onDeviceStateListChanged.addListener(listener); | |
639 chrome.networkingPrivate.disableNetworkType('WiFi'); | |
640 }, | |
619 function verifyDestination() { | 641 function verifyDestination() { |
620 chrome.networkingPrivate.verifyDestination( | 642 chrome.networkingPrivate.verifyDestination( |
621 verificationProperties, | 643 verificationProperties, |
622 callbackPass(function(isValid) { | 644 callbackPass(function(isValid) { |
623 assertTrue(isValid); | 645 assertTrue(isValid); |
624 })); | 646 })); |
625 }, | 647 }, |
626 function verifyAndEncryptCredentials() { | 648 function verifyAndEncryptCredentials() { |
627 var network_guid = 'stub_wifi2_guid'; | 649 var network_guid = 'stub_wifi2_guid'; |
628 chrome.networkingPrivate.verifyAndEncryptCredentials( | 650 chrome.networkingPrivate.verifyAndEncryptCredentials( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 new privateHelpers.watchForCaptivePortalState( | 696 new privateHelpers.watchForCaptivePortalState( |
675 'wifi_guid', 'Online', done); | 697 'wifi_guid', 'Online', done); |
676 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 698 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
677 }, | 699 }, |
678 ]; | 700 ]; |
679 | 701 |
680 var testToRun = window.location.search.substring(1); | 702 var testToRun = window.location.search.substring(1); |
681 chrome.test.runTests(availableTests.filter(function(op) { | 703 chrome.test.runTests(availableTests.filter(function(op) { |
682 return op.name == testToRun; | 704 return op.name == testToRun; |
683 })); | 705 })); |
OLD | NEW |