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

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

Issue 15961006: Regenerate Extensions API bindings when optional permissions change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try againto fix android Created 7 years, 6 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
« no previous file with comments | « chrome/test/data/extensions/api_test/permissions/optional/background.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var assertFalse = chrome.test.assertFalse; 5 var assertFalse = chrome.test.assertFalse;
6 var assertTrue = chrome.test.assertTrue; 6 var assertTrue = chrome.test.assertTrue;
7 var assertEq = chrome.test.assertEq;
7 var pass = chrome.test.callbackPass; 8 var pass = chrome.test.callbackPass;
8 9
9 var NO_BOOKMARKS_PERMISSION = 10 var NO_BOOKMARKS_PERMISSION =
10 "You do not have permission to use 'bookmarks.getTree'."; 11 "You do not have permission to use 'bookmarks.getTree'.";
11 12
12 chrome.test.getConfig(function(config) { 13 chrome.test.getConfig(function(config) {
13 14
14 function doReq(domain, callback) { 15 function doReq(domain, callback) {
15 var req = new XMLHttpRequest(); 16 var req = new XMLHttpRequest();
16 var url = domain + ":PORT/files/extensions/test_file.txt"; 17 var url = domain + ":PORT/files/extensions/test_file.txt";
(...skipping 24 matching lines...) Expand all
41 pass(function(granted) { 42 pass(function(granted) {
42 // They were not granted, and there should be no error. 43 // They were not granted, and there should be no error.
43 assertFalse(granted); 44 assertFalse(granted);
44 assertTrue(chrome.runtime.lastError === undefined); 45 assertTrue(chrome.runtime.lastError === undefined);
45 46
46 // Make sure they weren't granted... 47 // Make sure they weren't granted...
47 chrome.permissions.contains( 48 chrome.permissions.contains(
48 {permissions: ['bookmarks'], origins:['http://*.c.com/*']}, 49 {permissions: ['bookmarks'], origins:['http://*.c.com/*']},
49 pass(function(result) { assertFalse(result); })); 50 pass(function(result) { assertFalse(result); }));
50 51
51 try { 52 assertEq(undefined, chrome.bookmarks);
52 chrome.bookmarks.getTree(function() {
53 chrome.test.fail("Should not have bookmarks API permission.");
54 });
55 } catch (e) {
56 assertTrue(e.message.indexOf(NO_BOOKMARKS_PERMISSION) == 0);
57 }
58
59 doReq('http://b.c.com/', pass(function(result) { 53 doReq('http://b.c.com/', pass(function(result) {
60 assertFalse(result); 54 assertFalse(result);
61 })); 55 }));
62 })); 56 }));
63 }, 57 },
64 58
65 function noPromptForActivePermissions() { 59 function noPromptForActivePermissions() {
66 // We shouldn't prompt if the extension already has the permissions. 60 // We shouldn't prompt if the extension already has the permissions.
67 chrome.permissions.request( 61 chrome.permissions.request(
68 {permissions: ["management"]}, 62 {permissions: ["management"]},
69 pass(function(granted) { 63 pass(function(granted) {
70 assertTrue(granted); 64 assertTrue(granted);
71 })); 65 }));
72 } 66 }
73 ]); 67 ]);
74 }); 68 });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/permissions/optional/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698