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

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

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed sample extensions Created 8 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // All of the calls to chrome.* functions should fail, since this extension 5 // All of the calls to chrome.* functions should fail, with the exception of
6 // has requested no permissions. 6 // chrome.tabs.*, since this extension has requested no permissions.
7 7
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 function history() { 9 function history() {
10 try { 10 try {
11 var query = { 'text': '', 'maxResults': 1 }; 11 var query = { 'text': '', 'maxResults': 1 };
12 chrome.history.search(query, function(results) { 12 chrome.history.search(query, function(results) {
13 chrome.test.fail(); 13 chrome.test.fail();
14 }); 14 });
15 } catch (e) { 15 } catch (e) {
16 chrome.test.succeed(); 16 chrome.test.succeed();
17 } 17 }
18 }, 18 },
19 19
20 function bookmarks() { 20 function bookmarks() {
21 try { 21 try {
22 chrome.bookmarks.get("1", function(results) { 22 chrome.bookmarks.get("1", function(results) {
23 chrome.test.fail(); 23 chrome.test.fail();
24 }); 24 });
25 } catch (e) { 25 } catch (e) {
26 chrome.test.succeed(); 26 chrome.test.succeed();
27 } 27 }
28 }, 28 },
29 29
30 // Tabs functionality should be enabled even if the tabs permissions are not
31 // present.
30 function tabs() { 32 function tabs() {
31 try { 33 try {
32 chrome.tabs.getSelected(null, function(results) { 34 chrome.tabs.create({'url': '1'}, function(tab) {
33 chrome.test.fail(); 35 // Tabs strip sensitive data without permissions.
36 chrome.test.assertEq('', tab.url);
37 chrome.test.succeed();
34 }); 38 });
35 } catch (e) { 39 } catch (e) {
36 chrome.test.succeed(); 40 chrome.test.fail();
37 } 41 }
38 }, 42 },
39 43
40 function idle() { 44 function idle() {
41 try { 45 try {
42 chrome.idle.queryState(60, function(state) { 46 chrome.idle.queryState(60, function(state) {
43 chrome.test.fail(); 47 chrome.test.fail();
44 }); 48 });
45 } catch (e) { 49 } catch (e) {
46 chrome.test.succeed(); 50 chrome.test.succeed();
47 } 51 }
48 } 52 }
49 ]); 53 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698