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

Unified Diff: chrome/browser/download/download_util_unittest.cc

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add ChooseSavableDirectory() and ScopedDefaultDownloadDirectory Created 9 years, 6 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
Index: chrome/browser/download/download_util_unittest.cc
diff --git a/chrome/browser/download/download_util_unittest.cc b/chrome/browser/download/download_util_unittest.cc
index c8143e2f314c6d1a184111d29f88c482ba13b1c4..387ba2b6f6ad612fd9ef18dd4d40978c644e274d 100644
--- a/chrome/browser/download/download_util_unittest.cc
+++ b/chrome/browser/download/download_util_unittest.cc
@@ -8,8 +8,10 @@
#include <locale.h>
#endif
+#include "base/path_service.h"
#include "base/string_util.h"
#include "base/test/test_file_util.h"
+#include "chrome/common/chrome_paths.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -578,5 +580,22 @@ TEST(DownloadUtilTest, GenerateSafeFileName) {
}
}
-} // namespace
+TEST(DownloadUtilTest, OverrideDefaultDownloadFolder) {
+ FilePath override_path(FILE_PATH_LITERAL("/koakuma/mikity/moemoe/nyannyan"));
+ FilePath original_path;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &original_path));
+ download_util::ScopedDefaultDownloadDirectory override_default_downloads;
+
+ FilePath current_path = download_util::DefaultDownloadDirectory::Get();
+ EXPECT_EQ(current_path, original_path);
+
+ override_default_downloads.Override(override_path);
+ current_path = download_util::DefaultDownloadDirectory::Get();
+ EXPECT_EQ(current_path, override_path);
+ override_default_downloads.UnOverride();
+ current_path = download_util::DefaultDownloadDirectory::Get();
+ EXPECT_EQ(current_path, original_path);
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698