| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 GURL crx_url = GenerateTestServerUrl(webstore_domain_, crx_filename_); | 73 GURL crx_url = GenerateTestServerUrl(webstore_domain_, crx_filename_); |
| 74 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 74 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 75 switches::kAppsGalleryUpdateURL, crx_url.spec()); | 75 switches::kAppsGalleryUpdateURL, crx_url.spec()); |
| 76 | 76 |
| 77 // Allow tests to call window.gc(), so that we can check that callback | 77 // Allow tests to call window.gc(), so that we can check that callback |
| 78 // functions don't get collected prematurely. | 78 // functions don't get collected prematurely. |
| 79 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 79 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WebstoreInstallerTest::SetUpInProcessBrowserTestFixture() { | |
| 83 host_resolver()->AddRule(webstore_domain_, "127.0.0.1"); | |
| 84 host_resolver()->AddRule(verified_domain_, "127.0.0.1"); | |
| 85 host_resolver()->AddRule(unverified_domain_, "127.0.0.1"); | |
| 86 } | |
| 87 | |
| 88 void WebstoreInstallerTest::SetUpOnMainThread() { | 82 void WebstoreInstallerTest::SetUpOnMainThread() { |
| 89 ExtensionBrowserTest::SetUpOnMainThread(); | 83 ExtensionBrowserTest::SetUpOnMainThread(); |
| 90 ASSERT_TRUE(download_directory_.CreateUniqueTempDir()); | 84 ASSERT_TRUE(download_directory_.CreateUniqueTempDir()); |
| 91 DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( | 85 DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( |
| 92 browser()->profile()); | 86 browser()->profile()); |
| 93 download_prefs->SetDownloadPath(download_directory_.GetPath()); | 87 download_prefs->SetDownloadPath(download_directory_.GetPath()); |
| 88 |
| 89 host_resolver()->AddRule(webstore_domain_, "127.0.0.1"); |
| 90 host_resolver()->AddRule(verified_domain_, "127.0.0.1"); |
| 91 host_resolver()->AddRule(unverified_domain_, "127.0.0.1"); |
| 94 } | 92 } |
| 95 | 93 |
| 96 GURL WebstoreInstallerTest::GenerateTestServerUrl( | 94 GURL WebstoreInstallerTest::GenerateTestServerUrl( |
| 97 const std::string& domain, | 95 const std::string& domain, |
| 98 const std::string& page_filename) { | 96 const std::string& page_filename) { |
| 99 GURL page_url = embedded_test_server()->GetURL(base::StringPrintf( | 97 GURL page_url = embedded_test_server()->GetURL(base::StringPrintf( |
| 100 "/%s/%s", test_data_path_.c_str(), page_filename.c_str())); | 98 "/%s/%s", test_data_path_.c_str(), page_filename.c_str())); |
| 101 | 99 |
| 102 GURL::Replacements replace_host; | 100 GURL::Replacements replace_host; |
| 103 replace_host.SetHostStr(domain); | 101 replace_host.SetHostStr(domain); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 install_auto_confirm_.reset(); // Destroy any old override first. | 146 install_auto_confirm_.reset(); // Destroy any old override first. |
| 149 install_auto_confirm_.reset(new extensions::ScopedTestDialogAutoConfirm( | 147 install_auto_confirm_.reset(new extensions::ScopedTestDialogAutoConfirm( |
| 150 extensions::ScopedTestDialogAutoConfirm::ACCEPT)); | 148 extensions::ScopedTestDialogAutoConfirm::ACCEPT)); |
| 151 } | 149 } |
| 152 | 150 |
| 153 void WebstoreInstallerTest::AutoCancelInstall() { | 151 void WebstoreInstallerTest::AutoCancelInstall() { |
| 154 install_auto_confirm_.reset(); // Destroy any old override first. | 152 install_auto_confirm_.reset(); // Destroy any old override first. |
| 155 install_auto_confirm_.reset(new extensions::ScopedTestDialogAutoConfirm( | 153 install_auto_confirm_.reset(new extensions::ScopedTestDialogAutoConfirm( |
| 156 extensions::ScopedTestDialogAutoConfirm::CANCEL)); | 154 extensions::ScopedTestDialogAutoConfirm::CANCEL)); |
| 157 } | 155 } |
| OLD | NEW |