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

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

Issue 2453633006: [downloads] Move platform specific code out of DownloadTargetDeterminer. (Closed)
Patch Set: . Created 4 years, 2 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_browsertest.cc
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 6612712e29c1d7238d04672651571883a0a097d1..6de70891cfcdef909c5a3a3d473b4ecbbe06c3ff 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -482,12 +482,12 @@ class DownloadTest : public InProcessBrowserTest {
}
// Location of the file source (the place from which it is downloaded).
- base::FilePath OriginFile(base::FilePath file) {
+ base::FilePath OriginFile(const base::FilePath& file) {
return test_dir_.Append(file);
}
// Location of the file destination (place to which it is downloaded).
- base::FilePath DestinationFile(Browser* browser, base::FilePath file) {
+ base::FilePath DestinationFile(Browser* browser, const base::FilePath& file) {
return GetDownloadDirectory(browser).Append(file.BaseName());
}
@@ -2877,22 +2877,24 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_CrazyFilenames) {
};
std::vector<DownloadItem*> download_items;
- base::FilePath origin(FILE_PATH_LITERAL("origin"));
- ASSERT_TRUE(base::CreateDirectory(DestinationFile(browser(), origin)));
+ base::FilePath origin_directory =
+ GetDownloadDirectory(browser()).Append(FILE_PATH_LITERAL("origin"));
+ ASSERT_TRUE(base::CreateDirectory(origin_directory));
for (size_t index = 0; index < arraysize(kCrazyFilenames); ++index) {
+ SCOPED_TRACE(testing::Message() << "Index " << index);
base::string16 crazy16;
std::string crazy8;
const wchar_t* crazy_w = kCrazyFilenames[index];
ASSERT_TRUE(base::WideToUTF8(crazy_w, wcslen(crazy_w), &crazy8));
ASSERT_TRUE(base::WideToUTF16(crazy_w, wcslen(crazy_w), &crazy16));
- base::FilePath file_path(DestinationFile(browser(), origin.Append(
+ base::FilePath file_path(origin_directory.Append(
#if defined(OS_WIN)
- crazy16
+ crazy16
#elif defined(OS_POSIX)
- crazy8
+ crazy8
#endif
- )));
+ ));
// Create the file.
EXPECT_EQ(static_cast<int>(crazy8.size()),
@@ -2969,8 +2971,10 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_PauseResumeCancel) {
#endif
IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_PercentComplete) {
// Write a huge file.
- base::FilePath file_path(DestinationFile(
- browser(), base::FilePath(FILE_PATH_LITERAL("DownloadTest_BigZip.zip"))));
+ base::FilePath file_path(
+ GetDownloadDirectory(browser()).AppendASCII("source").AppendASCII(
+ "DownloadTest_BigZip.zip"));
+ ASSERT_TRUE(CreateDirectory(file_path.DirName()));
base::File file(file_path, base::File::FLAG_CREATE | base::File::FLAG_WRITE);
ASSERT_TRUE(file.IsValid());
int64_t size = 1 << 25;

Powered by Google App Engine
This is Rietveld 408576698