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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 chrome.networkingPrivate.getProperties( | 119 chrome.networkingPrivate.getProperties( |
120 guid, | 120 guid, |
121 callbackPass(function(properties) { | 121 callbackPass(function(properties) { |
122 assertEq("WiFi", properties.Type); | 122 assertEq("WiFi", properties.Type); |
123 assertEq(guid, properties.GUID); | 123 assertEq(guid, properties.GUID); |
124 assertEq("wifi_created", properties.WiFi.SSID); | 124 assertEq("wifi_created", properties.WiFi.SSID); |
125 assertEq("WEP-PSK", properties.WiFi.Security); | 125 assertEq("WEP-PSK", properties.WiFi.Security); |
126 })); | 126 })); |
127 })); | 127 })); |
128 }, | 128 }, |
| 129 function forgetNetwork() { |
| 130 var kNumNetworks = 2; |
| 131 chrome.networkingPrivate.getNetworks( |
| 132 { "networkType": "WiFi", "visible": true, "configured": true }, |
| 133 callbackPass(function(networks) { |
| 134 assertEq(kNumNetworks, networks.length); |
| 135 chrome.networkingPrivate.forgetNetwork( |
| 136 "stub_wifi1_guid", callbackPass(function() { |
| 137 chrome.networkingPrivate.getNetworks( |
| 138 { "networkType": "WiFi", "visible": true, "configured": true }, |
| 139 callbackPass(function(networks) { |
| 140 console.log(JSON.stringify(networks)); |
| 141 assertEq(kNumNetworks - 1, networks.length); |
| 142 })); |
| 143 })); |
| 144 })); |
| 145 }, |
129 function getNetworks() { | 146 function getNetworks() { |
130 // Test 'type' and 'configured'. | 147 // Test 'type' and 'configured'. |
131 chrome.networkingPrivate.getNetworks( | 148 chrome.networkingPrivate.getNetworks( |
132 { "networkType": "WiFi", "configured": true }, | 149 { "networkType": "WiFi", "configured": true }, |
133 callbackPass(function(result) { | 150 callbackPass(function(result) { |
134 assertEq([{ | 151 assertEq([{ |
135 "Connectable": true, | 152 "Connectable": true, |
136 "ConnectionState": "Connected", | 153 "ConnectionState": "Connected", |
137 "GUID": "stub_wifi1_guid", | 154 "GUID": "stub_wifi1_guid", |
138 "Name": "wifi1", | 155 "Name": "wifi1", |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 new privateHelpers.watchForCaptivePortalState( | 597 new privateHelpers.watchForCaptivePortalState( |
581 'wifi_guid', 'Online', done); | 598 'wifi_guid', 'Online', done); |
582 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 599 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
583 }, | 600 }, |
584 ]; | 601 ]; |
585 | 602 |
586 var testToRun = window.location.search.substring(1); | 603 var testToRun = window.location.search.substring(1); |
587 chrome.test.runTests(availableTests.filter(function(op) { | 604 chrome.test.runTests(availableTests.filter(function(op) { |
588 return op.name == testToRun; | 605 return op.name == testToRun; |
589 })); | 606 })); |
OLD | NEW |