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

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

Issue 309533007: Refactor PermissionsData pt1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/active_tab_unittest.cc
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc
index 735204c50f7ed5159dbef35fadfaa857b2c27f69..9a0b2f5685d910556a923b8735141eebff17d45f 100644
--- a/chrome/browser/extensions/active_tab_unittest.cc
+++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -107,10 +107,12 @@ class ActiveTabTest : public ChromeRenderViewHostTestHarness {
const GURL& url,
PermittedFeature feature,
int tab_id) {
- bool script = PermissionsData::CanExecuteScriptOnPage(
- extension.get(), url, url, tab_id, NULL, -1, NULL);
+ bool script =
+ PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ extension, url, url, tab_id, NULL, -1, NULL);
bool capture = HasTabsPermission(extension, tab_id) &&
- PermissionsData::CanCaptureVisiblePage(extension.get(), tab_id, NULL);
+ PermissionsData::ForExtension(extension)
not at google - send to devlin 2014/06/02 23:20:06 here
Devlin 2014/06/03 15:28:21 Done.
+ ->CanCaptureVisiblePage(tab_id, NULL);
switch (feature) {
case PERMITTED_SCRIPT_ONLY:
return script && !capture;
@@ -142,16 +144,14 @@ class ActiveTabTest : public ChromeRenderViewHostTestHarness {
bool HasTabsPermission(const scoped_refptr<const Extension>& extension,
int tab_id) {
- return PermissionsData::HasAPIPermissionForTab(
- extension.get(), tab_id, APIPermission::kTab);
+ return PermissionsData::ForExtension(extension)
+ ->HasAPIPermissionForTab(tab_id, APIPermission::kTab);
}
bool IsGrantedForTab(const Extension* extension,
const content::WebContents* web_contents) {
- return PermissionsData::HasAPIPermissionForTab(
- extension,
- SessionID::IdForTab(web_contents),
- APIPermission::kTab);
+ return PermissionsData::ForExtension(extension)->HasAPIPermissionForTab(
+ SessionID::IdForTab(web_contents), APIPermission::kTab);
}
// TODO(justinlin): Remove when tabCapture is moved to stable.
@@ -369,16 +369,14 @@ TEST_F(ActiveTabTest, ChromeUrlGrants) {
// Do not grant tabs/hosts permissions for tab.
EXPECT_TRUE(IsAllowed(extension_with_tab_capture, internal,
PERMITTED_CAPTURE_ONLY));
- EXPECT_TRUE(PermissionsData::HasAPIPermissionForTab(
- extension_with_tab_capture.get(),
- tab_id(),
- APIPermission::kTabCaptureForTab));
+ EXPECT_TRUE(
+ PermissionsData::ForExtension(extension_with_tab_capture)
+ ->HasAPIPermissionForTab(tab_id(), APIPermission::kTabCaptureForTab));
EXPECT_TRUE(IsBlocked(extension_with_tab_capture, internal, tab_id() + 1));
- EXPECT_FALSE(PermissionsData::HasAPIPermissionForTab(
- extension_with_tab_capture.get(),
- tab_id() + 1,
- APIPermission::kTabCaptureForTab));
+ EXPECT_FALSE(PermissionsData::ForExtension(extension_with_tab_capture)
+ ->HasAPIPermissionForTab(tab_id() + 1,
+ APIPermission::kTabCaptureForTab));
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698