Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/test/data/extensions/api_test/networking/test.js

Issue 280023003: Implement networkingPrivate.getNetworks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 chrome.networkingPrivate.getProperties( 114 chrome.networkingPrivate.getProperties(
115 guid, 115 guid,
116 callbackPass(function(properties) { 116 callbackPass(function(properties) {
117 assertEq("WiFi", properties.Type); 117 assertEq("WiFi", properties.Type);
118 assertEq(guid, properties.GUID); 118 assertEq(guid, properties.GUID);
119 assertEq("wifi_created", properties.WiFi.SSID); 119 assertEq("wifi_created", properties.WiFi.SSID);
120 assertEq("WEP-PSK", properties.WiFi.Security); 120 assertEq("WEP-PSK", properties.WiFi.Security);
121 })); 121 }));
122 })); 122 }));
123 }, 123 },
124 function getNetworks() {
125 // Test 'type' and 'configured'.
126 chrome.networkingPrivate.getNetworks(
127 { "type": "WiFi", "visible": false, "configured": true },
128 callbackPass(function(result) {
129 assertEq([{
130 "Connectable": true,
131 "ConnectionState": "Connected",
132 "GUID": "stub_wifi1",
133 "Name": "wifi1",
134 "Type": "WiFi",
135 "WiFi": {
136 "Security": "WEP-PSK",
137 "SignalStrength": 40
138 }
139 }, {
140 "Connectable": true,
141 "ConnectionState": "NotConnected",
142 "GUID": "stub_wifi2",
143 "Name": "wifi2_PSK",
144 "Type": "WiFi",
145 "WiFi": {
146 "Security": "WPA-PSK",
147 "SignalStrength": 80
148 }
149 }], result);
150 // Test 'limit'.
151 chrome.networkingPrivate.getNetworks(
152 { "type": "All", "visible": false, "configured": true, "limit": 1 },
153 callbackPass(function(result) {
154 assertEq([{
155 "ConnectionState": "Connected",
156 "Ethernet": {
157 "Authentication": "None"
158 },
159 "GUID": "stub_ethernet",
160 "Name": "eth0",
161 "Type": "Ethernet"
162 }], result);
163 }));
164 }));
165 },
124 function getVisibleNetworks() { 166 function getVisibleNetworks() {
125 chrome.networkingPrivate.getVisibleNetworks( 167 chrome.networkingPrivate.getVisibleNetworks(
126 "All", 168 "All",
127 callbackPass(function(result) { 169 callbackPass(function(result) {
128 assertEq([{ 170 assertEq([{
129 "ConnectionState": "Connected", 171 "ConnectionState": "Connected",
130 "Ethernet": { 172 "Ethernet": {
131 "Authentication": "None" 173 "Authentication": "None"
132 }, 174 },
133 "GUID": "stub_ethernet", 175 "GUID": "stub_ethernet",
134 "Name": "eth0", 176 "Name": "eth0",
135 "Type": "Ethernet" 177 "Type": "Ethernet"
136 }, 178 },
137 { 179 {
138 "Connectable": true, 180 "Connectable": true,
139 "ConnectionState": "Connected", 181 "ConnectionState": "Connected",
140 "GUID": "stub_wifi1", 182 "GUID": "stub_wifi1",
141 "Name": "wifi1", 183 "Name": "wifi1",
142 "Type": "WiFi", 184 "Type": "WiFi",
143 "WiFi": { 185 "WiFi": {
144 "Security": "WEP-PSK", 186 "Security": "WEP-PSK",
145 "SignalStrength": 40 187 "SignalStrength": 40
146 } 188 }
147 }, 189 },
148 { 190 {
149 "ConnectionState": "Connected", 191 "ConnectionState": "Connected",
150 "GUID": "stub_vpn1", 192 "GUID": "stub_vpn1",
151 "Name": "vpn1", 193 "Name": "vpn1",
152 "Type": "VPN", 194 "Type": "VPN"
153 }, 195 },
154 { 196 {
155 "Connectable": true, 197 "Connectable": true,
156 "ConnectionState": "NotConnected", 198 "ConnectionState": "NotConnected",
157 "GUID": "stub_wifi2", 199 "GUID": "stub_wifi2",
158 "Name": "wifi2_PSK", 200 "Name": "wifi2_PSK",
159 "Type": "WiFi", 201 "Type": "WiFi",
160 "WiFi": { 202 "WiFi": {
161 "Security": "WPA-PSK", 203 "Security": "WPA-PSK",
162 "SignalStrength": 80 204 "SignalStrength": 80
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 var listener = 469 var listener =
428 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done); 470 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done);
429 chrome.test.sendMessage('notifyPortalDetectorObservers'); 471 chrome.test.sendMessage('notifyPortalDetectorObservers');
430 }, 472 },
431 ]; 473 ];
432 474
433 var testToRun = window.location.search.substring(1); 475 var testToRun = window.location.search.substring(1);
434 chrome.test.runTests(availableTests.filter(function(op) { 476 chrome.test.runTests(availableTests.filter(function(op) {
435 return op.name == testToRun; 477 return op.name == testToRun;
436 })); 478 }));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698