Elim cr-checkbox
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / networking_config / full_test.js
blob12ab6428f571485367f9868756306b8ae33e920b
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.
5 'use strict';
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);
17 var expectedInfo = {
18 Type: 'WiFi',
19 GUID: 'wifi1_guid',
20 SSID: 'wifi1',
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);
30 });
31 // This hands control back to C++.
32 succeed();
35 chrome.test.runTests([onDetectionTest]);
36 });
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
41 // above.
42 chrome.networking.config.setNetworkFilter([{Type: 'WiFi', SSID: 'wifi1'}],
43 callbackPass());
46 chrome.test.runTests([initialSetupTest]);