| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "content/browser/byte_stream.h" | 10 #include "content/browser/byte_stream.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 DownloadItemImplDelegate::DownloadTargetCallback callback; | 276 DownloadItemImplDelegate::DownloadTargetCallback callback; |
| 277 MockDownloadFile* download_file = | 277 MockDownloadFile* download_file = |
| 278 AddDownloadFileToDownloadItem(item, &callback); | 278 AddDownloadFileToDownloadItem(item, &callback); |
| 279 base::FilePath target_path(kDummyPath); | 279 base::FilePath target_path(kDummyPath); |
| 280 base::FilePath intermediate_path( | 280 base::FilePath intermediate_path( |
| 281 target_path.InsertBeforeExtensionASCII("x")); | 281 target_path.InsertBeforeExtensionASCII("x")); |
| 282 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 282 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 283 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 283 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 284 intermediate_path)); | 284 intermediate_path)); |
| 285 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 285 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 286 danger_type, intermediate_path); | 286 danger_type, intermediate_path, false); |
| 287 RunAllPendingInMessageLoops(); | 287 RunAllPendingInMessageLoops(); |
| 288 return download_file; | 288 return download_file; |
| 289 } | 289 } |
| 290 | 290 |
| 291 // Cleanup a download item (specifically get rid of the DownloadFile on it). | 291 // Cleanup a download item (specifically get rid of the DownloadFile on it). |
| 292 // The item must be in the expected state. | 292 // The item must be in the expected state. |
| 293 void CleanupItem(DownloadItemImpl* item, | 293 void CleanupItem(DownloadItemImpl* item, |
| 294 MockDownloadFile* download_file, | 294 MockDownloadFile* download_file, |
| 295 DownloadItem::DownloadState expected_state) { | 295 DownloadItem::DownloadState expected_state) { |
| 296 EXPECT_EQ(expected_state, item->GetState()); | 296 EXPECT_EQ(expected_state, item->GetState()); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 RunAllPendingInMessageLoops(); | 530 RunAllPendingInMessageLoops(); |
| 531 if (i == 0) { | 531 if (i == 0) { |
| 532 // Target determination is only done the first time through. | 532 // Target determination is only done the first time through. |
| 533 base::FilePath target_path(kDummyPath); | 533 base::FilePath target_path(kDummyPath); |
| 534 base::FilePath intermediate_path( | 534 base::FilePath intermediate_path( |
| 535 target_path.InsertBeforeExtensionASCII("x")); | 535 target_path.InsertBeforeExtensionASCII("x")); |
| 536 EXPECT_CALL(*mock_download_file, RenameAndUniquify(intermediate_path, _)) | 536 EXPECT_CALL(*mock_download_file, RenameAndUniquify(intermediate_path, _)) |
| 537 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 537 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 538 intermediate_path)); | 538 intermediate_path)); |
| 539 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 539 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 540 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 540 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, |
| 541 false); |
| 541 RunAllPendingInMessageLoops(); | 542 RunAllPendingInMessageLoops(); |
| 542 } | 543 } |
| 543 ASSERT_EQ(i, observer.GetResumeCount()); | 544 ASSERT_EQ(i, observer.GetResumeCount()); |
| 544 | 545 |
| 545 // Use a continuable interrupt. | 546 // Use a continuable interrupt. |
| 546 item->DestinationObserverAsWeakPtr()->DestinationError( | 547 item->DestinationObserverAsWeakPtr()->DestinationError( |
| 547 DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR); | 548 DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR); |
| 548 | 549 |
| 549 ASSERT_EQ(i + 1, observer.GetInterruptCount()); | 550 ASSERT_EQ(i + 1, observer.GetInterruptCount()); |
| 550 ::testing::Mock::VerifyAndClearExpectations(mock_download_file); | 551 ::testing::Mock::VerifyAndClearExpectations(mock_download_file); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); | 617 base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); |
| 617 base::FilePath new_intermediate_path( | 618 base::FilePath new_intermediate_path( |
| 618 target_path.InsertBeforeExtensionASCII("y")); | 619 target_path.InsertBeforeExtensionASCII("y")); |
| 619 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 620 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 620 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 621 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 621 new_intermediate_path)); | 622 new_intermediate_path)); |
| 622 | 623 |
| 623 // Currently, a notification would be generated if the danger type is anything | 624 // Currently, a notification would be generated if the danger type is anything |
| 624 // other than NOT_DANGEROUS. | 625 // other than NOT_DANGEROUS. |
| 625 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 626 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 626 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 627 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 627 EXPECT_FALSE(observer.CheckUpdated()); | 628 EXPECT_FALSE(observer.CheckUpdated()); |
| 628 RunAllPendingInMessageLoops(); | 629 RunAllPendingInMessageLoops(); |
| 629 EXPECT_TRUE(observer.CheckUpdated()); | 630 EXPECT_TRUE(observer.CheckUpdated()); |
| 630 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); | 631 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); |
| 631 | 632 |
| 632 CleanupItem(item, download_file, DownloadItem::IN_PROGRESS); | 633 CleanupItem(item, download_file, DownloadItem::IN_PROGRESS); |
| 633 } | 634 } |
| 634 | 635 |
| 635 TEST_F(DownloadItemTest, NotificationAfterTogglePause) { | 636 TEST_F(DownloadItemTest, NotificationAfterTogglePause) { |
| 636 DownloadItemImpl* item = CreateDownloadItem(); | 637 DownloadItemImpl* item = CreateDownloadItem(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 663 MockDownloadFile* download_file = | 664 MockDownloadFile* download_file = |
| 664 AddDownloadFileToDownloadItem(item, &callback); | 665 AddDownloadFileToDownloadItem(item, &callback); |
| 665 base::FilePath target_path(base::FilePath(kDummyPath).AppendASCII("foo.bar")); | 666 base::FilePath target_path(base::FilePath(kDummyPath).AppendASCII("foo.bar")); |
| 666 base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); | 667 base::FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); |
| 667 EXPECT_EQ(FILE_PATH_LITERAL(""), | 668 EXPECT_EQ(FILE_PATH_LITERAL(""), |
| 668 item->GetFileNameToReportUser().value()); | 669 item->GetFileNameToReportUser().value()); |
| 669 EXPECT_CALL(*download_file, RenameAndUniquify(_, _)) | 670 EXPECT_CALL(*download_file, RenameAndUniquify(_, _)) |
| 670 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 671 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 671 intermediate_path)); | 672 intermediate_path)); |
| 672 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 673 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 673 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 674 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 674 RunAllPendingInMessageLoops(); | 675 RunAllPendingInMessageLoops(); |
| 675 EXPECT_EQ(FILE_PATH_LITERAL("foo.bar"), | 676 EXPECT_EQ(FILE_PATH_LITERAL("foo.bar"), |
| 676 item->GetFileNameToReportUser().value()); | 677 item->GetFileNameToReportUser().value()); |
| 677 item->SetDisplayName(base::FilePath(FILE_PATH_LITERAL("new.name"))); | 678 item->SetDisplayName(base::FilePath(FILE_PATH_LITERAL("new.name"))); |
| 678 EXPECT_EQ(FILE_PATH_LITERAL("new.name"), | 679 EXPECT_EQ(FILE_PATH_LITERAL("new.name"), |
| 679 item->GetFileNameToReportUser().value()); | 680 item->GetFileNameToReportUser().value()); |
| 680 CleanupItem(item, download_file, DownloadItem::IN_PROGRESS); | 681 CleanupItem(item, download_file, DownloadItem::IN_PROGRESS); |
| 681 } | 682 } |
| 682 | 683 |
| 683 // Test to make sure that Start method calls DF initialize properly. | 684 // Test to make sure that Start method calls DF initialize properly. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 703 AddDownloadFileToDownloadItem(item, &callback); | 704 AddDownloadFileToDownloadItem(item, &callback); |
| 704 base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar")); | 705 base::FilePath final_path(base::FilePath(kDummyPath).AppendASCII("foo.bar")); |
| 705 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); | 706 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); |
| 706 base::FilePath new_intermediate_path( | 707 base::FilePath new_intermediate_path( |
| 707 final_path.InsertBeforeExtensionASCII("y")); | 708 final_path.InsertBeforeExtensionASCII("y")); |
| 708 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 709 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 709 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 710 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 710 new_intermediate_path)); | 711 new_intermediate_path)); |
| 711 | 712 |
| 712 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 713 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 713 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 714 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 714 RunAllPendingInMessageLoops(); | 715 RunAllPendingInMessageLoops(); |
| 715 // All the callbacks should have happened by now. | 716 // All the callbacks should have happened by now. |
| 716 ::testing::Mock::VerifyAndClearExpectations(download_file); | 717 ::testing::Mock::VerifyAndClearExpectations(download_file); |
| 717 mock_delegate()->VerifyAndClearExpectations(); | 718 mock_delegate()->VerifyAndClearExpectations(); |
| 718 | 719 |
| 719 EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _)) | 720 EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _)) |
| 720 .WillOnce(Return(true)); | 721 .WillOnce(Return(true)); |
| 721 EXPECT_CALL(*download_file, RenameAndAnnotate(final_path, _)) | 722 EXPECT_CALL(*download_file, RenameAndAnnotate(final_path, _)) |
| 722 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 723 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 723 final_path)); | 724 final_path)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 741 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); | 742 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); |
| 742 base::FilePath new_intermediate_path( | 743 base::FilePath new_intermediate_path( |
| 743 final_path.InsertBeforeExtensionASCII("y")); | 744 final_path.InsertBeforeExtensionASCII("y")); |
| 744 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 745 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 745 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 746 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
| 746 new_intermediate_path)); | 747 new_intermediate_path)); |
| 747 EXPECT_CALL(*download_file, Cancel()) | 748 EXPECT_CALL(*download_file, Cancel()) |
| 748 .Times(1); | 749 .Times(1); |
| 749 | 750 |
| 750 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 751 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 751 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 752 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 752 RunAllPendingInMessageLoops(); | 753 RunAllPendingInMessageLoops(); |
| 753 // All the callbacks should have happened by now. | 754 // All the callbacks should have happened by now. |
| 754 ::testing::Mock::VerifyAndClearExpectations(download_file); | 755 ::testing::Mock::VerifyAndClearExpectations(download_file); |
| 755 mock_delegate()->VerifyAndClearExpectations(); | 756 mock_delegate()->VerifyAndClearExpectations(); |
| 756 } | 757 } |
| 757 | 758 |
| 758 TEST_F(DownloadItemTest, Interrupted) { | 759 TEST_F(DownloadItemTest, Interrupted) { |
| 759 DownloadItemImpl* item = CreateDownloadItem(); | 760 DownloadItemImpl* item = CreateDownloadItem(); |
| 760 MockDownloadFile* download_file = | 761 MockDownloadFile* download_file = |
| 761 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); | 762 DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 791 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); | 792 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); |
| 792 base::FilePath new_intermediate_path( | 793 base::FilePath new_intermediate_path( |
| 793 final_path.InsertBeforeExtensionASCII("y")); | 794 final_path.InsertBeforeExtensionASCII("y")); |
| 794 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 795 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 795 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 796 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 796 new_intermediate_path)); | 797 new_intermediate_path)); |
| 797 EXPECT_CALL(*download_file, Cancel()) | 798 EXPECT_CALL(*download_file, Cancel()) |
| 798 .Times(1); | 799 .Times(1); |
| 799 | 800 |
| 800 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 801 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 801 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 802 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 802 RunAllPendingInMessageLoops(); | 803 RunAllPendingInMessageLoops(); |
| 803 // All the callbacks should have happened by now. | 804 // All the callbacks should have happened by now. |
| 804 ::testing::Mock::VerifyAndClearExpectations(download_file); | 805 ::testing::Mock::VerifyAndClearExpectations(download_file); |
| 805 mock_delegate()->VerifyAndClearExpectations(); | 806 mock_delegate()->VerifyAndClearExpectations(); |
| 806 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); | 807 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); |
| 807 EXPECT_TRUE(item->GetFullPath().empty()); | 808 EXPECT_TRUE(item->GetFullPath().empty()); |
| 808 EXPECT_EQ(final_path, item->GetTargetFilePath()); | 809 EXPECT_EQ(final_path, item->GetTargetFilePath()); |
| 809 } | 810 } |
| 810 | 811 |
| 811 // As above. But if the download can be resumed by continuing, then the | 812 // As above. But if the download can be resumed by continuing, then the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 827 base::FilePath new_intermediate_path( | 828 base::FilePath new_intermediate_path( |
| 828 final_path.InsertBeforeExtensionASCII("y")); | 829 final_path.InsertBeforeExtensionASCII("y")); |
| 829 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 830 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 830 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, | 831 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, |
| 831 new_intermediate_path)); | 832 new_intermediate_path)); |
| 832 EXPECT_CALL(*download_file, FullPath()) | 833 EXPECT_CALL(*download_file, FullPath()) |
| 833 .WillOnce(Return(base::FilePath(new_intermediate_path))); | 834 .WillOnce(Return(base::FilePath(new_intermediate_path))); |
| 834 EXPECT_CALL(*download_file, Detach()); | 835 EXPECT_CALL(*download_file, Detach()); |
| 835 | 836 |
| 836 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 837 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 837 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 838 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 838 RunAllPendingInMessageLoops(); | 839 RunAllPendingInMessageLoops(); |
| 839 // All the callbacks should have happened by now. | 840 // All the callbacks should have happened by now. |
| 840 ::testing::Mock::VerifyAndClearExpectations(download_file); | 841 ::testing::Mock::VerifyAndClearExpectations(download_file); |
| 841 mock_delegate()->VerifyAndClearExpectations(); | 842 mock_delegate()->VerifyAndClearExpectations(); |
| 842 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); | 843 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); |
| 843 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); | 844 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); |
| 844 EXPECT_EQ(final_path, item->GetTargetFilePath()); | 845 EXPECT_EQ(final_path, item->GetTargetFilePath()); |
| 845 } | 846 } |
| 846 | 847 |
| 847 // As above. If the intermediate rename fails, then the interrupt reason should | 848 // As above. If the intermediate rename fails, then the interrupt reason should |
| (...skipping 13 matching lines...) Expand all Loading... |
| 861 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); | 862 base::FilePath intermediate_path(final_path.InsertBeforeExtensionASCII("x")); |
| 862 base::FilePath new_intermediate_path( | 863 base::FilePath new_intermediate_path( |
| 863 final_path.InsertBeforeExtensionASCII("y")); | 864 final_path.InsertBeforeExtensionASCII("y")); |
| 864 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) | 865 EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _)) |
| 865 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 866 .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
| 866 new_intermediate_path)); | 867 new_intermediate_path)); |
| 867 EXPECT_CALL(*download_file, Cancel()) | 868 EXPECT_CALL(*download_file, Cancel()) |
| 868 .Times(1); | 869 .Times(1); |
| 869 | 870 |
| 870 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 871 callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 871 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path); | 872 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path, false); |
| 872 RunAllPendingInMessageLoops(); | 873 RunAllPendingInMessageLoops(); |
| 873 // All the callbacks should have happened by now. | 874 // All the callbacks should have happened by now. |
| 874 ::testing::Mock::VerifyAndClearExpectations(download_file); | 875 ::testing::Mock::VerifyAndClearExpectations(download_file); |
| 875 mock_delegate()->VerifyAndClearExpectations(); | 876 mock_delegate()->VerifyAndClearExpectations(); |
| 876 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); | 877 EXPECT_EQ(DownloadItem::INTERRUPTED, item->GetState()); |
| 877 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, item->GetLastReason()); | 878 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, item->GetLastReason()); |
| 878 EXPECT_TRUE(item->GetFullPath().empty()); | 879 EXPECT_TRUE(item->GetFullPath().empty()); |
| 879 EXPECT_EQ(final_path, item->GetTargetFilePath()); | 880 EXPECT_EQ(final_path, item->GetTargetFilePath()); |
| 880 } | 881 } |
| 881 | 882 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 base::Unretained(&returned_path))); | 1293 base::Unretained(&returned_path))); |
| 1293 RunAllPendingInMessageLoops(); | 1294 RunAllPendingInMessageLoops(); |
| 1294 EXPECT_TRUE(returned_path.empty()); | 1295 EXPECT_TRUE(returned_path.empty()); |
| 1295 } | 1296 } |
| 1296 | 1297 |
| 1297 TEST(MockDownloadItem, Compiles) { | 1298 TEST(MockDownloadItem, Compiles) { |
| 1298 MockDownloadItem mock_item; | 1299 MockDownloadItem mock_item; |
| 1299 } | 1300 } |
| 1300 | 1301 |
| 1301 } // namespace content | 1302 } // namespace content |
| OLD | NEW |