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

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

Issue 225413005: Added event to networkingPrivate extension that portal detection is completed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 6 years, 8 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
« no previous file with comments | « chrome/common/extensions/api/networking_private.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 this.onNetworkChange); 48 this.onNetworkChange);
49 }, 49 },
50 listListener: function(expected, done) { 50 listListener: function(expected, done) {
51 var self = this; 51 var self = this;
52 this.listenForChanges = function(list) { 52 this.listenForChanges = function(list) {
53 assertEq(expected, list); 53 assertEq(expected, list);
54 chrome.networkingPrivate.onNetworkListChanged.removeListener( 54 chrome.networkingPrivate.onNetworkListChanged.removeListener(
55 self.listenForChanges); 55 self.listenForChanges);
56 done(); 56 done();
57 }; 57 };
58 },
59 watchForCaptivePortalState: function(expectedNetworkPath,
60 expectedState,
61 done) {
62 var self = this;
63 this.onPortalDetectionCompleted = function(networkPath, state) {
64 assertEq(expectedNetworkPath, networkPath);
65 assertEq(expectedState, state);
66 chrome.networkingPrivate.onPortalDetectionCompleted.removeListener(
67 self.onPortalDetectionCompleted);
68 done();
69 };
70 chrome.networkingPrivate.onPortalDetectionCompleted.addListener(
71 self.onPortalDetectionCompleted);
58 } 72 }
59 }; 73 };
60 74
61 var availableTests = [ 75 var availableTests = [
62 function startConnect() { 76 function startConnect() {
63 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass()); 77 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass());
64 }, 78 },
65 function startDisconnect() { 79 function startDisconnect() {
66 // Must connect to a network before we can disconnect from it. 80 // Must connect to a network before we can disconnect from it.
67 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass( 81 chrome.networkingPrivate.startConnect("stub_wifi2", callbackPass(
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 ['stub_vpn1', 'Unknown']]; 404 ['stub_vpn1', 'Unknown']];
391 networks.forEach(function(network) { 405 networks.forEach(function(network) {
392 var servicePath = network[0]; 406 var servicePath = network[0];
393 var expectedStatus = network[1]; 407 var expectedStatus = network[1];
394 chrome.networkingPrivate.getCaptivePortalStatus( 408 chrome.networkingPrivate.getCaptivePortalStatus(
395 servicePath, 409 servicePath,
396 callbackPass(function(status) { 410 callbackPass(function(status) {
397 assertEq(expectedStatus, status); 411 assertEq(expectedStatus, status);
398 })); 412 }));
399 }); 413 });
400 } 414 },
415 function captivePortalNotification() {
416 var done = chrome.test.callbackAdded();
417 var listener =
418 new privateHelpers.watchForCaptivePortalState('wifi', 'Online', done);
419 chrome.test.sendMessage('notifyPortalDetectorObservers');
420 },
401 ]; 421 ];
402 422
403 var testToRun = window.location.search.substring(1); 423 var testToRun = window.location.search.substring(1);
404 chrome.test.runTests(availableTests.filter(function(op) { 424 chrome.test.runTests(availableTests.filter(function(op) {
405 return op.name == testToRun; 425 return op.name == testToRun;
406 })); 426 }));
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/networking_private.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698