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

Unified Diff: extensions/common/manifest_handlers/shared_module_manifest_unittest.cc

Issue 263703002: Allow shared modules to whitelist extensions that import them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 6 years, 8 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/manifest_handlers/shared_module_info.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
diff --git a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
index fa1e387e11b4a2f4a72874c848fb8fa5c77042d3..9fad6187ff5903a976b45f64f135abd9c13b1dd2 100644
--- a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
+++ b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
@@ -39,6 +39,26 @@ TEST_F(SharedModuleManifestTest, ExportsAll) {
<< manifest.name();
EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo/bar"))
<< manifest.name();
+
+ EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(),
+ kImportId1)) << manifest.name();
+ EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(),
+ kImportId2)) << manifest.name();
+ EXPECT_FALSE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(),
+ kNoImport)) << manifest.name();
+}
+
+TEST_F(SharedModuleManifestTest, ExportWhitelistAll) {
+ Manifest manifest("shared_module_export_no_whitelist.json");
+
+ scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest);
+
+ EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(),
+ kImportId1)) << manifest.name();
+ EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(),
+ kImportId2)) << manifest.name();
+ EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(),
+ kNoImport)) << manifest.name();
}
TEST_F(SharedModuleManifestTest, ExportFoo) {
@@ -66,6 +86,12 @@ TEST_F(SharedModuleManifestTest, ExportParseErrors) {
"Invalid value for 'export.resources'."),
Testcase("shared_module_export_resource_not_string.json",
"Invalid value for 'export.resources[1]'."),
+ Testcase("shared_module_export_whitelist_item_not_id.json",
+ "Invalid value for 'export.whitelist[0]'."),
+ Testcase("shared_module_export_whitelist_item_not_string.json",
+ "Invalid value for 'export.whitelist[0]'."),
+ Testcase("shared_module_export_whitelist_not_list.json",
+ "Invalid value for 'export.whitelist'."),
};
RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR);
}
« no previous file with comments | « extensions/common/manifest_handlers/shared_module_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698