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 |