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

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

Issue 291603002: Don't try to reload blacklisted extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: expect_eq Created 6 years, 7 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
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 ce441ed017dbb7546c1b1e51a16840b2df49a358..2d6a92750049afccd551d948e5f2f1a5532355d4 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -3018,6 +3018,18 @@ bool IsExtension(const Extension* extension) {
return extension->GetType() == Manifest::TYPE_EXTENSION;
}
+std::set<std::string> StringSet(const std::string& s) {
+ std::set<std::string> set;
+ set.insert(s);
+ return set;
+}
+
+std::set<std::string> StringSet(const std::string& s1, const std::string& s2) {
+ std::set<std::string> set = StringSet(s1);
+ set.insert(s2);
+ return set;
+}
+
} // namespace
// Test adding a pending extension.
@@ -3636,6 +3648,35 @@ TEST_F(ExtensionServiceTest, GreylistUnknownDontChange) {
EXPECT_TRUE(enabled_extensions.Contains(good2));
EXPECT_FALSE(disabled_extensions.Contains(good2));
}
+
+// Tests that blacklisted extensions cannot be reloaded, both those loaded
+// before and after extension service startup.
+TEST_F(ExtensionServiceTest, ReloadBlacklistedExtension) {
+ extensions::TestBlacklist test_blacklist;
+
+ InitializeGoodInstalledExtensionService();
+ test_blacklist.Attach(service_->blacklist_);
+
+ test_blacklist.SetBlacklistState(
+ good1, extensions::BLACKLISTED_MALWARE, false);
+ service_->Init();
+ test_blacklist.SetBlacklistState(
+ good2, extensions::BLACKLISTED_MALWARE, false);
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_EQ(StringSet(good0), registry_->enabled_extensions().GetIDs());
+ EXPECT_EQ(StringSet(good1, good2),
+ registry_->blacklisted_extensions().GetIDs());
+
+ service_->ReloadExtension(good1);
+ service_->ReloadExtension(good2);
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_EQ(StringSet(good0), registry_->enabled_extensions().GetIDs());
+ EXPECT_EQ(StringSet(good1, good2),
+ registry_->blacklisted_extensions().GetIDs());
+}
+
#endif // defined(ENABLE_BLACKLIST_TESTS)
// Will not install extension blacklisted by policy.

Powered by Google App Engine
This is Rietveld 408576698