| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Test 'type' and 'configured'. | 130 // Test 'type' and 'configured'. |
| 131 chrome.networkingPrivate.getNetworks( | 131 chrome.networkingPrivate.getNetworks( |
| 132 { "networkType": "WiFi", "configured": true }, | 132 { "networkType": "WiFi", "configured": true }, |
| 133 callbackPass(function(result) { | 133 callbackPass(function(result) { |
| 134 assertEq([{ | 134 assertEq([{ |
| 135 "Connectable": true, | 135 "Connectable": true, |
| 136 "ConnectionState": "Connected", | 136 "ConnectionState": "Connected", |
| 137 "GUID": "stub_wifi1_guid", | 137 "GUID": "stub_wifi1_guid", |
| 138 "Name": "wifi1", | 138 "Name": "wifi1", |
| 139 "Type": "WiFi", | 139 "Type": "WiFi", |
| 140 "Source":"User", |
| 140 "WiFi": { | 141 "WiFi": { |
| 141 "Security": "WEP-PSK", | 142 "Security": "WEP-PSK", |
| 142 "SignalStrength": 40 | 143 "SignalStrength": 40 |
| 143 } | 144 } |
| 144 }, { | 145 }, { |
| 145 "GUID": "stub_wifi2_guid", | 146 "GUID": "stub_wifi2_guid", |
| 146 "Name": "wifi2_PSK", | 147 "Name": "wifi2_PSK", |
| 147 "Type": "WiFi", | 148 "Type": "WiFi", |
| 149 "Source":"User", |
| 148 "WiFi": { | 150 "WiFi": { |
| 149 "Security": "WPA-PSK", | 151 "Security": "WPA-PSK", |
| 150 } | 152 } |
| 151 }], result); | 153 }], result); |
| 152 | 154 |
| 153 // Test 'visible' (and 'configured'). | 155 // Test 'visible' (and 'configured'). |
| 154 chrome.networkingPrivate.getNetworks( | 156 chrome.networkingPrivate.getNetworks( |
| 155 { "networkType": "WiFi", "visible": true, "configured": true }, | 157 { "networkType": "WiFi", "visible": true, "configured": true }, |
| 156 callbackPass(function(result) { | 158 callbackPass(function(result) { |
| 157 assertEq([{ | 159 assertEq([{ |
| 158 "Connectable": true, | 160 "Connectable": true, |
| 159 "ConnectionState": "Connected", | 161 "ConnectionState": "Connected", |
| 160 "GUID": "stub_wifi1_guid", | 162 "GUID": "stub_wifi1_guid", |
| 161 "Name": "wifi1", | 163 "Name": "wifi1", |
| 164 "Source":"User", |
| 162 "Type": "WiFi", | 165 "Type": "WiFi", |
| 163 "WiFi": { | 166 "WiFi": { |
| 164 "Security": "WEP-PSK", | 167 "Security": "WEP-PSK", |
| 165 "SignalStrength": 40 | 168 "SignalStrength": 40 |
| 166 } | 169 } |
| 167 }], result); | 170 }], result); |
| 168 | 171 |
| 169 // Test 'limit'. | 172 // Test 'limit'. |
| 170 chrome.networkingPrivate.getNetworks( | 173 chrome.networkingPrivate.getNetworks( |
| 171 { "networkType": "All", "limit": 1 }, | 174 { "networkType": "All", "limit": 1 }, |
| 172 callbackPass(function(result) { | 175 callbackPass(function(result) { |
| 173 assertEq([{ | 176 assertEq([{ |
| 174 "ConnectionState": "Connected", | 177 "ConnectionState": "Connected", |
| 175 "Ethernet": { | 178 "Ethernet": { |
| 176 "Authentication": "None" | 179 "Authentication": "None" |
| 177 }, | 180 }, |
| 178 "GUID": "stub_ethernet_guid", | 181 "GUID": "stub_ethernet_guid", |
| 179 "Name": "eth0", | 182 "Name": "eth0", |
| 183 "Source":"Device", |
| 180 "Type": "Ethernet" | 184 "Type": "Ethernet" |
| 181 }], result); | 185 }], result); |
| 182 })); | 186 })); |
| 183 })); | 187 })); |
| 184 })); | 188 })); |
| 185 }, | 189 }, |
| 186 function getVisibleNetworks() { | 190 function getVisibleNetworks() { |
| 187 chrome.networkingPrivate.getVisibleNetworks( | 191 chrome.networkingPrivate.getVisibleNetworks( |
| 188 "All", | 192 "All", |
| 189 callbackPass(function(result) { | 193 callbackPass(function(result) { |
| 190 assertEq([{ | 194 assertEq([{ |
| 191 "ConnectionState": "Connected", | 195 "ConnectionState": "Connected", |
| 192 "Ethernet": { | 196 "Ethernet": { |
| 193 "Authentication": "None" | 197 "Authentication": "None" |
| 194 }, | 198 }, |
| 195 "GUID": "stub_ethernet_guid", | 199 "GUID": "stub_ethernet_guid", |
| 196 "Name": "eth0", | 200 "Name": "eth0", |
| 201 "Source":"Device", |
| 197 "Type": "Ethernet" | 202 "Type": "Ethernet" |
| 198 }, | 203 }, |
| 199 { | 204 { |
| 200 "Connectable": true, | 205 "Connectable": true, |
| 201 "ConnectionState": "Connected", | 206 "ConnectionState": "Connected", |
| 202 "GUID": "stub_wifi1_guid", | 207 "GUID": "stub_wifi1_guid", |
| 203 "Name": "wifi1", | 208 "Name": "wifi1", |
| 209 "Source": "User", |
| 204 "Type": "WiFi", | 210 "Type": "WiFi", |
| 205 "WiFi": { | 211 "WiFi": { |
| 206 "Security": "WEP-PSK", | 212 "Security": "WEP-PSK", |
| 207 "SignalStrength": 40 | 213 "SignalStrength": 40 |
| 208 } | 214 } |
| 209 }, | 215 }, |
| 210 { | 216 { |
| 211 "Connectable": true, | 217 "Connectable": true, |
| 212 "ConnectionState": "Connected", | 218 "ConnectionState": "Connected", |
| 213 "GUID": "stub_wimax_guid", | 219 "GUID": "stub_wimax_guid", |
| 214 "Name": "wimax", | 220 "Name": "wimax", |
| 221 "Source":"User", |
| 215 "Type": "WiMAX", | 222 "Type": "WiMAX", |
| 216 "WiMAX": { | 223 "WiMAX": { |
| 217 "SignalStrength": 40 | 224 "SignalStrength": 40 |
| 218 } | 225 } |
| 219 }, | 226 }, |
| 220 { | 227 { |
| 221 "ConnectionState": "Connected", | 228 "ConnectionState": "Connected", |
| 222 "GUID": "stub_vpn1_guid", | 229 "GUID": "stub_vpn1_guid", |
| 223 "Name": "vpn1", | 230 "Name": "vpn1", |
| 231 "Source":"User", |
| 224 "Type": "VPN" | 232 "Type": "VPN" |
| 225 }, | 233 }, |
| 226 { | 234 { |
| 227 "Connectable": true, | 235 "Connectable": true, |
| 228 "ConnectionState": "NotConnected", | 236 "ConnectionState": "NotConnected", |
| 229 "GUID": "stub_wifi2_guid", | 237 "GUID": "stub_wifi2_guid", |
| 230 "Name": "wifi2_PSK", | 238 "Name": "wifi2_PSK", |
| 239 "Source": "User", |
| 231 "Type": "WiFi", | 240 "Type": "WiFi", |
| 232 "WiFi": { | 241 "WiFi": { |
| 233 "Security": "WPA-PSK", | 242 "Security": "WPA-PSK", |
| 234 "SignalStrength": 80 | 243 "SignalStrength": 80 |
| 235 } | 244 } |
| 236 }], result); | 245 }], result); |
| 237 })); | 246 })); |
| 238 }, | 247 }, |
| 239 function getVisibleNetworksWifi() { | 248 function getVisibleNetworksWifi() { |
| 240 chrome.networkingPrivate.getVisibleNetworks( | 249 chrome.networkingPrivate.getVisibleNetworks( |
| 241 "WiFi", | 250 "WiFi", |
| 242 callbackPass(function(result) { | 251 callbackPass(function(result) { |
| 243 assertEq([{ | 252 assertEq([{ |
| 244 "Connectable": true, | 253 "Connectable": true, |
| 245 "ConnectionState": "Connected", | 254 "ConnectionState": "Connected", |
| 246 "GUID": "stub_wifi1_guid", | 255 "GUID": "stub_wifi1_guid", |
| 247 "Name": "wifi1", | 256 "Name": "wifi1", |
| 257 "Source": "User", |
| 248 "Type": "WiFi", | 258 "Type": "WiFi", |
| 249 "WiFi": { | 259 "WiFi": { |
| 250 "Security": "WEP-PSK", | 260 "Security": "WEP-PSK", |
| 251 "SignalStrength": 40 | 261 "SignalStrength": 40 |
| 252 } | 262 } |
| 253 }, | 263 }, |
| 254 { | 264 { |
| 255 "Connectable": true, | 265 "Connectable": true, |
| 256 "ConnectionState": "NotConnected", | 266 "ConnectionState": "NotConnected", |
| 257 "GUID": "stub_wifi2_guid", | 267 "GUID": "stub_wifi2_guid", |
| 258 "Name": "wifi2_PSK", | 268 "Name": "wifi2_PSK", |
| 269 "Source": "User", |
| 259 "Type": "WiFi", | 270 "Type": "WiFi", |
| 260 "WiFi": { | 271 "WiFi": { |
| 261 "Security": "WPA-PSK", | 272 "Security": "WPA-PSK", |
| 262 "SignalStrength": 80 | 273 "SignalStrength": 80 |
| 263 } | 274 } |
| 264 } | 275 } |
| 265 ], result); | 276 ], result); |
| 266 })); | 277 })); |
| 267 }, | 278 }, |
| 268 function requestNetworkScan() { | 279 function requestNetworkScan() { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 }, | 467 }, |
| 457 function getState() { | 468 function getState() { |
| 458 chrome.networkingPrivate.getState( | 469 chrome.networkingPrivate.getState( |
| 459 "stub_wifi2_guid", | 470 "stub_wifi2_guid", |
| 460 callbackPass(function(result) { | 471 callbackPass(function(result) { |
| 461 assertEq({ | 472 assertEq({ |
| 462 "Connectable": true, | 473 "Connectable": true, |
| 463 "ConnectionState": "NotConnected", | 474 "ConnectionState": "NotConnected", |
| 464 "GUID": "stub_wifi2_guid", | 475 "GUID": "stub_wifi2_guid", |
| 465 "Name": "wifi2_PSK", | 476 "Name": "wifi2_PSK", |
| 477 "Source": "User", |
| 466 "Type": "WiFi", | 478 "Type": "WiFi", |
| 467 "WiFi": { | 479 "WiFi": { |
| 468 "Security": "WPA-PSK", | 480 "Security": "WPA-PSK", |
| 469 "SignalStrength": 80 | 481 "SignalStrength": 80 |
| 470 } | 482 } |
| 471 }, result); | 483 }, result); |
| 472 })); | 484 })); |
| 473 }, | 485 }, |
| 474 function getStateNonExistent() { | 486 function getStateNonExistent() { |
| 475 chrome.networkingPrivate.getState( | 487 chrome.networkingPrivate.getState( |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 new privateHelpers.watchForCaptivePortalState( | 580 new privateHelpers.watchForCaptivePortalState( |
| 569 'wifi_guid', 'Online', done); | 581 'wifi_guid', 'Online', done); |
| 570 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 582 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
| 571 }, | 583 }, |
| 572 ]; | 584 ]; |
| 573 | 585 |
| 574 var testToRun = window.location.search.substring(1); | 586 var testToRun = window.location.search.substring(1); |
| 575 chrome.test.runTests(availableTests.filter(function(op) { | 587 chrome.test.runTests(availableTests.filter(function(op) { |
| 576 return op.name == testToRun; | 588 return op.name == testToRun; |
| 577 })); | 589 })); |
| OLD | NEW |