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

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

Issue 12541007: This adds the setProperties and getState functions to the networking API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed flag usage Created 7 years, 9 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 assertEq = chrome.test.assertEq; 8 var assertEq = chrome.test.assertEq;
9 9
10 // Test properties for the verification API. 10 // Test properties for the verification API.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 "Name": "wifi2_PSK", 158 "Name": "wifi2_PSK",
159 "Type": "WiFi", 159 "Type": "WiFi",
160 "WiFi": { 160 "WiFi": {
161 "SSID": "stub_wifi2", 161 "SSID": "stub_wifi2",
162 "Security": "WPA-PSK", 162 "Security": "WPA-PSK",
163 "SignalStrength": 80 163 "SignalStrength": 80
164 } 164 }
165 }, result); 165 }, result);
166 })); 166 }));
167 }, 167 },
168 function setProperties() {
169 var done = chrome.test.callbackAdded();
170 chrome.networkingPrivate.getProperties(
171 "stub_wifi2",
172 function(result) {
173 result.WiFi.Security = "WEP-PSK";
174 chrome.networkingPrivate.setProperties("stub_wifi2", result,
175 function() {
176 chrome.networkingPrivate.getProperties(
177 "stub_wifi2",
178 function(result) {
179 assertEq("WEP-PSK", result.WiFi.Security);
180 done();
181 });
182 });
183 });
184 },
185 function getState() {
186 chrome.networkingPrivate.getState(
187 "stub_wifi2",
188 callbackPass(function(result) {
189 assertEq({
190 "Cellular.ActivationState": "",
pneubeck (no reviews) 2013/03/07 13:06:18 After adding the translation, this dict should loo
Greg Spencer (Chromium) 2013/03/07 22:01:23 Right. I was wondering why they were off, and now
191 "Cellular.NetworkTechnology": "",
192 "Cellular.RoamingState": "",
193 "Device": "",
194 "Error": "",
195 "GUID": "",
196 "Name": "wifi2_PSK",
197 "Security": "psk",
198 "State": "idle",
199 "Strength": 80,
200 "Type": "wifi"
201 }, result);
202 }));
203 },
168 function onNetworksChangedEventConnect() { 204 function onNetworksChangedEventConnect() {
169 var network = "stub_wifi2"; 205 var network = "stub_wifi2";
170 var done = chrome.test.callbackAdded(); 206 var done = chrome.test.callbackAdded();
171 var expectedStates = ["Connected", "Connecting"]; 207 var expectedStates = ["Connected", "Connecting"];
172 var listener = 208 var listener =
173 new privateHelpers.watchForStateChanges(network, expectedStates, done); 209 new privateHelpers.watchForStateChanges(network, expectedStates, done);
174 chrome.networkingPrivate.startConnect(network, callbackPass()); 210 chrome.networkingPrivate.startConnect(network, callbackPass());
175 }, 211 },
176 function onNetworksChangedEventDisconnect() { 212 function onNetworksChangedEventDisconnect() {
177 var network = "stub_wifi1"; 213 var network = "stub_wifi1";
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 callbackPass(function(result) { 251 callbackPass(function(result) {
216 assertEq("encrypted_data", result); 252 assertEq("encrypted_data", result);
217 })); 253 }));
218 } 254 }
219 ]; 255 ];
220 256
221 var testToRun = window.location.search.substring(1); 257 var testToRun = window.location.search.substring(1);
222 chrome.test.runTests(availableTests.filter(function(op) { 258 chrome.test.runTests(availableTests.filter(function(op) {
223 return op.name == testToRun; 259 return op.name == testToRun;
224 })); 260 }));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698