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

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

Issue 437603002: Remove deprecated extension notification from WebstoreStartupInstallerTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: testingprofile -> profile() 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 dab0827794c0ac57cb7d15353e3cfd64763ea8b4..8d6e540e7430e3c49e2c9813eae6f30aae78ed62 100644
--- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
@@ -3,6 +3,7 @@
// 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"
@@ -25,6 +26,7 @@
#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"
@@ -236,18 +238,21 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest,
RunTest("runTest");
}
-class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest,
- public content::NotificationObserver {
+class CommandLineWebstoreInstall
+ : public WebstoreStartupInstallerTest,
+ public content::NotificationObserver,
+ public extensions::ExtensionRegistryObserver {
public:
- CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {}
+ CommandLineWebstoreInstall()
+ : extensions_registry_observer_(this),
+ saw_install_(false),
+ browser_open_count_(0) {}
virtual ~CommandLineWebstoreInstall() {}
virtual void SetUpOnMainThread() OVERRIDE {
WebstoreStartupInstallerTest::SetUpOnMainThread();
- registrar_.Add(
- this,
- extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
- content::NotificationService::AllSources());
+ extensions_registry_observer_.Add(
+ extensions::ExtensionRegistry::Get(browser()->profile()));
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllSources());
}
@@ -260,23 +265,26 @@ class CommandLineWebstoreInstall : public WebstoreStartupInstallerTest,
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE {
- 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;
- }
+ 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;
}
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