summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlimasdf <limasdf@gmail.com>2015-11-20 08:54:32 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-20 16:55:35 +0000
commit3b5b2d147fe384fea0c07814e23b3fd5bdbb0792 (patch)
tree30b5d67b5cb2a8238ef10194b36787d95cde0d3f
parent21c9153893f4a238cb65ec353a80ff9483b1d130 (diff)
downloadchromium_src-3b5b2d147fe384fea0c07814e23b3fd5bdbb0792.zip
chromium_src-3b5b2d147fe384fea0c07814e23b3fd5bdbb0792.tar.gz
chromium_src-3b5b2d147fe384fea0c07814e23b3fd5bdbb0792.tar.bz2
Kill NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED
Removing code where using it. - WaitForExtensionInstall() from c/b/e/extension_browsertest.h which having unclear behavior. (we're not able to expect when starting observing) - from extension_service.h where notify ..._INSTALLED_DEPRECATED TEST=browser_tests BUG=411568 Review URL: https://codereview.chromium.org/1403373020 Cr-Commit-Position: refs/heads/master@{#360840}
-rw-r--r--chrome/browser/extensions/api/management/management_browsertest.cc21
-rw-r--r--chrome/browser/extensions/extension_browsertest.h6
-rw-r--r--chrome/browser/extensions/extension_disabled_ui_browsertest.cc8
-rw-r--r--chrome/browser/extensions/extension_service.cc16
-rw-r--r--chrome/browser/extensions/extension_test_notification_observer.cc12
-rw-r--r--chrome/browser/extensions/extension_test_notification_observer.h4
-rw-r--r--extensions/browser/notification_types.h7
-rw-r--r--extensions/shell/browser/shell_extension_system.cc2
8 files changed, 22 insertions, 54 deletions
diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc
index b2b35ef..a7e0a30 100644
--- a/chrome/browser/extensions/api/management/management_browsertest.cc
+++ b/chrome/browser/extensions/api/management/management_browsertest.cc
@@ -29,6 +29,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/notification_types.h"
+#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/browser/updater/extension_downloader.h"
#include "extensions/test/extension_test_message_listener.h"
#include "net/url_request/test_url_request_interceptor.h"
@@ -317,8 +318,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) {
// Run autoupdate and make sure version 2 of the extension was installed.
ExtensionTestMessageListener listener2("v2 installed", false);
+
+ extensions::TestExtensionRegistryObserver install_observer(registry);
service->updater()->CheckNow(params);
- ASSERT_TRUE(WaitForExtensionInstall());
+ install_observer.WaitForExtensionWillBeInstalled();
listener2.WaitUntilSatisfied();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(
@@ -406,10 +409,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
base::Unretained(&notification_listener));
ExtensionTestMessageListener listener2("v2 installed", false);
+ extensions::TestExtensionRegistryObserver install_observer(registry);
// Run autoupdate and make sure version 2 of the extension was installed but
// is still disabled.
service->updater()->CheckNow(params);
- ASSERT_TRUE(WaitForExtensionInstall());
+ install_observer.WaitForExtensionWillBeInstalled();
ASSERT_EQ(disabled_size_before + 1, registry->disabled_extensions().size());
ASSERT_EQ(enabled_size_before, registry->enabled_extensions().size());
extension = service->GetExtensionById(
@@ -471,9 +475,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) {
Extension::NO_FLAGS,
false));
+ extensions::TestExtensionRegistryObserver install_observer(registry);
// Run autoupdate and make sure version 2 of the extension was installed.
service->updater()->CheckNow(params);
- ASSERT_TRUE(WaitForExtensionInstall());
+ install_observer.WaitForExtensionWillBeInstalled();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
@@ -566,10 +571,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) {
policy::POLICY_SOURCE_CLOUD,
forcelist.DeepCopy(),
NULL);
+ extensions::TestExtensionRegistryObserver install_observer(registry);
UpdateProviderPolicy(policies);
+ install_observer.WaitForExtensionWillBeInstalled();
// Check if the extension got installed.
- ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
@@ -656,9 +662,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
policy::POLICY_SOURCE_CLOUD,
forcelist.DeepCopy(),
NULL);
+ extensions::TestExtensionRegistryObserver install_observer(registry);
UpdateProviderPolicy(policies);
+ install_observer.WaitForExtensionWillBeInstalled();
- ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
@@ -698,9 +705,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
policy::POLICY_SOURCE_CLOUD,
forcelist.DeepCopy(),
NULL);
+
+ extensions::TestExtensionRegistryObserver extension_observer(registry);
UpdateProviderPolicy(policies);
+ extension_observer.WaitForExtensionWillBeInstalled();
- ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h
index 0f3b1a3..65d1d92 100644
--- a/chrome/browser/extensions/extension_browsertest.h
+++ b/chrome/browser/extensions/extension_browsertest.h
@@ -243,12 +243,6 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest {
return observer_->WaitForPageActionVisibilityChangeTo(count);
}
- // Waits until an extension is installed and loaded. Returns true if an
- // install happened before timeout.
- bool WaitForExtensionInstall() {
- return observer_->WaitForExtensionInstall();
- }
-
// Wait for an extension install error to be raised. Returns true if an
// error was raised.
bool WaitForExtensionInstallError() {
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
index 59822df..7c16a03 100644
--- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
@@ -24,6 +24,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/extension.h"
#include "net/url_request/test_url_request_interceptor.h"
#include "sync/protocol/extension_specifics.pb.h"
@@ -208,12 +209,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest,
extensions::ExtensionUpdater::CheckParams params;
service_->updater()->set_default_check_params(params);
+ extensions::TestExtensionRegistryObserver install_observer(registry_);
sync_service->ProcessSyncChanges(
FROM_HERE,
syncer::SyncChangeList(
1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD)));
- WaitForExtensionInstall();
+ install_observer.WaitForExtensionWillBeInstalled();
content::RunAllBlockingPoolTasksUntilIdle();
extension = service_->GetExtensionById(extension_id, true);
@@ -261,6 +263,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, RemoteInstall) {
base::Time::Now(),
syncer::AttachmentIdList(),
syncer::AttachmentServiceProxy());
+
+ extensions::TestExtensionRegistryObserver install_observer(registry_);
ExtensionSyncService::Get(profile())->ProcessSyncChanges(
FROM_HERE,
syncer::SyncChangeList(
@@ -268,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, RemoteInstall) {
syncer::SyncChange::ACTION_ADD,
sync_data)));
- WaitForExtensionInstall();
+ install_observer.WaitForExtensionWillBeInstalled();
content::RunAllBlockingPoolTasksUntilIdle();
const Extension* extension = service_->GetExtensionById(extension_id, true);
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index fc5a382..c5e68c7 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1936,12 +1936,6 @@ void ExtensionService::FinishInstallation(
}
bool from_ephemeral =
was_ephemeral && !extension_prefs_->IsEphemeralApp(extension->id());
- extensions::InstalledExtensionInfo details(
- extension, is_update, from_ephemeral, old_name);
- content::NotificationService::current()->Notify(
- extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
- content::Source<Profile>(profile_),
- content::Details<const extensions::InstalledExtensionInfo>(&details));
registry_->TriggerOnWillBeInstalled(
extension, is_update, from_ephemeral, old_name);
@@ -1989,16 +1983,6 @@ void ExtensionService::PromoteEphemeralApp(
// Fire install-related events to allow observers to handle the promotion
// of the ephemeral app.
- extensions::InstalledExtensionInfo details(
- extension,
- true /* is update */,
- true /* from ephemeral */,
- extension->name() /* old name */);
- content::NotificationService::current()->Notify(
- extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
- content::Source<Profile>(profile_),
- content::Details<const extensions::InstalledExtensionInfo>(&details));
-
registry_->TriggerOnWillBeInstalled(
extension,
true /* is update */,
diff --git a/chrome/browser/extensions/extension_test_notification_observer.cc b/chrome/browser/extensions/extension_test_notification_observer.cc
index da99e29..62b55e6 100644
--- a/chrome/browser/extensions/extension_test_notification_observer.cc
+++ b/chrome/browser/extensions/extension_test_notification_observer.cc
@@ -172,13 +172,6 @@ bool ExtensionTestNotificationObserver::WaitForExtensionNotIdle(
return true;
}
-bool ExtensionTestNotificationObserver::WaitForExtensionInstall() {
- int before = extension_installs_observed_;
- WaitForNotification(
- extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED);
- return extension_installs_observed_ == (before + 1);
-}
-
bool ExtensionTestNotificationObserver::WaitForExtensionInstallError() {
int before = extension_installs_observed_;
content::WindowedNotificationObserver(
@@ -262,11 +255,6 @@ void ExtensionTestNotificationObserver::Observe(
++crx_installers_done_observed_;
break;
- case extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED:
- VLOG(1) << "Got EXTENSION_INSTALLED notification.";
- ++extension_installs_observed_;
- break;
-
case extensions::NOTIFICATION_EXTENSION_LOAD_ERROR:
VLOG(1) << "Got EXTENSION_LOAD_ERROR notification.";
++extension_load_errors_observed_;
diff --git a/chrome/browser/extensions/extension_test_notification_observer.h b/chrome/browser/extensions/extension_test_notification_observer.h
index 214c824..08dce93 100644
--- a/chrome/browser/extensions/extension_test_notification_observer.h
+++ b/chrome/browser/extensions/extension_test_notification_observer.h
@@ -32,10 +32,6 @@ class ExtensionTestNotificationObserver
// Wait for the number of visible page actions to change to |count|.
bool WaitForPageActionVisibilityChangeTo(int count);
- // Waits until an extension is installed and loaded. Returns true if an
- // install happened before timeout.
- bool WaitForExtensionInstall();
-
// Wait for an extension install error to be raised. Returns true if an
// error was raised.
bool WaitForExtensionInstallError();
diff --git a/extensions/browser/notification_types.h b/extensions/browser/notification_types.h
index e5ae4ba..b99454c 100644
--- a/extensions/browser/notification_types.h
+++ b/extensions/browser/notification_types.h
@@ -58,13 +58,6 @@ enum NotificationType {
// UpdatedExtensionPermissionsInfo, and the source is a BrowserContext*.
NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED,
- // Sent immediately before new extensions are installed or existing
- // extensions are updated. The details are an InstalledExtensionInfo, and the
- // source is a BrowserContext*.
- //
- // DEPRECATED: Use ExtensionRegistry::AddObserver instead.
- NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
-
// An error occured during extension install. The details are a string with
// details about why the install failed.
NOTIFICATION_EXTENSION_INSTALL_ERROR,
diff --git a/extensions/shell/browser/shell_extension_system.cc b/extensions/shell/browser/shell_extension_system.cc
index b6cff6a..e3a75bf 100644
--- a/extensions/shell/browser/shell_extension_system.cc
+++ b/extensions/shell/browser/shell_extension_system.cc
@@ -56,7 +56,7 @@ const Extension* ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) {
// * Call PermissionsUpdater::GrantActivePermissions().
// * Call ExtensionService::SatisfyImports().
// * Call ExtensionPrefs::OnExtensionInstalled().
- // * Send NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED.
+ // * Call ExtensionRegistryObserver::OnExtensionWillbeInstalled().
ExtensionRegistry::Get(browser_context_)->AddEnabled(extension.get());