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

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

Issue 2647783003: Reenable disabled component extensions with profile resetter. (Closed)
Patch Set: Rebase. Created 3 years, 11 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 | « no previous file | chrome/browser/profile_resetter/profile_resetter.cc » ('j') | 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 abaae912ab71d3226c9268c3226e8bef778a4e2f..2b7ba6f39e56a8dd902e7d24af2a95def76fd4a7 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -259,6 +259,19 @@ size_t GetExternalInstallBubbleCount(ExtensionService* service) {
return bubble_count;
}
+scoped_refptr<Extension> CreateExtension(const base::string16& name,
+ const base::FilePath& path,
+ Manifest::Location location) {
+ base::DictionaryValue manifest;
+ manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0");
+ manifest.SetString(extensions::manifest_keys::kName, name);
+ std::string error;
+ scoped_refptr<Extension> extension =
+ Extension::Create(path, location, manifest, Extension::NO_FLAGS, &error);
+ EXPECT_TRUE(extension.get() != nullptr) << error;
+ return extension;
+}
+
} // namespace
class MockExtensionProvider : public extensions::ExternalProviderInterface {
@@ -6409,6 +6422,36 @@ TEST_F(ExtensionServiceTest, ExternalInstallInitiallyDisabled) {
EXPECT_TRUE(service()->IsExtensionEnabled(page_action));
}
+// As for components, only external component extensions can be disabled.
+TEST_F(ExtensionServiceTest, DisablingComponentExtensions) {
+ InitializeEmptyExtensionService();
+ service_->Init();
+
+ scoped_refptr<Extension> external_component_extension = CreateExtension(
+ base::ASCIIToUTF16("external_component_extension"),
+ base::FilePath(FILE_PATH_LITERAL("//external_component_extension")),
+ Manifest::EXTERNAL_COMPONENT);
+ service_->AddExtension(external_component_extension.get());
+ EXPECT_TRUE(registry()->enabled_extensions().Contains(
+ external_component_extension->id()));
+ service_->DisableExtension(external_component_extension->id(),
+ extensions::Extension::DISABLE_USER_ACTION);
+ EXPECT_TRUE(registry()->disabled_extensions().Contains(
+ external_component_extension->id()));
+
+ scoped_refptr<Extension> component_extension = CreateExtension(
+ base::ASCIIToUTF16("component_extension"),
+ base::FilePath(FILE_PATH_LITERAL("//component_extension")),
+ Manifest::COMPONENT);
+ service_->AddExtension(component_extension.get());
+ EXPECT_TRUE(
+ registry()->enabled_extensions().Contains(component_extension->id()));
+ service_->DisableExtension(component_extension->id(),
+ extensions::Extension::DISABLE_USER_ACTION);
+ EXPECT_FALSE(
+ registry()->disabled_extensions().Contains(component_extension->id()));
+}
+
// Test that installing multiple external extensions works.
// Flaky on windows; http://crbug.com/295757 .
// Causes race conditions with an in-process utility thread, so disable under
« no previous file with comments | « no previous file | chrome/browser/profile_resetter/profile_resetter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698