1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 var assertEq
= chrome
.test
.assertEq
;
8 var assertTrue
= chrome
.test
.assertTrue
;
9 var fail
= chrome
.test
.fail
;
10 var succeed
= chrome
.test
.succeed
;
11 var callbackPass
= chrome
.test
.callbackPass
;
13 chrome
.networking
.config
.onCaptivePortalDetected
.addListener(
14 function(networkInfo
) {
15 function onDetectionTest() {
16 assertTrue(!chrome
.runtime
.lastError
);
21 HexSSID
: '7769666931',
22 BSSID
: '01:02:ab:7f:90:00'
24 assertEq(expectedInfo
, networkInfo
);
25 chrome
.networking
.config
.finishAuthentication(
26 networkInfo
.GUID
, 'succeeded', function() {
27 if (chrome
.runtime
.lastError
) {
28 fail(chrome
.runtime
.lastError
.message
);
31 // This hands control back to C++.
35 chrome
.test
.runTests([onDetectionTest
]);
38 function initialSetupTest() {
39 // |callbackPass()| will hand control back to the test in C++, which will
40 // trigger an |onCaptivePortalDetected| event that is handled by the listener
42 chrome
.networking
.config
.setNetworkFilter([{Type
: 'WiFi', SSID
: 'wifi1'}],
46 chrome
.test
.runTests([initialSetupTest
]);