| 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..067e998709b0b99384011a5281825788dc739384 100644
|
| --- a/chrome/browser/extensions/extension_service_unittest.cc
|
| +++ b/chrome/browser/extensions/extension_service_unittest.cc
|
| @@ -1229,7 +1229,8 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
|
| service_->pending_extension_manager()->AddFromExternalUpdateUrl(
|
| good_crx,
|
| GURL("http:://fake.update/url"),
|
| - Extension::EXTERNAL_PREF_DOWNLOAD);
|
| + Extension::EXTERNAL_PREF_DOWNLOAD,
|
| + false);
|
|
|
| ASSERT_FALSE(service_->pending_extension_manager()->IsIdPending(good_crx));
|
| }
|
| @@ -2238,7 +2239,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingTheme) {
|
| TEST_F(ExtensionServiceTest, MAYBE_UpdatePendingExternalCrx) {
|
| InitializeEmptyExtensionService();
|
| service_->pending_extension_manager()->AddFromExternalUpdateUrl(
|
| - theme_crx, GURL(), Extension::EXTERNAL_PREF_DOWNLOAD);
|
| + theme_crx, GURL(), Extension::EXTERNAL_PREF_DOWNLOAD, false);
|
|
|
| EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(theme_crx));
|
|
|
| @@ -2275,7 +2276,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExternalCrxWinsOverSync) {
|
|
|
| // Add a crx to be updated, with the same ID, from a non-sync source.
|
| service_->pending_extension_manager()->AddFromExternalUpdateUrl(
|
| - kGoodId, GURL(kGoodUpdateURL), Extension::EXTERNAL_PREF_DOWNLOAD);
|
| + kGoodId, GURL(kGoodUpdateURL), Extension::EXTERNAL_PREF_DOWNLOAD, false);
|
|
|
| // Check that there is a pending crx, with is_from_sync set to false.
|
| ASSERT_TRUE(service_->pending_extension_manager()->GetById(
|
| @@ -3704,6 +3705,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
|
| @@ -3722,7 +3750,7 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest {
|
| // Fake an external source adding a URL to fetch an extension from.
|
| void AddPendingExternalPrefUrl() {
|
| service_->pending_extension_manager()->AddFromExternalUpdateUrl(
|
| - crx_id_, GURL(), Extension::EXTERNAL_PREF_DOWNLOAD);
|
| + crx_id_, GURL(), Extension::EXTERNAL_PREF_DOWNLOAD, false);
|
| }
|
|
|
| // Fake an external file from external_extensions.json.
|
|
|