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

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

Issue 1665563003: Ask for notification permission during extension installation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 assertEq = chrome.test.assertEq; 5 var assertEq = chrome.test.assertEq;
6 var assertFalse = chrome.test.assertFalse; 6 var assertFalse = chrome.test.assertFalse;
7 var assertTrue = chrome.test.assertTrue; 7 var assertTrue = chrome.test.assertTrue;
8 var assertThrows = chrome.test.assertThrows; 8 var assertThrows = chrome.test.assertThrows;
9 var fail = chrome.test.callbackFail; 9 var fail = chrome.test.callbackFail;
10 var pass = chrome.test.callbackPass; 10 var pass = chrome.test.callbackPass;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 assertThrows( 199 assertThrows(
200 chrome.bookmarks.getTree, [function(){}], 200 chrome.bookmarks.getTree, [function(){}],
201 "'bookmarks' requires a different Feature that is not present."); 201 "'bookmarks' requires a different Feature that is not present.");
202 } 202 }
203 )); 203 ));
204 }, 204 },
205 205
206 // The user shouldn't have to approve permissions that have no warnings. 206 // The user shouldn't have to approve permissions that have no warnings.
207 function noPromptForNoWarnings() { 207 function noPromptForNoWarnings() {
208 chrome.permissions.request( 208 chrome.permissions.request(
209 {permissions: ['notifications']}, 209 {permissions: ['cookies']},
210 pass(function(granted) { 210 pass(function(granted) {
211 assertTrue(granted); 211 assertTrue(granted);
212 212
213 // Remove the notifications permission to return to normal. 213 // Remove the cookies permission to return to normal.
214 chrome.permissions.remove( 214 chrome.permissions.remove(
215 {permissions: ['notifications']}, 215 {permissions: ['cookies']},
216 pass(function(removed) { assertTrue(removed); })); 216 pass(function(removed) { assertTrue(removed); }));
217 })); 217 }));
218 }, 218 },
219 219
220 // Make sure you can only access the white listed permissions. 220 // Make sure you can only access the white listed permissions.
221 function whitelist() { 221 function whitelist() {
222 var error_msg = NOT_WHITE_LISTED_ERROR.replace('*', 'cloudPrintPrivate'); 222 var error_msg = NOT_WHITE_LISTED_ERROR.replace('*', 'cloudPrintPrivate');
223 chrome.permissions.request( 223 chrome.permissions.request(
224 {permissions: ['cloudPrintPrivate']}, fail(error_msg)); 224 {permissions: ['cloudPrintPrivate']}, fail(error_msg));
225 chrome.permissions.remove( 225 chrome.permissions.remove(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 assertTrue(granted); 305 assertTrue(granted);
306 chrome.permissions.remove( 306 chrome.permissions.remove(
307 {permissions: ['bookmarks']}, pass(function() { 307 {permissions: ['bookmarks']}, pass(function() {
308 assertTrue(true); 308 assertTrue(true);
309 })); 309 }));
310 })); 310 }));
311 } 311 }
312 312
313 ]); 313 ]);
314 }); 314 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698