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

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

Issue 2131173003: Make sure Shared Modules cannot be disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 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 | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service_unittest.cc
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index d3df70f12b6bdde6ff5e148db3cf164d9bc410e9..471cd5d7890f8ca26532a3a9a26bb607beed0376 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -6776,6 +6776,36 @@ TEST_F(ExtensionServiceTest, CannotEnableBlacklistedExtension) {
EXPECT_TRUE(ExtensionPrefs::Get(profile())->IsExtensionBlacklisted(id));
}
+// Test that calls to disable Shared Modules do not work.
+TEST_F(ExtensionServiceTest, CannotDisableSharedModules) {
+ InitializeEmptyExtensionService();
+ std::unique_ptr<base::DictionaryValue> manifest =
+ extensions::DictionaryBuilder()
+ .Set("name", "Shared Module")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("export",
+ extensions::DictionaryBuilder()
+ .Set("resources",
+ extensions::ListBuilder().Append("foo.js").Build())
+ .Build())
+ .Build();
+
+ scoped_refptr<Extension> extension = extensions::ExtensionBuilder()
+ .SetManifest(std::move(manifest))
+ .AddFlags(Extension::FROM_WEBSTORE)
+ .Build();
+
+ service()->OnExtensionInstalled(extension.get(), syncer::StringOrdinal(),
+ extensions::kInstallFlagInstallImmediately);
+
+ ASSERT_TRUE(registry()->enabled_extensions().Contains(extension->id()));
+ // Try to disable the extension.
+ service()->DisableExtension(extension->id(), Extension::DISABLE_USER_ACTION);
+ // Shared Module should still be enabled.
+ EXPECT_TRUE(registry()->enabled_extensions().Contains(extension->id()));
+}
+
// Make sure we can uninstall a blacklisted extension
TEST_F(ExtensionServiceTest, UninstallBlacklistedExtension) {
InitializeGoodInstalledExtensionService();
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698