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

Unified Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 8849010: Add 'web_accessible_resource" keyword for version 2 extension manifests. This makes extension res... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/manifest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_manifests_unittest.cc
===================================================================
--- chrome/common/extensions/extension_manifests_unittest.cc (revision 115399)
+++ chrome/common/extensions/extension_manifests_unittest.cc (working copy)
@@ -844,6 +844,40 @@
LoadAndExpectSuccess("ports_in_permissions.json");
}
+TEST_F(ExtensionManifestTest, WebAccessibleResources) {
+ // Manifest version 2 with web accessible resources specified.
+ scoped_refptr<Extension> extension1(
+ LoadAndExpectSuccess("web_accessible_resources_1.json"));
+
+ // Manifest version 2 with no web accessible resources.
+ scoped_refptr<Extension> extension2(
+ LoadAndExpectSuccess("web_accessible_resources_2.json"));
+
+ // Default manifest version with web accessible resources specified.
+ scoped_refptr<Extension> extension3(
+ LoadAndExpectSuccess("web_accessible_resources_3.json"));
+
+ // Default manifest version with no web accessible resources.
+ scoped_refptr<Extension> extension4(
+ LoadAndExpectSuccess("web_accessible_resources_4.json"));
+
+ EXPECT_TRUE(extension1->HasWebAccessibleResources());
+ EXPECT_FALSE(extension2->HasWebAccessibleResources());
+ EXPECT_TRUE(extension3->HasWebAccessibleResources());
+ EXPECT_FALSE(extension4->HasWebAccessibleResources());
+
+ EXPECT_TRUE(extension1->IsResourceWebAccessible("/test"));
+ EXPECT_FALSE(extension1->IsResourceWebAccessible("/none"));
+
+ EXPECT_FALSE(extension2->IsResourceWebAccessible("/test"));
+
+ EXPECT_TRUE(extension3->IsResourceWebAccessible("/test"));
+ EXPECT_FALSE(extension3->IsResourceWebAccessible("/none"));
+
+ EXPECT_TRUE(extension4->IsResourceWebAccessible("/test"));
+ EXPECT_TRUE(extension4->IsResourceWebAccessible("/none"));
+}
+
TEST_F(ExtensionManifestTest, IsolatedApps) {
// Requires --enable-experimental-extension-apis
LoadAndExpectError("isolated_app_valid.json",
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/manifest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698