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

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: real rebase 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
« 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 c096920fa76928b358b223e9cca03dc4a9803ac2..888092ec045c201de0a9c87cae3a4911c6f1c4c0 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -3018,6 +3018,19 @@ bool IsExtension(const Extension* extension) {
return extension->GetType() == Manifest::TYPE_EXTENSION;
}
+#if defined(ENABLE_BLACKLIST_TESTS)
+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;
+}
+#endif // defined(ENABLE_BLACKLIST_TESTS)
+
} // namespace
// Test adding a pending extension.
@@ -3645,6 +3658,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.
« 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