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 var callbackPass = chrome.test.callbackPass; | 5 var callbackPass = chrome.test.callbackPass; |
6 var callbackFail = chrome.test.callbackFail; | 6 var callbackFail = chrome.test.callbackFail; |
7 var assertTrue = chrome.test.assertTrue; | 7 var assertTrue = chrome.test.assertTrue; |
8 var assertFalse = chrome.test.assertFalse; | 8 var assertFalse = chrome.test.assertFalse; |
9 var assertEq = chrome.test.assertEq; | 9 var assertEq = chrome.test.assertEq; |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 "GUID": "stub_ethernet", | 116 "GUID": "stub_ethernet", |
117 "Name": "eth0", | 117 "Name": "eth0", |
118 "Type": "Ethernet" | 118 "Type": "Ethernet" |
119 }, | 119 }, |
120 { | 120 { |
121 "ConnectionState": "Connected", | 121 "ConnectionState": "Connected", |
122 "GUID": "stub_wifi1", | 122 "GUID": "stub_wifi1", |
123 "Name": "wifi1", | 123 "Name": "wifi1", |
124 "Type": "WiFi", | 124 "Type": "WiFi", |
125 "WiFi": { | 125 "WiFi": { |
126 "AutoConnect": false, | |
127 "Security": "WEP-PSK", | 126 "Security": "WEP-PSK", |
128 "SignalStrength": 0 | 127 "SignalStrength": 0 |
129 } | 128 } |
130 }, | 129 }, |
131 { | 130 { |
132 "ConnectionState": "Connected", | 131 "ConnectionState": "Connected", |
133 "GUID": "stub_vpn1", | 132 "GUID": "stub_vpn1", |
134 "Name": "vpn1", | 133 "Name": "vpn1", |
135 "Type": "VPN", | 134 "Type": "VPN", |
136 "VPN": { | |
137 "AutoConnect": false | |
138 } | |
139 }, | 135 }, |
140 { | 136 { |
141 "ConnectionState": "NotConnected", | 137 "ConnectionState": "NotConnected", |
142 "GUID": "stub_wifi2", | 138 "GUID": "stub_wifi2", |
143 "Name": "wifi2_PSK", | 139 "Name": "wifi2_PSK", |
144 "Type": "WiFi", | 140 "Type": "WiFi", |
145 "WiFi": { | 141 "WiFi": { |
146 "AutoConnect": false, | |
147 "Security": "WPA-PSK", | 142 "Security": "WPA-PSK", |
148 "SignalStrength": 80 | 143 "SignalStrength": 80 |
149 } | 144 } |
150 }, | 145 }, |
151 { | 146 { |
152 "Cellular": { | 147 "Cellular": { |
153 "ActivateOverNonCellularNetwork": false, | 148 "ActivateOverNonCellularNetwork": false, |
154 "ActivationState": "not-activated", | 149 "ActivationState": "not-activated", |
155 "NetworkTechnology": "GSM", | 150 "NetworkTechnology": "GSM", |
156 "RoamingState": "home" | 151 "RoamingState": "home" |
157 }, | 152 }, |
158 "ConnectionState": "NotConnected", | 153 "ConnectionState": "NotConnected", |
159 "GUID": "stub_cellular1", | 154 "GUID": "stub_cellular1", |
160 "Name": "cellular1", | 155 "Name": "cellular1", |
161 "Type": "Cellular" | 156 "Type": "Cellular" |
162 }], result); | 157 }], result); |
163 })); | 158 })); |
164 }, | 159 }, |
165 function getVisibleNetworksWifi() { | 160 function getVisibleNetworksWifi() { |
166 chrome.networkingPrivate.getVisibleNetworks( | 161 chrome.networkingPrivate.getVisibleNetworks( |
167 "WiFi", | 162 "WiFi", |
168 callbackPass(function(result) { | 163 callbackPass(function(result) { |
169 assertEq([{ | 164 assertEq([{ |
170 "ConnectionState": "Connected", | 165 "ConnectionState": "Connected", |
171 "GUID": "stub_wifi1", | 166 "GUID": "stub_wifi1", |
172 "Name": "wifi1", | 167 "Name": "wifi1", |
173 "Type": "WiFi", | 168 "Type": "WiFi", |
174 "WiFi": { | 169 "WiFi": { |
175 "AutoConnect": false, | |
176 "Security": "WEP-PSK", | 170 "Security": "WEP-PSK", |
177 "SignalStrength": 0 | 171 "SignalStrength": 0 |
178 } | 172 } |
179 }, | 173 }, |
180 { | 174 { |
181 "ConnectionState": "NotConnected", | 175 "ConnectionState": "NotConnected", |
182 "GUID": "stub_wifi2", | 176 "GUID": "stub_wifi2", |
183 "Name": "wifi2_PSK", | 177 "Name": "wifi2_PSK", |
184 "Type": "WiFi", | 178 "Type": "WiFi", |
185 "WiFi": { | 179 "WiFi": { |
186 "AutoConnect": false, | |
187 "Security": "WPA-PSK", | 180 "Security": "WPA-PSK", |
188 "SignalStrength": 80 | 181 "SignalStrength": 80 |
189 } | 182 } |
190 } | 183 } |
191 ], result); | 184 ], result); |
192 })); | 185 })); |
193 }, | 186 }, |
194 function requestNetworkScan() { | 187 function requestNetworkScan() { |
195 // Connected or Connecting networks should be listed first, sorted by type. | 188 // Connected or Connecting networks should be listed first, sorted by type. |
196 var expected = ["stub_ethernet", | 189 var expected = ["stub_ethernet", |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 function getState() { | 292 function getState() { |
300 chrome.networkingPrivate.getState( | 293 chrome.networkingPrivate.getState( |
301 "stub_wifi2", | 294 "stub_wifi2", |
302 callbackPass(function(result) { | 295 callbackPass(function(result) { |
303 assertEq({ | 296 assertEq({ |
304 "ConnectionState": "NotConnected", | 297 "ConnectionState": "NotConnected", |
305 "GUID": "stub_wifi2", | 298 "GUID": "stub_wifi2", |
306 "Name": "wifi2_PSK", | 299 "Name": "wifi2_PSK", |
307 "Type": "WiFi", | 300 "Type": "WiFi", |
308 "WiFi": { | 301 "WiFi": { |
309 "AutoConnect": false, | |
310 "Security": "WPA-PSK", | 302 "Security": "WPA-PSK", |
311 "SignalStrength": 80 | 303 "SignalStrength": 80 |
312 } | 304 } |
313 }, result); | 305 }, result); |
314 })); | 306 })); |
315 }, | 307 }, |
316 function getStateNonExistent() { | 308 function getStateNonExistent() { |
317 chrome.networkingPrivate.getState( | 309 chrome.networkingPrivate.getState( |
318 'non_existent', | 310 'non_existent', |
319 callbackFail('Error.InvalidParameter')); | 311 callbackFail('Error.InvalidParameter')); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 callbackPass(function(result) { | 363 callbackPass(function(result) { |
372 assertEq("encrypted_data", result); | 364 assertEq("encrypted_data", result); |
373 })); | 365 })); |
374 } | 366 } |
375 ]; | 367 ]; |
376 | 368 |
377 var testToRun = window.location.search.substring(1); | 369 var testToRun = window.location.search.substring(1); |
378 chrome.test.runTests(availableTests.filter(function(op) { | 370 chrome.test.runTests(availableTests.filter(function(op) { |
379 return op.name == testToRun; | 371 return op.name == testToRun; |
380 })); | 372 })); |
OLD | NEW |