| Index: chrome/browser/download/download_target_determiner_unittest.cc
|
| diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc
|
| index e443b2d3e400766dc7ce82ec60887943d37c77c6..efca2125c050a527e15d5cea53e4e5fb33a13785 100644
|
| --- a/chrome/browser/download/download_target_determiner_unittest.cc
|
| +++ b/chrome/browser/download/download_target_determiner_unittest.cc
|
| @@ -1618,6 +1618,37 @@ TEST_F(DownloadTargetDeterminerTest, ResumedForcedDownload) {
|
| RunTestCase(test_case, GetPathInDownloadDir(kInitialPath), item.get());
|
| }
|
|
|
| +// Test that resuming a download will use the target file path if it is
|
| +// provided.
|
| +TEST_F(DownloadTargetDeterminerTest, ResumedWithTagetFilePath) {
|
| + const base::FilePath::CharType* kInitialPath =
|
| + FILE_PATH_LITERAL("some_path/bar.txt");
|
| + const DownloadTestCase kResumedDownload = {
|
| + AUTOMATIC,
|
| + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
| + DownloadFileType::NOT_DANGEROUS,
|
| + "http://example.com/foo.txt",
|
| + "",
|
| + FILE_PATH_LITERAL(""),
|
| + FILE_PATH_LITERAL("target-foo.txt"),
|
| + DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
| + EXPECT_CRDOWNLOAD};
|
| +
|
| + const DownloadTestCase& test_case = kResumedDownload;
|
| + base::FilePath expected_path =
|
| + GetPathInDownloadDir(test_case.expected_local_path);
|
| + std::unique_ptr<content::MockDownloadItem> item(
|
| + CreateActiveDownloadItem(0, test_case));
|
| + ON_CALL(*item.get(), GetTargetFilePath())
|
| + .WillByDefault(ReturnRefOfCopy(expected_path));
|
| + EXPECT_CALL(*delegate(), NotifyExtensions(_, _, _)).Times(0);
|
| + EXPECT_CALL(*delegate(), ReserveVirtualPath(_, expected_path, false, _, _));
|
| + EXPECT_CALL(*delegate(), PromptUserForDownloadPath(_, _, _)).Times(0);
|
| + EXPECT_CALL(*delegate(), DetermineLocalPath(_, expected_path, _));
|
| + EXPECT_CALL(*delegate(), CheckDownloadUrl(_, expected_path, _));
|
| + RunTestCase(test_case, GetPathInDownloadDir(kInitialPath), item.get());
|
| +}
|
| +
|
| // Prompting behavior for resumed downloads is based on the last interrupt
|
| // reason. If the reason indicates that the target path may not be suitable for
|
| // the download (ACCESS_DENIED, NO_SPACE, etc..), then the user should be
|
|
|