Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: chrome/browser/extensions/webstore_startup_installer_browsertest.cc

Issue 428123004: Revert of Remove deprecated extension notification from WebstoreStartupInstallerTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/webstore_startup_installer_browsertest.cc
diff --git a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
index 8d6e540e7430e3c49e2c9813eae6f30aae78ed62..dab0827794c0ac57cb7d15353e3cfd64763ea8b4 100644
--- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/command_line.h"
-#include "base/scoped_observer.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_install_ui.h"
@@ -26,7 +25,6 @@
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h"
@@ -238,21 +236,18 @@
RunTest("runTest");
}
-class CommandLineWebstoreInstall
- : public WebstoreStartupInstallerTest,
- public content::NotificationObserver,
- public extensions::ExtensionRegistryObserver {
+class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest,
+ public content::NotificationObserver {
public:
- CommandLineWebstoreInstall()
- : extensions_registry_observer_(this),
- saw_install_(false),
- browser_open_count_(0) {}
+ CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {}
virtual ~CommandLineWebstoreInstall() {}
virtual void SetUpOnMainThread() OVERRIDE {
WebstoreStartupInstallerTest::SetUpOnMainThread();
- extensions_registry_observer_.Add(
- extensions::ExtensionRegistry::Get(browser()->profile()));
+ registrar_.Add(
+ this,
+ extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
+ content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllSources());
}
@@ -265,25 +260,22 @@
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE {
- DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_OPENED);
- ++browser_open_count_;
- }
-
- virtual void OnExtensionWillBeInstalled(
- content::BrowserContext* browser_context,
- const extensions::Extension* extension,
- bool is_update,
- bool from_ephemeral,
- const std::string& old_name) OVERRIDE {
- EXPECT_EQ(extension->id(), kTestExtensionId);
- saw_install_ = true;
+ if (type ==
+ extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED) {
+ const Extension* extension =
+ content::Details<const extensions::InstalledExtensionInfo>(details)->
+ extension;
+ ASSERT_TRUE(extension != NULL);
+ EXPECT_EQ(extension->id(), kTestExtensionId);
+ saw_install_ = true;
+ } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) {
+ browser_open_count_++;
+ } else {
+ ASSERT_TRUE(false) << "Unexpected notification type : " << type;
+ }
}
content::NotificationRegistrar registrar_;
-
- ScopedObserver<extensions::ExtensionRegistry,
- extensions::ExtensionRegistryObserver>
- extensions_registry_observer_;
// Have we seen an installation notification for kTestExtensionId ?
bool saw_install_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698