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

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: . Created 9 years, 5 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.permissions.request({apis: ['tabs']}, pass(function(granted) {
13 // They were not granted, and there should be no error.
14 assertFalse(granted);
15 assertTrue(chrome.extension.lastError === undefined);
16
17 // Make sure they weren't granted...
18 chrome.permissions.contains({apis: ['tabs']}, pass(function(result) {
19 assertFalse(result);
20 }));
21
22 try {
23 chrome.windows.getAll({populate: true}, function() {
24 assertTrue(false);
Mihai Parparita -not on Chrome 2011/07/20 22:03:43 Ditto about using chrome.test.fail("Should not hav
jstritar 2011/07/22 19:21:55 Done.
25 });
26 } catch (e) {
27 assertTrue(e.message.indexOf(NO_TABS_PERMISSION) == 0);
28 }
29 }));
30 }
31 ]);
32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698