| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 // Test that verifies that apps with only networking API alias permission |
| 6 // can invoke API methods and listen to API events without encountering |
| 7 // API access problems. |
| 8 |
| 9 chrome.test.runTests([ |
| 10 function onlyAliasBindingsPresent() { |
| 11 chrome.test.assertTrue(!!chrome.networking); |
| 12 chrome.test.assertTrue(!!chrome.networking.onc); |
| 13 |
| 14 chrome.test.assertFalse(!!chrome.networkingPrivate); |
| 15 chrome.test.succeed(); |
| 16 }, |
| 17 function getProperties() { |
| 18 chrome.networking.onc.getProperties( |
| 19 'stub_wifi1_guid', |
| 20 chrome.test.callbackPass(function(result) { |
| 21 chrome.test.assertEq('stub_wifi1_guid', result.GUID); |
| 22 chrome.test.assertEq( |
| 23 chrome.networking.onc.ConnectionStateType.CONNECTED, |
| 24 result.ConnectionState); |
| 25 chrome.test.assertEq('User', result.Source); |
| 26 })); |
| 27 }, |
| 28 function changeConnectionStateAndWaitForNetworksChanged() { |
| 29 chrome.test.listenOnce( |
| 30 chrome.networking.onc.onNetworksChanged, |
| 31 function(networks) { |
| 32 chrome.test.assertEq(['stub_wifi1_guid'], networks); |
| 33 }); |
| 34 chrome.networking.onc.startDisconnect( |
| 35 'stub_wifi1_guid', |
| 36 chrome.test.callbackPass(function() {})); |
| 37 }, |
| 38 function verifyConnectionStateChanged() { |
| 39 chrome.networking.onc.getProperties( |
| 40 'stub_wifi1_guid', |
| 41 chrome.test.callbackPass(function(result) { |
| 42 chrome.test.assertEq('stub_wifi1_guid', result.GUID); |
| 43 chrome.test.assertFalse( |
| 44 result.ConnectionState == |
| 45 chrome.networking.onc.ConnectionStateType.CONNECTED); |
| 46 })); |
| 47 } |
| 48 ]); |
| OLD | NEW |