| Index: content/browser/download/download_item_impl_unittest.cc
|
| diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc
|
| index 85428806e1e6c416858a0affadde2caafa4d79a8..939c5178714eeeb839b1330f619803ce9be07f98 100644
|
| --- a/content/browser/download/download_item_impl_unittest.cc
|
| +++ b/content/browser/download/download_item_impl_unittest.cc
|
| @@ -35,7 +35,7 @@ namespace {
|
| const int kDownloadChunkSize = 1000;
|
| const int kDownloadSpeed = 1000;
|
| const int kDummyDBHandle = 10;
|
| -const FilePath::CharType kDummyPath[] = FILE_PATH_LITERAL("/testpath");
|
| +const base::FilePath::CharType kDummyPath[] = FILE_PATH_LITERAL("/testpath");
|
|
|
| } // namespace
|
|
|
| @@ -57,7 +57,7 @@ class MockDelegate : public DownloadItemImplDelegate {
|
| bool(DownloadItemImpl*, const base::Closure&));
|
| MOCK_METHOD2(ShouldOpenDownload,
|
| bool(DownloadItemImpl*, const ShouldOpenDownloadCallback&));
|
| - MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const FilePath&));
|
| + MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const base::FilePath&));
|
| MOCK_METHOD1(CheckForFileRemoval, void(DownloadItemImpl*));
|
|
|
| virtual void ResumeInterruptedDownload(
|
| @@ -283,8 +283,9 @@ class DownloadItemTest : public testing::Test {
|
| DownloadItemImplDelegate::DownloadTargetCallback callback;
|
| MockDownloadFile* download_file =
|
| AddDownloadFileToDownloadItem(item, &callback);
|
| - FilePath target_path(kDummyPath);
|
| - FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
|
| + base::FilePath target_path(kDummyPath);
|
| + base::FilePath intermediate_path(
|
| + target_path.InsertBeforeExtensionASCII("x"));
|
| EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| intermediate_path));
|
| @@ -564,9 +565,10 @@ TEST_F(DownloadItemTest, NotificationAfterOnDownloadTargetDetermined) {
|
| MockDownloadFile* download_file =
|
| AddDownloadFileToDownloadItem(item, &callback);
|
| MockObserver observer(item);
|
| - FilePath target_path(kDummyPath);
|
| - FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
|
| - FilePath new_intermediate_path(target_path.InsertBeforeExtensionASCII("y"));
|
| + base::FilePath target_path(kDummyPath);
|
| + base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
|
| + base::FilePath new_intermediate_path(
|
| + target_path.InsertBeforeExtensionASCII("y"));
|
| EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| new_intermediate_path));
|
| @@ -614,8 +616,8 @@ TEST_F(DownloadItemTest, DisplayName) {
|
| DownloadItemImplDelegate::DownloadTargetCallback callback;
|
| MockDownloadFile* download_file =
|
| AddDownloadFileToDownloadItem(item, &callback);
|
| - FilePath target_path(FilePath(kDummyPath).AppendASCII("foo.bar"));
|
| - FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
|
| + base::FilePath target_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
|
| + base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x"));
|
| EXPECT_EQ(FILE_PATH_LITERAL(""),
|
| item->GetFileNameToReportUser().value());
|
| EXPECT_CALL(*download_file, RenameAndUniquify(_, _))
|
| @@ -627,7 +629,7 @@ TEST_F(DownloadItemTest, DisplayName) {
|
| RunAllPendingInMessageLoops();
|
| EXPECT_EQ(FILE_PATH_LITERAL("foo.bar"),
|
| item->GetFileNameToReportUser().value());
|
| - item->SetDisplayName(FilePath(FILE_PATH_LITERAL("new.name")));
|
| + item->SetDisplayName(base::FilePath(FILE_PATH_LITERAL("new.name")));
|
| EXPECT_EQ(FILE_PATH_LITERAL("new.name"),
|
| item->GetFileNameToReportUser().value());
|
| CleanupItem(item, download_file, DownloadItem::IN_PROGRESS);
|
| @@ -653,9 +655,10 @@ TEST_F(DownloadItemTest, CallbackAfterRename) {
|
| DownloadItemImplDelegate::DownloadTargetCallback callback;
|
| MockDownloadFile* download_file =
|
| AddDownloadFileToDownloadItem(item, &callback);
|
| - FilePath final_path(FilePath(kDummyPath).AppendASCII("foo.bar"));
|
| - FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
|
| - FilePath new_intermediate_path(final_path.InsertBeforeExtensionASCII("y"));
|
| + base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
|
| + base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
|
| + base::FilePath new_intermediate_path(
|
| + final_path.InsertBeforeExtensionASCII("y"));
|
| EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| new_intermediate_path));
|
| @@ -688,9 +691,10 @@ TEST_F(DownloadItemTest, CallbackAfterInterruptedRename) {
|
| DownloadItemImplDelegate::DownloadTargetCallback callback;
|
| MockDownloadFile* download_file =
|
| AddDownloadFileToDownloadItem(item, &callback);
|
| - FilePath final_path(FilePath(kDummyPath).AppendASCII("foo.bar"));
|
| - FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
|
| - FilePath new_intermediate_path(final_path.InsertBeforeExtensionASCII("y"));
|
| + base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar"));
|
| + base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x"));
|
| + base::FilePath new_intermediate_path(
|
| + final_path.InsertBeforeExtensionASCII("y"));
|
| EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED,
|
| new_intermediate_path));
|
| @@ -837,7 +841,7 @@ TEST_F(DownloadItemTest, EnabledActionsForNormalDownload) {
|
| // Complete
|
| EXPECT_CALL(*download_file, RenameAndAnnotate(_, _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| - FilePath(kDummyPath)));
|
| + base::FilePath(kDummyPath)));
|
| EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _))
|
| .WillOnce(Return(true));
|
| EXPECT_CALL(*download_file, Detach());
|
| @@ -866,7 +870,7 @@ TEST_F(DownloadItemTest, EnabledActionsForTemporaryDownload) {
|
| .WillOnce(Return(true));
|
| EXPECT_CALL(*download_file, RenameAndAnnotate(_, _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| - FilePath(kDummyPath)));
|
| + base::FilePath(kDummyPath)));
|
| EXPECT_CALL(*download_file, Detach());
|
| item->DestinationObserverAsWeakPtr()->DestinationCompleted("");
|
| RunAllPendingInMessageLoops();
|
| @@ -921,9 +925,9 @@ TEST_F(DownloadItemTest, CompleteDelegate_ReturnTrue) {
|
| EXPECT_FALSE(item->IsDangerous());
|
|
|
| // Make sure the download can complete.
|
| - EXPECT_CALL(*download_file, RenameAndAnnotate(FilePath(kDummyPath), _))
|
| + EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| - FilePath(kDummyPath)));
|
| + base::FilePath(kDummyPath)));
|
| EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
|
| .WillOnce(Return(true));
|
| EXPECT_CALL(*download_file, Detach());
|
| @@ -956,9 +960,9 @@ TEST_F(DownloadItemTest, CompleteDelegate_BlockOnce) {
|
| EXPECT_FALSE(item->IsDangerous());
|
|
|
| // Make sure the download can complete.
|
| - EXPECT_CALL(*download_file, RenameAndAnnotate(FilePath(kDummyPath), _))
|
| + EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| - FilePath(kDummyPath)));
|
| + base::FilePath(kDummyPath)));
|
| EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
|
| .WillOnce(Return(true));
|
| EXPECT_CALL(*download_file, Detach());
|
| @@ -994,9 +998,9 @@ TEST_F(DownloadItemTest, CompleteDelegate_SetDanger) {
|
| EXPECT_TRUE(item->IsDangerous());
|
|
|
| // Make sure the download doesn't complete until we've validated it.
|
| - EXPECT_CALL(*download_file, RenameAndAnnotate(FilePath(kDummyPath), _))
|
| + EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| - FilePath(kDummyPath)));
|
| + base::FilePath(kDummyPath)));
|
| EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
|
| .WillOnce(Return(true));
|
| EXPECT_CALL(*download_file, Detach());
|
| @@ -1042,9 +1046,9 @@ TEST_F(DownloadItemTest, CompleteDelegate_BlockTwice) {
|
| EXPECT_FALSE(item->IsDangerous());
|
|
|
| // Make sure the download can complete.
|
| - EXPECT_CALL(*download_file, RenameAndAnnotate(FilePath(kDummyPath), _))
|
| + EXPECT_CALL(*download_file, RenameAndAnnotate(base::FilePath(kDummyPath), _))
|
| .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE,
|
| - FilePath(kDummyPath)));
|
| + base::FilePath(kDummyPath)));
|
| EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
|
| .WillOnce(Return(true));
|
| EXPECT_CALL(*download_file, Detach());
|
|
|