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

Unified Diff: chrome/browser/prefs/pref_functional_browsertest.cc

Issue 273233004: Fix some more tests that were writing to the user's home directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 7 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
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_functional_browsertest.cc
diff --git a/chrome/browser/prefs/pref_functional_browsertest.cc b/chrome/browser/prefs/pref_functional_browsertest.cc
index 6e3d659fc5162055984c4ffa528f74057a4517f3..856dea7b1752ceed276399a0ee699571f97a7223 100644
--- a/chrome/browser/prefs/pref_functional_browsertest.cc
+++ b/chrome/browser/prefs/pref_functional_browsertest.cc
@@ -44,26 +44,15 @@ class PrefsFunctionalTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) {
ASSERT_TRUE(test_server()->Start());
+ base::ScopedTempDir new_download_dir;
+ ASSERT_TRUE(new_download_dir.CreateUniqueTempDir());
- DownloadManager* download_manager =
- BrowserContext::GetDownloadManager(browser()->profile());
- base::FilePath download_dir =
- (DownloadPrefs::FromDownloadManager(download_manager))->DownloadPath();
- base::FilePath new_download_dir = download_dir.AppendASCII("my_downloads");
base::FilePath downloaded_pkg =
- new_download_dir.AppendASCII("a_zip_file.zip");
+ new_download_dir.path().AppendASCII("a_zip_file.zip");
- // If the directory exists, delete it.
- if (base::PathExists(new_download_dir)) {
- base::DeleteFile(new_download_dir, true);
- }
-
- // Create the new downloads directory.
- base::CreateDirectory(new_download_dir);
// Set pref to download in new_download_dir.
browser()->profile()->GetPrefs()->SetFilePath(
- prefs::kDownloadDefaultDirectory,
- new_download_dir);
+ prefs::kDownloadDefaultDirectory, new_download_dir.path());
// Create a downloads observer.
scoped_ptr<content::DownloadTestObserver> downloads_observer(
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698