Commit 987858a1 authored by asanka@chromium.org's avatar asanka@chromium.org

Use a temp directory for downloads in WebstoreInstaller tests.

These were writing to the current user's downloads directory instead of
a unique temporary directory.

BUG=372017
R=asargent@chromium.org, jamescook@chromium.org
TBR=asargent

Review URL: https://codereview.chromium.org/276133002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269538 0039d316-1c4b-4281-b951-d872f2087c98
parent 0ed5387e
......@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/extensions/webstore_inline_installer.h"
......@@ -77,6 +78,14 @@ void WebstoreInstallerTest::SetUpInProcessBrowserTestFixture() {
host_resolver()->AddRule(unverified_domain_, "127.0.0.1");
}
void WebstoreInstallerTest::SetUpOnMainThread() {
InProcessBrowserTest::SetUpOnMainThread();
ASSERT_TRUE(download_directory_.CreateUniqueTempDir());
DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(
browser()->profile());
download_prefs->SetDownloadPath(download_directory_.path());
}
GURL WebstoreInstallerTest::GenerateTestServerUrl(
const std::string& domain,
const std::string& page_filename) {
......
......@@ -7,6 +7,7 @@
#include <string>
#include "base/files/scoped_temp_dir.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "url/gurl.h"
......@@ -25,6 +26,7 @@ class WebstoreInstallerTest : public InProcessBrowserTest {
virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE;
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
virtual void SetUpOnMainThread() OVERRIDE;
protected:
GURL GenerateTestServerUrl(const std::string& domain,
......@@ -49,6 +51,8 @@ class WebstoreInstallerTest : public InProcessBrowserTest {
std::string verified_domain_;
std::string unverified_domain_;
std::string test_gallery_url_;
base::ScopedTempDir download_directory_;
};
#endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment