| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
| 9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const std::string& unverified_domain) | 43 const std::string& unverified_domain) |
| 44 : webstore_domain_(webstore_domain), | 44 : webstore_domain_(webstore_domain), |
| 45 test_data_path_(test_data_path), | 45 test_data_path_(test_data_path), |
| 46 crx_filename_(crx_filename), | 46 crx_filename_(crx_filename), |
| 47 verified_domain_(verified_domain), | 47 verified_domain_(verified_domain), |
| 48 unverified_domain_(unverified_domain) { | 48 unverified_domain_(unverified_domain) { |
| 49 } | 49 } |
| 50 | 50 |
| 51 WebstoreInstallerTest::~WebstoreInstallerTest() {} | 51 WebstoreInstallerTest::~WebstoreInstallerTest() {} |
| 52 | 52 |
| 53 void WebstoreInstallerTest::SetUpCommandLine(CommandLine* command_line) { | 53 void WebstoreInstallerTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 54 ExtensionBrowserTest::SetUpCommandLine(command_line); | 54 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 55 // We start the test server now instead of in | 55 // We start the test server now instead of in |
| 56 // SetUpInProcessBrowserTestFixture so that we can get its port number. | 56 // SetUpInProcessBrowserTestFixture so that we can get its port number. |
| 57 ASSERT_TRUE(test_server()->Start()); | 57 ASSERT_TRUE(test_server()->Start()); |
| 58 | 58 |
| 59 net::HostPortPair host_port = test_server()->host_port_pair(); | 59 net::HostPortPair host_port = test_server()->host_port_pair(); |
| 60 test_gallery_url_ = base::StringPrintf( | 60 test_gallery_url_ = base::StringPrintf( |
| 61 "http://%s:%d/files/%s", | 61 "http://%s:%d/files/%s", |
| 62 webstore_domain_.c_str(), host_port.port(), test_data_path_.c_str()); | 62 webstore_domain_.c_str(), host_port.port(), test_data_path_.c_str()); |
| 63 command_line->AppendSwitchASCII( | 63 command_line->AppendSwitchASCII( |
| 64 switches::kAppsGalleryURL, test_gallery_url_); | 64 switches::kAppsGalleryURL, test_gallery_url_); |
| 65 | 65 |
| 66 GURL crx_url = GenerateTestServerUrl(webstore_domain_, crx_filename_); | 66 GURL crx_url = GenerateTestServerUrl(webstore_domain_, crx_filename_); |
| 67 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 67 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 68 switches::kAppsGalleryUpdateURL, crx_url.spec()); | 68 switches::kAppsGalleryUpdateURL, crx_url.spec()); |
| 69 | 69 |
| 70 // Allow tests to call window.gc(), so that we can check that callback | 70 // Allow tests to call window.gc(), so that we can check that callback |
| 71 // functions don't get collected prematurely. | 71 // functions don't get collected prematurely. |
| 72 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 72 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void WebstoreInstallerTest::SetUpInProcessBrowserTestFixture() { | 75 void WebstoreInstallerTest::SetUpInProcessBrowserTestFixture() { |
| 76 host_resolver()->AddRule(webstore_domain_, "127.0.0.1"); | 76 host_resolver()->AddRule(webstore_domain_, "127.0.0.1"); |
| 77 host_resolver()->AddRule(verified_domain_, "127.0.0.1"); | 77 host_resolver()->AddRule(verified_domain_, "127.0.0.1"); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void WebstoreInstallerTest::AutoAcceptInstall() { | 136 void WebstoreInstallerTest::AutoAcceptInstall() { |
| 137 ExtensionInstallPrompt::g_auto_confirm_for_tests = | 137 ExtensionInstallPrompt::g_auto_confirm_for_tests = |
| 138 ExtensionInstallPrompt::ACCEPT; | 138 ExtensionInstallPrompt::ACCEPT; |
| 139 } | 139 } |
| 140 | 140 |
| 141 void WebstoreInstallerTest::AutoCancelInstall() { | 141 void WebstoreInstallerTest::AutoCancelInstall() { |
| 142 ExtensionInstallPrompt::g_auto_confirm_for_tests = | 142 ExtensionInstallPrompt::g_auto_confirm_for_tests = |
| 143 ExtensionInstallPrompt::CANCEL; | 143 ExtensionInstallPrompt::CANCEL; |
| 144 } | 144 } |
| OLD | NEW |