summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 18:44:30 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 18:44:30 +0000
commit15300d9c5d07f7d49b431890804e07745291bc8b (patch)
treefdb6d1444d11723e6c5e59d8648b17b170234da8 /chrome/browser/extensions
parent0d8b9aa02fa25cbc73fb92b29cf3ce109e5c82d2 (diff)
downloadchromium_src-15300d9c5d07f7d49b431890804e07745291bc8b.zip
chromium_src-15300d9c5d07f7d49b431890804e07745291bc8b.tar.gz
chromium_src-15300d9c5d07f7d49b431890804e07745291bc8b.tar.bz2
Fix autoupdate for hosted apps.
The problem is that CrxInstaller wasn't considering updates when looking for previously installed apps with overlapping extents. BUG=68872 TEST=Steps outlined in bug report. Review URL: http://codereview.chromium.org/6292007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/crx_installer.cc3
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc22
2 files changed, 24 insertions, 1 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index f62c983..de4804f 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -301,7 +301,8 @@ void CrxInstaller::ConfirmInstall() {
GURL overlapping_url;
const Extension* overlapping_extension =
frontend_->GetExtensionByOverlappingWebExtent(extension_->web_extent());
- if (overlapping_extension) {
+ if (overlapping_extension &&
+ overlapping_extension->id() != extension_->id()) {
ReportFailureFromUIThread(l10n_util::GetStringFUTF8(
IDS_EXTENSION_OVERLAPPING_WEB_EXTENT,
UTF8ToUTF16(overlapping_extension->name())));
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 0a0e520..55255f3 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -1649,6 +1649,28 @@ TEST_F(ExtensionServiceTest, InstallApps) {
ValidatePrefKeyCount(pref_count);
}
+TEST_F(ExtensionServiceTest, UpdateApps) {
+ InitializeEmptyExtensionService();
+ FilePath extensions_path;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
+ extensions_path =
+ extensions_path.AppendASCII("extensions").AppendASCII("app_update");
+
+ // First install v1 of a hosted app.
+ InstallExtension(extensions_path.AppendASCII("v1.crx"), true);
+ ASSERT_EQ(1u, service_->extensions()->size());
+ std::string id = service_->extensions()->at(0)->id();
+ ASSERT_EQ(std::string("1"),
+ service_->extensions()->at(0)->version()->GetString());
+
+ // Now try updating to v2.
+ UpdateExtension(id,
+ extensions_path.AppendASCII("v2.crx"),
+ ENABLED);
+ ASSERT_EQ(std::string("2"),
+ service_->extensions()->at(0)->version()->GetString());
+}
+
TEST_F(ExtensionServiceTest, InstallAppsWithUnlimtedStorage) {
InitializeEmptyExtensionService();
EXPECT_TRUE(service_->extensions()->empty());