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

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

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ETU now SetString()'s for empty values 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) 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 theOnlyTestDone = null; 5 var theOnlyTestDone = null;
6 6
7 function inject(callback) { 7 function inject(callback) {
8 chrome.tabs.executeScript({ code: "true" }, callback); 8 chrome.tabs.executeScript({ code: "true" }, callback);
9 } 9 }
10 10
11 chrome.browserAction.onClicked.addListener(function() { 11 chrome.browserAction.onClicked.addListener(function() {
12 inject(function() { 12 inject(function() {
13 chrome.test.assertNoLastError(); 13 chrome.test.assertNoLastError();
14 chrome.test.notifyPass(); 14 chrome.test.notifyPass();
15 }); 15 });
16 }); 16 });
17 17
18 chrome.webNavigation.onCompleted.addListener(function(details) { 18 chrome.webNavigation.onCompleted.addListener(function(details) {
19 inject(function() { 19 inject(function() {
20 chrome.test.assertLastError("Access to extension API denied."); 20 chrome.test.assertLastError('Cannot access contents of url "' +
21 details.url +
22 '". Extension manifest must request permission to access this host.');
21 if (details.url.indexOf("final_page") >= 0) 23 if (details.url.indexOf("final_page") >= 0)
22 theOnlyTestDone(); 24 theOnlyTestDone();
23 else 25 else
24 chrome.test.notifyPass(); 26 chrome.test.notifyPass();
25 }); 27 });
26 }); 28 });
27 29
28 chrome.test.runTests([ 30 chrome.test.runTests([
29 function theOnlyTest() { 31 function theOnlyTest() {
30 // This will keep the test alive until the final callback is run. 32 // This will keep the test alive until the final callback is run.
31 theOnlyTestDone = chrome.test.callbackAdded(); 33 theOnlyTestDone = chrome.test.callbackAdded();
32 } 34 }
33 ]); 35 ]);
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | chrome/test/data/extensions/api_test/active_tab/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698