Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/networking_private/alias/test.js |
| diff --git a/chrome/test/data/extensions/api_test/networking_private/alias/test.js b/chrome/test/data/extensions/api_test/networking_private/alias/test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..55bed4f74056346500a4ed5527ec8776e60a4e2a |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/networking_private/alias/test.js |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Test that verifies that apps with only networking API alias permission |
| +// can invoke API methods and listen to API events without encountering |
| +// API access problems. |
| + |
| +chrome.test.runTests([ |
| + function getProperties() { |
| + chrome.networking.onc.getProperties( |
| + 'stub_wifi1_guid', |
| + chrome.test.callbackPass(function(result) { |
| + chrome.test.assertEq('stub_wifi1_guid', result.GUID); |
| + chrome.test.assertEq( |
| + chrome.networking.onc.ConnectionStateType.CONNECTED, |
| + result.ConnectionState); |
| + chrome.test.assertEq('User', result.Source); |
| + })); |
| + }, |
| + function changeConnectionStateAndWaitForNetworksChanged() { |
| + chrome.test.listenOnce( |
| + chrome.networking.onc.onNetworksChanged, |
| + function(networks) { |
| + chrome.test.assertEq(['stub_wifi1_guid'], networks); |
| + }); |
| + chrome.networking.onc.startDisconnect( |
| + 'stub_wifi1_guid', |
| + chrome.test.callbackPass(function() {})); |
| + }, |
| + function verifyConnectionStateChanged() { |
| + chrome.networking.onc.getProperties( |
| + 'stub_wifi1_guid', |
| + chrome.test.callbackPass(function(result) { |
| + chrome.test.assertEq('stub_wifi1_guid', result.GUID); |
| + chrome.test.assertFalse( |
| + result.ConnectionState == |
| + chrome.networking.onc.ConnectionStateType.CONNECTED); |
| + })); |
| + } |
|
Devlin
2016/12/12 23:25:47
Can we add a test that this extension cannot acces
tbarzic
2016/12/12 23:55:42
Done.
|
| +]); |