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

Unified Diff: chrome/test/data/extensions/api_test/networking_private/alias/test.js

Issue 2470193002: Introduce networking.onc as an alias for networkingPrivate (Closed)
Patch Set: allow optional permission Created 4 years 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 side-by-side diff with in-line comments
Download patch
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..b724e7b2228755da5ec2c98d469a0b9964a29d6b
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/networking_private/alias/test.js
@@ -0,0 +1,48 @@
+// 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 onlyAliasBindingsPresent() {
+ chrome.test.assertTrue(!!chrome.networking);
+ chrome.test.assertTrue(!!chrome.networking.onc);
+
+ chrome.test.assertFalse(!!chrome.networkingPrivate);
+ chrome.test.succeed();
+ },
+ 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);
+ }));
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698