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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 chrome.networkingPrivate.getProperties( | 132 chrome.networkingPrivate.getProperties( |
133 guid, | 133 guid, |
134 callbackPass(function(properties) { | 134 callbackPass(function(properties) { |
135 assertEq("WiFi", properties.Type); | 135 assertEq("WiFi", properties.Type); |
136 assertEq(guid, properties.GUID); | 136 assertEq(guid, properties.GUID); |
137 assertEq("wifi_created", properties.WiFi.SSID); | 137 assertEq("wifi_created", properties.WiFi.SSID); |
138 assertEq("WEP-PSK", properties.WiFi.Security); | 138 assertEq("WEP-PSK", properties.WiFi.Security); |
139 })); | 139 })); |
140 })); | 140 })); |
141 }, | 141 }, |
| 142 function forgetNetwork() { |
| 143 var kNumNetworks = 2; |
| 144 var kTestNetworkGuid = "stub_wifi1_guid"; |
| 145 function guidExists(networks, guid) { |
| 146 for (var n of networks) { |
| 147 if (n.GUID == kTestNetworkGuid) |
| 148 return true; |
| 149 } |
| 150 return false; |
| 151 } |
| 152 chrome.networkingPrivate.getNetworks( |
| 153 { "networkType": "WiFi", "visible": true, "configured": true }, |
| 154 callbackPass(function(networks) { |
| 155 assertEq(kNumNetworks, networks.length); |
| 156 assertTrue(guidExists(networks, kTestNetworkGuid)); |
| 157 chrome.networkingPrivate.forgetNetwork( |
| 158 kTestNetworkGuid, callbackPass(function() { |
| 159 chrome.networkingPrivate.getNetworks( |
| 160 { "networkType": "WiFi", "visible": true, "configured": true }, |
| 161 callbackPass(function(networks) { |
| 162 assertEq(kNumNetworks - 1, networks.length); |
| 163 assertFalse(guidExists(networks, kTestNetworkGuid)); |
| 164 })); |
| 165 })); |
| 166 })); |
| 167 }, |
142 function getNetworks() { | 168 function getNetworks() { |
143 // Test 'type' and 'configured'. | 169 // Test 'type' and 'configured'. |
144 chrome.networkingPrivate.getNetworks( | 170 chrome.networkingPrivate.getNetworks( |
145 { "networkType": "WiFi", "configured": true }, | 171 { "networkType": "WiFi", "configured": true }, |
146 callbackPass(function(result) { | 172 callbackPass(function(result) { |
147 assertEq([{ | 173 assertEq([{ |
148 "Connectable": true, | 174 "Connectable": true, |
149 "ConnectionState": "Connected", | 175 "ConnectionState": "Connected", |
150 "GUID": "stub_wifi1_guid", | 176 "GUID": "stub_wifi1_guid", |
151 "Name": "wifi1", | 177 "Name": "wifi1", |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 new privateHelpers.watchForCaptivePortalState( | 637 new privateHelpers.watchForCaptivePortalState( |
612 'wifi_guid', 'Online', done); | 638 'wifi_guid', 'Online', done); |
613 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 639 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
614 }, | 640 }, |
615 ]; | 641 ]; |
616 | 642 |
617 var testToRun = window.location.search.substring(1); | 643 var testToRun = window.location.search.substring(1); |
618 chrome.test.runTests(availableTests.filter(function(op) { | 644 chrome.test.runTests(availableTests.filter(function(op) { |
619 return op.name == testToRun; | 645 return op.name == testToRun; |
620 })); | 646 })); |
OLD | NEW |