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

Unified Diff: extensions/common/permissions/permissions_data_unittest.cc

Issue 348313003: Create withheld permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master Created 6 years, 5 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
« no previous file with comments | « extensions/common/permissions/permissions_data.cc ('k') | extensions/common/url_pattern.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/permissions/permissions_data_unittest.cc
diff --git a/extensions/common/permissions/permissions_data_unittest.cc b/extensions/common/permissions/permissions_data_unittest.cc
index 70cb8874f126d666b9aec870c3e74d62f27770a1..c54e63903b86119797f3cf85f4aa71583cb0ea58 100644
--- a/extensions/common/permissions/permissions_data_unittest.cc
+++ b/extensions/common/permissions/permissions_data_unittest.cc
@@ -74,19 +74,6 @@ scoped_refptr<const Extension> GetExtensionWithHostPermission(
.Build();
}
-bool RequiresActionForScriptExecution(const std::string& extension_id,
- const std::string& host_permissions,
- Manifest::Location location) {
- scoped_refptr<const Extension> extension =
- GetExtensionWithHostPermission(extension_id,
- host_permissions,
- location);
- return extension->permissions_data()->RequiresActionForScriptExecution(
- extension,
- -1, // Ignore tab id for these.
- GURL::EmptyGURL());
-}
-
// Checks that urls are properly restricted for the given extension.
void CheckRestrictedUrls(const Extension* extension,
bool block_chrome_urls) {
@@ -266,47 +253,6 @@ TEST(ExtensionPermissionsTest, SocketPermissions) {
"239.255.255.250", 1900));
}
-TEST(ExtensionPermissionsTest, RequiresActionForScriptExecution) {
- // Extensions with all_hosts should require action.
- EXPECT_TRUE(RequiresActionForScriptExecution(
- "all_hosts_permissions", kAllHostsPermission, Manifest::INTERNAL));
- // Extensions with nearly all hosts are treated the same way.
- EXPECT_TRUE(RequiresActionForScriptExecution(
- "pseudo_all_hosts_permissions", "*://*.com/*", Manifest::INTERNAL));
- // Extensions with explicit permissions shouldn't require action.
- EXPECT_FALSE(RequiresActionForScriptExecution(
- "explicit_permissions", "https://www.google.com/*", Manifest::INTERNAL));
- // Policy extensions are exempt...
- EXPECT_FALSE(RequiresActionForScriptExecution(
- "policy", kAllHostsPermission, Manifest::EXTERNAL_POLICY));
- // ... as are component extensions.
- EXPECT_FALSE(RequiresActionForScriptExecution(
- "component", kAllHostsPermission, Manifest::COMPONENT));
- // Throw in an external pref extension to make sure that it's not just working
- // for everything non-internal.
- EXPECT_TRUE(RequiresActionForScriptExecution(
- "external_pref", kAllHostsPermission, Manifest::EXTERNAL_PREF));
-
- // If we grant an extension tab permissions, then it should no longer require
- // action.
- scoped_refptr<const Extension> extension =
- GetExtensionWithHostPermission("all_hosts_permissions",
- kAllHostsPermission,
- Manifest::INTERNAL);
- URLPatternSet allowed_hosts;
- allowed_hosts.AddPattern(
- URLPattern(URLPattern::SCHEME_HTTPS, "https://www.google.com/*"));
- scoped_refptr<PermissionSet> tab_permissions(
- new PermissionSet(APIPermissionSet(),
- ManifestPermissionSet(),
- allowed_hosts,
- URLPatternSet()));
- extension->permissions_data()->UpdateTabSpecificPermissions(0,
- tab_permissions);
- EXPECT_FALSE(extension->permissions_data()->RequiresActionForScriptExecution(
- extension, 0, GURL("https://www.google.com/")));
-}
-
TEST(ExtensionPermissionsTest, IsRestrictedUrl) {
scoped_refptr<const Extension> extension =
GetExtensionWithHostPermission("normal_extension",
« no previous file with comments | « extensions/common/permissions/permissions_data.cc ('k') | extensions/common/url_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698