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

Unified Diff: chrome/browser/extensions/extension_keybinding_apitest_new.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_new.cc
diff --git a/chrome/browser/extensions/extension_keybinding_apitest_new.cc b/chrome/browser/extensions/extension_keybinding_apitest_new.cc
index 21d8da22da6cd48cbc91baf08ae1ee191321d361..848a799b4920a7fd437ce58de67d0023c50d7ce9 100644
--- a/chrome/browser/extensions/extension_keybinding_apitest_new.cc
+++ b/chrome/browser/extensions/extension_keybinding_apitest_new.cc
@@ -43,6 +43,14 @@ class ScriptBadgesCommandsApiTest : public ExtensionApiTest {
switches::kScriptBadges, "1");
}
virtual ~ScriptBadgesCommandsApiTest() {}
+
+ bool IsGrantedForTab(const Extension* extension,
+ const content::WebContents* web_contents) {
+ return PermissionsData::HasAPIPermissionForTab(
+ extension,
+ SessionID::IdForTab(web_contents),
+ APIPermission::kTab);
+ }
};
// Test the basic functionality of the Keybinding API:
@@ -73,16 +81,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;
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_apitest.cc ('k') | chrome/common/extensions/api/tab_capture.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698