diff options
author | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 19:54:16 +0000 |
---|---|---|
committer | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 19:54:16 +0000 |
commit | 7355862b8ae1750d705db5931ab80de7d45e22af (patch) | |
tree | c07991e28506ce0d911a6e4d14a4c3423c526e9a | |
parent | 5c607ad60516f88e9071870ba8c4f3d164f577ed (diff) | |
download | chromium_src-7355862b8ae1750d705db5931ab80de7d45e22af.zip chromium_src-7355862b8ae1750d705db5931ab80de7d45e22af.tar.gz chromium_src-7355862b8ae1750d705db5931ab80de7d45e22af.tar.bz2 |
Remove ExtensionService::HasInstalledExtensions since we always have (component) extensions.
BUG=79093
TEST=
R=aa@chromium.org
Review URL: http://codereview.chromium.org/6850018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81627 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 6 insertions, 38 deletions
diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc index c3534f3..e76cb79 100644 --- a/chrome/browser/extensions/extension_management_browsertest.cc +++ b/chrome/browser/extensions/extension_management_browsertest.cc @@ -177,21 +177,18 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) { EXPECT_EQ(0u, service->disabled_extensions()->size()); const Extension* extension = service->extensions()->at(size_before); EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension)); - ASSERT_TRUE(service->HasInstalledExtensions()); // After disabling, the background page should go away. service->DisableExtension("bjafgdebaacbbbecmhlhpofkepfkgcpa"); EXPECT_EQ(size_before, service->extensions()->size()); EXPECT_EQ(1u, service->disabled_extensions()->size()); EXPECT_FALSE(manager->GetBackgroundHostForExtension(extension)); - ASSERT_TRUE(service->HasInstalledExtensions()); // And bring it back. service->EnableExtension("bjafgdebaacbbbecmhlhpofkepfkgcpa"); EXPECT_EQ(size_before + 1, service->extensions()->size()); EXPECT_EQ(0u, service->disabled_extensions()->size()); EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension)); - ASSERT_TRUE(service->HasInstalledExtensions()); } // Used for testing notifications sent during extension updates. @@ -281,7 +278,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, AutoUpdate) { listener1.WaitUntilSatisfied(); const ExtensionList* extensions = service->extensions(); ASSERT_EQ(size_before + 1, extensions->size()); - ASSERT_TRUE(service->HasInstalledExtensions()); ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(size_before)->id()); ASSERT_EQ("1.0", extensions->at(size_before)->VersionString()); diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 877a803..a97bd0d 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -473,10 +473,6 @@ PendingExtensionManager* ExtensionService::pending_extension_manager() { return &pending_extension_manager_; } -bool ExtensionService::HasInstalledExtensions() { - return !(extensions_.empty() && disabled_extensions_.empty()); -} - ExtensionService::~ExtensionService() { DCHECK(!profile_); // Profile should have told us it's going away. UnloadAllExtensions(); diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 9fd84e2..fb897aa 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -73,7 +73,6 @@ class ExtensionServiceInterface { virtual void UpdateExtensionBlacklist( const std::vector<std::string>& blacklist) = 0; virtual void CheckAdminBlacklist() = 0; - virtual bool HasInstalledExtensions() = 0; virtual bool IsIncognitoEnabled(const std::string& extension_id) const = 0; virtual void SetIsIncognitoEnabled(const std::string& extension_id, @@ -162,9 +161,6 @@ class ExtensionService component_extension_manifests_.push_back(info); } - // Returns true if any extensions are installed. - virtual bool HasInstalledExtensions(); - const FilePath& install_directory() const { return install_directory_; } DefaultApps* default_apps() { return &default_apps_; } diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index ca05574..1c1c76c5 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -965,7 +965,7 @@ void ExtensionUpdater::CheckNow() { std::vector<ManifestFetchData*> fetches(fetches_builder.GetFetches()); // Start a fetch of the blacklist if needed. - if (blacklist_checks_enabled_ && service_->HasInstalledExtensions()) { + if (blacklist_checks_enabled_) { // Note: it is very important that we use the https version of the update // url here to avoid DNS hijacking of the blacklist, which is not validated // by a public key signature like .crx files are. diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc index 209b44b..3479d11 100644 --- a/chrome/browser/extensions/extension_updater_unittest.cc +++ b/chrome/browser/extensions/extension_updater_unittest.cc @@ -112,11 +112,6 @@ class MockService : public ExtensionServiceInterface { FAIL(); } - virtual bool HasInstalledExtensions() { - ADD_FAILURE(); - return false; - } - virtual bool IsIncognitoEnabled(const std::string& id) const { ADD_FAILURE(); return false; @@ -222,7 +217,7 @@ void SetupPendingExtensionManagerForTest( class ServiceForManifestTests : public MockService { public: - ServiceForManifestTests() : has_installed_extensions_(false) {} + ServiceForManifestTests() {} virtual ~ServiceForManifestTests() {} @@ -247,17 +242,8 @@ class ServiceForManifestTests : public MockService { extensions_ = extensions; } - virtual bool HasInstalledExtensions() { - return has_installed_extensions_; - } - - void set_has_installed_extensions(bool value) { - has_installed_extensions_ = value; - } - private: ExtensionList extensions_; - bool has_installed_extensions_; }; class ServiceForDownloadTests : public MockService { @@ -398,6 +384,9 @@ class ExtensionUpdaterTest : public testing::Test { &service, service.extension_prefs(), service.pref_service(), service.profile(), 60*60*24); updater.Start(); + // Disable blacklist checks (tested elsewhere) so that we only see the + // update HTTP request. + updater.set_blacklist_checks_enabled(false); // Tell the update that it's time to do update checks. SimulateTimerFired(&updater); @@ -452,17 +441,9 @@ class ExtensionUpdaterTest : public testing::Test { // Tell the updater that it's time to do update checks. SimulateTimerFired(&updater); - // No extensions installed, so nothing should have been fetched. + // Get the url our mock fetcher was asked to fetch. TestURLFetcher* fetcher = factory.GetFetcherByID(ExtensionUpdater::kManifestFetcherId); - EXPECT_TRUE(fetcher == NULL); - - // Try again with an extension installed. - service.set_has_installed_extensions(true); - SimulateTimerFired(&updater); - - // Get the url our mock fetcher was asked to fetch. - fetcher = factory.GetFetcherByID(ExtensionUpdater::kManifestFetcherId); ASSERT_FALSE(fetcher == NULL); const GURL& url = fetcher->original_url(); diff --git a/chrome/browser/extensions/mock_extension_service.h b/chrome/browser/extensions/mock_extension_service.h index 80039b1..7a6c4b5 100644 --- a/chrome/browser/extensions/mock_extension_service.h +++ b/chrome/browser/extensions/mock_extension_service.h @@ -35,7 +35,6 @@ class MockExtensionService : public ExtensionServiceInterface { MOCK_METHOD1(UpdateExtensionBlacklist, void(const std::vector<std::string>&)); MOCK_METHOD0(CheckAdminBlacklist, void()); - MOCK_METHOD0(HasInstalledExtensions, bool()); MOCK_CONST_METHOD1(IsIncognitoEnabled, bool(const std::string&)); MOCK_METHOD2(SetIsIncognitoEnabled, void(const std::string&, bool)); MOCK_METHOD0(CheckForUpdatesSoon, void()); |