| Index: chrome/browser/download/notification/download_notification_browsertest.cc
|
| diff --git a/chrome/browser/download/notification/download_notification_browsertest.cc b/chrome/browser/download/notification/download_notification_browsertest.cc
|
| index 85bb01ba4a8739439066e127211eec51870756fc..66927c395da7956965cf3fb8c2d1d4be28383498 100644
|
| --- a/chrome/browser/download/notification/download_notification_browsertest.cc
|
| +++ b/chrome/browser/download/notification/download_notification_browsertest.cc
|
| @@ -285,31 +285,23 @@ class DownloadNotificationTestBase : public InProcessBrowserTest {
|
|
|
| GetMessageCenter()->DisableTimersForTest();
|
|
|
| - // Set up the temporary download folder.
|
| - ASSERT_TRUE(CreateAndSetDownloadsDirectory(browser()));
|
| + ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir());
|
| + ASSERT_TRUE(SetDownloadsDirectory(browser()));
|
| }
|
|
|
| protected:
|
| - // Must be called after browser creation. Creates a temporary
|
| - // directory for downloads that is auto-deleted on destruction.
|
| - // Returning false indicates a failure of the function, and should be asserted
|
| - // in the caller.
|
| - bool CreateAndSetDownloadsDirectory(Browser* browser) {
|
| + // Must be called after browser creation. Assumes that |downloads_directory_|
|
| + // is created and sets its path to be used for downloads by |browser|.
|
| + // Returning false indicates a failure of the function, and should be
|
| + // asserted in the caller.
|
| + bool SetDownloadsDirectory(Browser* browser) {
|
| if (!browser)
|
| return false;
|
|
|
| - if (!downloads_directory_.path().empty())
|
| - return true; // already created
|
| -
|
| - if (!downloads_directory_.CreateUniqueTempDir())
|
| - return false;
|
| -
|
| browser->profile()->GetPrefs()->SetFilePath(
|
| - prefs::kDownloadDefaultDirectory,
|
| - downloads_directory_.path());
|
| + prefs::kDownloadDefaultDirectory, downloads_directory_.GetPath());
|
| browser->profile()->GetPrefs()->SetFilePath(
|
| - prefs::kSaveFileDefaultDirectory,
|
| - downloads_directory_.path());
|
| + prefs::kSaveFileDefaultDirectory, downloads_directory_.GetPath());
|
|
|
| return true;
|
| }
|
| @@ -354,7 +346,7 @@ class DownloadNotificationTest : public DownloadNotificationTestBase {
|
| incognito_browser_ = CreateIncognitoBrowser();
|
| Profile* incognito_profile = incognito_browser_->profile();
|
|
|
| - ASSERT_TRUE(CreateAndSetDownloadsDirectory(incognito_browser_));
|
| + ASSERT_TRUE(SetDownloadsDirectory(incognito_browser_));
|
|
|
| std::unique_ptr<TestChromeDownloadManagerDelegate> incognito_test_delegate;
|
| incognito_test_delegate.reset(
|
|
|