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

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

Issue 7605001: Extensions installed by policy overrun previously installed extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reviewed, rebased Created 9 years, 4 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') | chrome/browser/extensions/extension_updater.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 edb777228f1dba9f6e8aea7554be6e8ccbb2955a..5111f31b9f6c4cf061e5db5baecb05140b7c5a87 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -3704,6 +3704,33 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataNotInstalled) {
// TODO(akalin): Figure out a way to test |info.ShouldAllowInstall()|.
}
+TEST_F(ExtensionServiceTest, HigherPriorityInstall) {
+ InitializeEmptyExtensionService();
+
+ FilePath path = data_dir_.AppendASCII("good.crx");
+ InstallCrx(path, true);
+ ValidatePrefKeyCount(1u);
+ ValidateIntegerPref(good_crx, "state", Extension::ENABLED);
+ ValidateIntegerPref(good_crx, "location", Extension::INTERNAL);
+
+ PendingExtensionManager* pending = service_->pending_extension_manager();
+ EXPECT_FALSE(pending->IsIdPending(kGoodId));
+
+ // Skip install when the location is the same.
+ service_->OnExternalExtensionUpdateUrlFound(kGoodId, GURL(kGoodUpdateURL),
+ Extension::INTERNAL);
+ EXPECT_FALSE(pending->IsIdPending(kGoodId));
+ // Force install when the location has higher priority.
+ service_->OnExternalExtensionUpdateUrlFound(kGoodId, GURL(kGoodUpdateURL),
+ Extension::EXTERNAL_POLICY_DOWNLOAD);
+ EXPECT_TRUE(pending->IsIdPending(kGoodId));
+ pending->Remove(kGoodId);
+ // Skip install when the location has lower priority.
+ service_->OnExternalExtensionUpdateUrlFound(kGoodId, GURL(kGoodUpdateURL),
+ Extension::INTERNAL);
+ EXPECT_FALSE(pending->IsIdPending(kGoodId));
+}
+
// Test that when multiple sources try to install an extension,
// we consistently choose the right one. To make tests easy to read,
// methods that fake requests to install crx files in several ways
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698