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

Unified Diff: chrome/browser/extensions/extension_keybinding_apitest.cc

Issue 17298002: Allow tabCapture API to be granted for chrome:// pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests.. how did it even work before? Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_keybinding_apitest.cc
diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc
index 07906a18b79c18956c16bb9ed74de4674f3dd134..80281949ebbc4c1fe8bb6f0d2b8eec47bf19a843 100644
--- a/chrome/browser/extensions/extension_keybinding_apitest.cc
+++ b/chrome/browser/extensions/extension_keybinding_apitest.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/permissions/permissions_data.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
@@ -32,6 +33,14 @@ class CommandsApiTest : public ExtensionApiTest {
BrowserActionTestUtil GetBrowserActionsBar() {
return BrowserActionTestUtil(browser());
}
+
+ bool IsGrantedForTab(const Extension* extension,
+ const content::WebContents* web_contents) {
+ return PermissionsData::HasAPIPermissionForTab(
+ extension,
+ SessionID::IdForTab(web_contents),
+ APIPermission::kTab);
+ }
};
class ScriptBadgesCommandsApiTest : public ExtensionApiTest {
@@ -73,16 +82,14 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) {
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(tab);
- ActiveTabPermissionGranter* granter =
- TabHelper::FromWebContents(tab)->active_tab_permission_granter();
- EXPECT_FALSE(granter->IsGranted(extension));
+ EXPECT_FALSE(IsGrantedForTab(extension, tab));
// Activate the shortcut (Ctrl+Shift+F).
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), ui::VKEY_F, true, true, false, false));
// activeTab should now be granted.
- EXPECT_TRUE(granter->IsGranted(extension));
+ EXPECT_TRUE(IsGrantedForTab(extension, tab));
// Verify the command worked.
bool result = false;

Powered by Google App Engine
This is Rietveld 408576698