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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc

Issue 819133004: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }; 89 };
90 90
91 } // namespace 91 } // namespace
92 92
93 // A base class for tests below. 93 // A base class for tests below.
94 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { 94 class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
95 public: 95 public:
96 ExtensionWebstorePrivateApiTest() {} 96 ExtensionWebstorePrivateApiTest() {}
97 ~ExtensionWebstorePrivateApiTest() override {} 97 ~ExtensionWebstorePrivateApiTest() override {}
98 98
99 void SetUpCommandLine(CommandLine* command_line) override { 99 void SetUpCommandLine(base::CommandLine* command_line) override {
100 ExtensionApiTest::SetUpCommandLine(command_line); 100 ExtensionApiTest::SetUpCommandLine(command_line);
101 command_line->AppendSwitchASCII( 101 command_line->AppendSwitchASCII(
102 switches::kAppsGalleryURL, 102 switches::kAppsGalleryURL,
103 "http://www.example.com/files/extensions/api_test"); 103 "http://www.example.com/files/extensions/api_test");
104 } 104 }
105 105
106 void SetUpInProcessBrowserTestFixture() override { 106 void SetUpInProcessBrowserTestFixture() override {
107 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 107 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
108 108
109 // Start up the test server and get us ready for calling the install 109 // Start up the test server and get us ready for calling the install
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Navigates to |page| and runs the Extension API test there. Any downloads 148 // Navigates to |page| and runs the Extension API test there. Any downloads
149 // of extensions will return the contents of |crx_file|. 149 // of extensions will return the contents of |crx_file|.
150 bool RunInstallTest(const std::string& page, const std::string& crx_file) { 150 bool RunInstallTest(const std::string& page, const std::string& crx_file) {
151 // Auto-confirm the uninstallation dialog. 151 // Auto-confirm the uninstallation dialog.
152 ManagementUninstallFunction::SetAutoConfirmForTest(true); 152 ManagementUninstallFunction::SetAutoConfirmForTest(true);
153 #if defined(OS_WIN) && !defined(NDEBUG) 153 #if defined(OS_WIN) && !defined(NDEBUG)
154 // See http://crbug.com/177163 for details. 154 // See http://crbug.com/177163 for details.
155 return true; 155 return true;
156 #else 156 #else
157 GURL crx_url = GetTestServerURL(crx_file); 157 GURL crx_url = GetTestServerURL(crx_file);
158 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 158 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
159 switches::kAppsGalleryUpdateURL, crx_url.spec()); 159 switches::kAppsGalleryUpdateURL, crx_url.spec());
160 160
161 GURL page_url = GetTestServerURL(page); 161 GURL page_url = GetTestServerURL(page);
162 return RunPageTest(page_url.spec()); 162 return RunPageTest(page_url.spec());
163 #endif 163 #endif
164 } 164 }
165 165
166 content::WebContents* GetWebContents() { 166 content::WebContents* GetWebContents() {
167 return browser()->tab_strip_model()->GetActiveWebContents(); 167 return browser()->tab_strip_model()->GetActiveWebContents();
168 } 168 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 : public ExtensionWebstorePrivateApiTest { 400 : public ExtensionWebstorePrivateApiTest {
401 public: 401 public:
402 void SetUpInProcessBrowserTestFixture() override { 402 void SetUpInProcessBrowserTestFixture() override {
403 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture(); 403 ExtensionWebstorePrivateApiTest::SetUpInProcessBrowserTestFixture();
404 404
405 net::HostPortPair host_port = test_server()->host_port_pair(); 405 net::HostPortPair host_port = test_server()->host_port_pair();
406 std::string test_gallery_url = base::StringPrintf( 406 std::string test_gallery_url = base::StringPrintf(
407 "http://www.example.com:%d/files/extensions/platform_apps/" 407 "http://www.example.com:%d/files/extensions/platform_apps/"
408 "ephemeral_launcher", 408 "ephemeral_launcher",
409 host_port.port()); 409 host_port.port());
410 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 410 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
411 switches::kAppsGalleryURL, test_gallery_url); 411 switches::kAppsGalleryURL, test_gallery_url);
412 } 412 }
413 413
414 GURL GetTestServerURL(const std::string& path) override { 414 GURL GetTestServerURL(const std::string& path) override {
415 return DoGetTestServerURL( 415 return DoGetTestServerURL(
416 std::string("files/extensions/platform_apps/ephemeral_launcher/") + 416 std::string("files/extensions/platform_apps/ephemeral_launcher/") +
417 path); 417 path);
418 } 418 }
419 }; 419 };
420 420
421 // Run tests when the --enable-ephemeral-apps switch is not enabled. 421 // Run tests when the --enable-ephemeral-apps switch is not enabled.
422 IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, 422 IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest,
423 EphemeralAppsFeatureDisabled) { 423 EphemeralAppsFeatureDisabled) {
424 CommandLine::ForCurrentProcess()->AppendSwitch( 424 base::CommandLine::ForCurrentProcess()->AppendSwitch(
425 app_list::switches::kDisableExperimentalAppList); 425 app_list::switches::kDisableExperimentalAppList);
426 ASSERT_TRUE(RunInstallTest("webstore_launch_disabled.html", "app.crx")); 426 ASSERT_TRUE(RunInstallTest("webstore_launch_disabled.html", "app.crx"));
427 } 427 }
428 428
429 // Run tests when the --enable-ephemeral-apps switch is enabled. 429 // Run tests when the --enable-ephemeral-apps switch is enabled.
430 IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, LaunchEphemeralApp) { 430 IN_PROC_BROWSER_TEST_F(EphemeralAppWebstorePrivateApiTest, LaunchEphemeralApp) {
431 CommandLine::ForCurrentProcess()->AppendSwitch( 431 base::CommandLine::ForCurrentProcess()->AppendSwitch(
432 switches::kEnableEphemeralAppsInWebstore); 432 switches::kEnableEphemeralAppsInWebstore);
433 CommandLine::ForCurrentProcess()->AppendSwitch( 433 base::CommandLine::ForCurrentProcess()->AppendSwitch(
434 app_list::switches::kEnableExperimentalAppList); 434 app_list::switches::kEnableExperimentalAppList);
435 ASSERT_TRUE(RunInstallTest("webstore_launch_app.html", "app.crx")); 435 ASSERT_TRUE(RunInstallTest("webstore_launch_app.html", "app.crx"));
436 } 436 }
437 437
438 } // namespace extensions 438 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698