diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-24 01:30:11 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-24 01:30:11 +0000 |
commit | 938023f551e85235e39ec7a9ebbb4cd94764d9f0 (patch) | |
tree | 0c87d3690e8e233aa702acfd1bf4a61550c6e629 /chrome/test | |
parent | 789b0707ad5bd87470c3ca37eaf20f0f5490715c (diff) | |
download | chromium_src-938023f551e85235e39ec7a9ebbb4cd94764d9f0.zip chromium_src-938023f551e85235e39ec7a9ebbb4cd94764d9f0.tar.gz chromium_src-938023f551e85235e39ec7a9ebbb4cd94764d9f0.tar.bz2 |
tab capture: Change the permissions for tabs.captureVisibleTab().
Require an extension to have '<all_urls>' permission, or been granted the
'activeTab' permission to be allowed to use tabs.captureVisibleTab().
BUG=83432
R=kalman@chromium.org
Review URL: https://codereview.chromium.org/140433003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
3 files changed, 1 insertions, 52 deletions
diff --git a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/manifest.json b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/manifest.json index 817f8e7..c872ae4 100644 --- a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/manifest.json +++ b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/manifest.json @@ -3,5 +3,5 @@ "version": "0.1", "manifest_version": 2, "description": "end-to-end browser test for chrome.tabs.captureVisibleTab", - "permissions": ["tabs", "http://a.com/", "file:///*"] + "permissions": ["tabs", "<all_urls>"] } diff --git a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_nofile.html b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_nofile.html deleted file mode 100644 index 336f312..0000000 --- a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_nofile.html +++ /dev/null @@ -1,7 +0,0 @@ -<!-- - * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this - * source code is governed by a BSD-style license that can be found in the - * LICENSE file. ---> -<script src="common/tabs_util.js"></script> -<script src="test_nofile.js"></script> diff --git a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_nofile.js b/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_nofile.js deleted file mode 100644 index 56ccc50..0000000 --- a/chrome/test/data/extensions/api_test/tabs/capture_visible_tab/test_nofile.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// API test for chrome.tabs.captureVisibleTab(), capturing JPEG images. -// browser_tests.exe --gtest_filter=ExtensionApiTest.CaptureVisibleNoFile - -var pass = chrome.test.callbackPass; -var fail = chrome.test.callbackFail; -var assertEq = chrome.test.assertEq; -var assertTrue = chrome.test.assertTrue; -var assertFalse = chrome.test.assertFalse; - -var kWindowRect = { - 'width': 400, - 'height': 400 -}; - -var fail_url = "file:///nosuch.html"; - -chrome.test.runTests([ - // Check that test infrastructure launched us without permissions. - function checkAllowedNoAccess() { - chrome.extension.isAllowedFileSchemeAccess(pass(function(hasAccess) { - assertFalse(hasAccess); - })); - }, - - // Check for no permssions error. - function captureVisibleNoFile() { - createWindow([fail_url], kWindowRect, pass(function(winId, tabIds) { - waitForAllTabs(pass(function() { - chrome.tabs.getSelected(winId, pass(function(tab) { - assertEq('complete', tab.status); - chrome.tabs.captureVisibleTab(winId, fail( - 'Cannot access contents of url "' + fail_url + - '". Extension manifest must request permission ' + - 'to access this host.')); - })); - })); - })); - } - -]); |