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 2c142b4ed441d0d588e1119bf8553ec5c32907c5..e87138eff767988c0e42d92e3848dd07da77e53d 100644 |
--- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc |
+++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc |
@@ -4,9 +4,7 @@ |
#include "base/command_line.h" |
#include "base/scoped_observer.h" |
-#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/extensions/extension_service.h" |
-#include "chrome/browser/extensions/startup_helper.h" |
#include "chrome/browser/extensions/webstore_installer_test.h" |
#include "chrome/browser/infobars/infobar_service.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -16,14 +14,11 @@ |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/test_switches.h" |
#include "chrome/test/base/ui_test_utils.h" |
-#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/notification_service.h" |
-#include "content/public/browser/notification_types.h" |
#include "content/public/browser/web_contents.h" |
#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/browser/install/extension_install_ui.h" |
#include "extensions/common/extension_builder.h" |
@@ -230,65 +225,3 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest, |
RunTest("runTest"); |
} |
- |
-class CommandLineWebstoreInstall |
- : public WebstoreStartupInstallerTest, |
- public content::NotificationObserver, |
- public extensions::ExtensionRegistryObserver { |
- public: |
- CommandLineWebstoreInstall() : saw_install_(false), browser_open_count_(0) {} |
- ~CommandLineWebstoreInstall() override {} |
- |
- void SetUpOnMainThread() override { |
- WebstoreStartupInstallerTest::SetUpOnMainThread(); |
- extensions::ExtensionRegistry::Get(browser()->profile())->AddObserver(this); |
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, |
- content::NotificationService::AllSources()); |
- } |
- |
- void TearDownOnMainThread() override { |
- extensions::ExtensionRegistry::Get(browser()->profile()) |
- ->RemoveObserver(this); |
- WebstoreStartupInstallerTest::TearDownOnMainThread(); |
- } |
- |
- bool saw_install() { return saw_install_; } |
- |
- int browser_open_count() { return browser_open_count_; } |
- |
- // NotificationObserver interface. |
- void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) override { |
- DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_OPENED); |
- ++browser_open_count_; |
- } |
- |
- 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_; |
- |
- // Have we seen an installation notification for kTestExtensionId ? |
- bool saw_install_; |
- |
- // How many NOTIFICATION_BROWSER_OPENED notifications have we seen? |
- int browser_open_count_; |
-}; |
- |
-IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, CannotInstallNonEphemeral) { |
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
- command_line->AppendSwitchASCII( |
- switches::kInstallEphemeralAppFromWebstore, kTestExtensionId); |
- AutoAcceptInstall(); |
- extensions::StartupHelper helper; |
- EXPECT_FALSE(helper.InstallEphemeralApp(*command_line, browser()->profile())); |
- EXPECT_FALSE(saw_install()); |
- EXPECT_EQ(0, browser_open_count()); |
-} |