summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-29 21:26:25 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-29 21:26:25 +0000
commitefee9f2642bf89dd5daa1325e227b80e5f9f1030 (patch)
tree0d09eddec7e67fedfb69251702abe14e99a6a6a3 /chrome
parentcb97608ca914fa4c557c1c645c55192cd21281a4 (diff)
downloadchromium_src-efee9f2642bf89dd5daa1325e227b80e5f9f1030.zip
chromium_src-efee9f2642bf89dd5daa1325e227b80e5f9f1030.tar.gz
chromium_src-efee9f2642bf89dd5daa1325e227b80e5f9f1030.tar.bz2
Changed AddPendingExtension() to treat adding an already-installed
extension as an error. BUG=none TEST=trybots Review URL: http://codereview.chromium.org/1517001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extensions_service.cc2
-rw-r--r--chrome/browser/extensions/extensions_service.h8
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc18
3 files changed, 7 insertions, 21 deletions
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 9c24464..5bbb524 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -265,6 +265,8 @@ void ExtensionsService::AddPendingExtension(
const std::string& id, const GURL& update_url,
const Version& version, bool is_theme, bool install_silently) {
if (GetExtensionByIdInternal(id, true, true)) {
+ LOG(DFATAL) << "Trying to add pending extension " << id
+ << " which already exists";
return;
}
AddPendingExtensionInternal(id, update_url, version,
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h
index 256fa37..5bc356f 100644
--- a/chrome/browser/extensions/extensions_service.h
+++ b/chrome/browser/extensions/extensions_service.h
@@ -189,9 +189,11 @@ class ExtensionsService
const FilePath& extension_path,
const GURL& download_url);
- // If an extension with the given id is already installed,
- // does nothing. Otherwise, the extension will be installed in the
- // next auto-update cycle.
+ // Adds an extension in a pending state; the extension with the
+ // given info will be installed on the next auto-update cycle.
+ //
+ // It is an error to call this with an already-installed extension
+ // (even a disabled one).
//
// TODO(akalin): Make sure that all the places that check for
// existing versions also consult the pending extension info.
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index c475884..38932c9 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -1129,24 +1129,6 @@ TEST_F(ExtensionsServiceTest, AddPendingExtension) {
EXPECT_TRUE(it->second.version.Equals(*fake_version));
}
-// Test adding a pending extension for one that is already installed.
-TEST_F(ExtensionsServiceTest, AddPendingExtensionAlreadyInstalled) {
- InitializeEmptyExtensionsService();
-
- FilePath extensions_path;
- ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
- extensions_path = extensions_path.AppendASCII("extensions");
- FilePath path = extensions_path.AppendASCII("good.crx");
- InstallExtension(path, true);
- Extension* good = service_->extensions()->at(0);
- const bool kInstallSilently(true);
-
- service_->AddPendingExtension(good->id(), good->update_url(),
- *good->version(), good->IsTheme(),
- kInstallSilently);
- EXPECT_FALSE(ContainsKey(service_->pending_extensions(), good->id()));
-}
-
namespace {
const char kGoodId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
const char kGoodUpdateURL[] = "http://good.update/url";