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

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

Issue 12494028: Move Requirements out of Extension Class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
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 0afb3ca8a25fba24088645025aaca981dea34d58..770766d551c2f8e136f2a4befe55e7ab8919c0f6 100644
--- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
@@ -16,7 +16,9 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/api/requirements/requirements_handler.h"
#include "chrome/common/extensions/extension_builder.h"
+#include "chrome/common/extensions/manifest_handler.h"
#include "chrome/common/extensions/value_builder.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -30,10 +32,8 @@
#include "net/base/mock_host_resolver.h"
using content::WebContents;
-using extensions::DictionaryBuilder;
-using extensions::Extension;
-using extensions::ExtensionBuilder;
-using extensions::ListBuilder;
+
+namespace extensions {
const char kWebstoreDomain[] = "cws.com";
const char kAppDomain[] = "app.com";
@@ -41,7 +41,7 @@ const char kNonAppDomain[] = "nonapp.com";
const char kTestExtensionId[] = "ecglahbcnmdpdciemllbhojghbkagdje";
class WebstoreStartupInstallerTest : public InProcessBrowserTest {
- public:
+ protected:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
// We start the test server now instead of in
// SetUpInProcessBrowserTestFixture so that we can get its port number.
@@ -69,7 +69,16 @@ class WebstoreStartupInstallerTest : public InProcessBrowserTest {
host_resolver()->AddRule(kNonAppDomain, "127.0.0.1");
}
- protected:
+ virtual void SetUpOnMainThread() OVERRIDE {
+ InProcessBrowserTest::SetUpOnMainThread();
+ (new RequirementsHandler)->Register();
+ }
+
+ virtual void CleanUpOnMainThread() OVERRIDE {
+ ManifestHandler::ClearRegistryForTesting();
+ InProcessBrowserTest::CleanUpOnMainThread();
+ }
+
GURL GenerateTestServerUrl(const std::string& domain,
const std::string& page_filename) {
GURL page_url = test_server()->GetURL(
@@ -122,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, Install) {
RunTest("runTest");
- const extensions::Extension* extension = browser()->profile()->
+ const Extension* extension = browser()->profile()->
GetExtensionService()->GetExtensionById(kTestExtensionId, false);
EXPECT_TRUE(extension);
}
@@ -220,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) {
ASSERT_TRUE(hosted_app);
ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(browser()->profile())->
+ ExtensionSystem::Get(browser()->profile())->
extension_service();
extension_service->AddExtension(hosted_app.get());
@@ -313,7 +322,7 @@ IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Accept) {
switches::kInstallFromWebstore, kTestExtensionId);
command_line->AppendSwitchASCII(
switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
- extensions::StartupHelper helper;
+ StartupHelper helper;
EXPECT_TRUE(helper.InstallFromWebstore(*command_line, browser()->profile()));
EXPECT_TRUE(saw_install());
EXPECT_EQ(0, browser_open_count());
@@ -325,14 +334,14 @@ IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, Cancel) {
switches::kInstallFromWebstore, kTestExtensionId);
command_line->AppendSwitchASCII(
switches::kAppsGalleryInstallAutoConfirmForTests, "cancel");
- extensions::StartupHelper helper;
+ StartupHelper helper;
EXPECT_FALSE(helper.InstallFromWebstore(*command_line, browser()->profile()));
EXPECT_FALSE(saw_install());
EXPECT_EQ(0, browser_open_count());
}
IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, LimitedAccept) {
- extensions::StartupHelper helper;
+ StartupHelper helper;
// Small test of "WebStoreIdFromLimitedInstallCmdLine" which made more
// sense together with the rest of the test for "LimitedInstallFromWebstore".
@@ -368,10 +377,12 @@ IN_PROC_BROWSER_TEST_F(CommandLineWebstoreInstall, LimitedCancel) {
switches::kLimitedInstallFromWebstore, "2");
command_line->AppendSwitchASCII(
switches::kAppsGalleryInstallAutoConfirmForTests, "cancel");
- extensions::StartupHelper helper;
+ StartupHelper helper;
helper.LimitedInstallFromWebstore(*command_line, browser()->profile(),
MessageLoop::QuitWhenIdleClosure());
MessageLoop::current()->Run();
EXPECT_FALSE(saw_install());
EXPECT_EQ(0, browser_open_count());
}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698