Index: chrome/test/data/extensions/api_test/permissions/optional_policy_blocked/background.js |
diff --git a/chrome/test/data/extensions/api_test/permissions/optional_policy_blocked/background.js b/chrome/test/data/extensions/api_test/permissions/optional_policy_blocked/background.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8c026927dbf0018f5d8481664495a3d382e453a2 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/permissions/optional_policy_blocked/background.js |
@@ -0,0 +1,27 @@ |
+// Copyright 2014 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. |
+ |
+var assertTrue = chrome.test.assertTrue; |
+var fail = chrome.test.callbackFail; |
+var pass = chrome.test.callbackPass; |
+ |
+var BLOCKED_BY_ENTERPRISE_ERROR = |
+ "Permissions are blocked by enterprise policy."; |
+ |
+chrome.test.getConfig(function(config) { |
+ |
+ chrome.test.runTests([ |
+ function allowedPermission() { |
+ chrome.permissions.request( |
+ {permissions:['bookmarks']}, |
+ pass(function(granted) { assertTrue(granted); })); |
+ }, |
+ |
+ function allowedPermission() { |
+ chrome.permissions.request( |
+ {permissions:['management']}, |
+ fail(BLOCKED_BY_ENTERPRISE_ERROR)); |
+ } |
+ ]); |
+}); |