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

Side by Side Diff: chrome/test/data/extensions/api_test/permissions/optional_deny/background.html

Issue 7432006: Add an experimental permissions API for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 9 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <script>
2
3 var assertFalse = chrome.test.assertFalse;
4 var assertTrue = chrome.test.assertTrue;
5 var pass = chrome.test.callbackPass;
6
7 var NO_TABS_PERMISSION =
8 "You do not have permission to use 'windows.getAll'.";
9
10 chrome.test.runTests([
11 function denyRequest() {
12 chrome.experimental.permissions.request(
13 {permissions: ['tabs']},
14 pass(function(granted) {
15 // They were not granted, and there should be no error.
16 assertFalse(granted);
17 assertTrue(chrome.extension.lastError === undefined);
18
19 // Make sure they weren't granted...
20 chrome.experimental.permissions.contains(
21 {permissions: ['tabs']},
22 pass(function(result) {
23 assertFalse(result);
24 }));
25
26 try {
27 chrome.windows.getAll({populate: true}, function() {
28 chrome.test.fail("Should not have tabs API permission.");
29 });
30 } catch (e) {
31 assertTrue(e.message.indexOf(NO_TABS_PERMISSION) == 0);
32 }
33 }));
34 }
35 ]);
36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698