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

Unified Diff: content/browser/download/download_item_impl_unittest.cc

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r168573 Created 8 years, 1 month 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: 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 b20873b1db718f65f2abc102313e808908ed0f94..c29c99a83582303efa9bece6285b893b2481f31c 100644
--- a/content/browser/download/download_item_impl_unittest.cc
+++ b/content/browser/download/download_item_impl_unittest.cc
@@ -45,9 +45,7 @@ class MockDelegate : public DownloadItemImplDelegate {
MOCK_METHOD1(DownloadCompleted, void(DownloadItemImpl*));
MOCK_METHOD1(DownloadOpened, void(DownloadItemImpl*));
MOCK_METHOD1(DownloadRemoved, void(DownloadItemImpl*));
- MOCK_METHOD1(DownloadRenamedToIntermediateName,
- void(DownloadItemImpl*));
- MOCK_METHOD1(DownloadRenamedToFinalName, void(DownloadItemImpl*));
+ MOCK_METHOD1(ShowDownloadInBrowser, void(DownloadItemImpl*));
MOCK_CONST_METHOD1(AssertStateConsistent, void(DownloadItemImpl*));
};
@@ -445,10 +443,6 @@ TEST_F(DownloadItemTest, Start) {
}
// Test that the delegate is invoked after the download file is renamed.
-// Delegate::DownloadRenamedToIntermediateName() should be invoked when the
-// download is renamed to the intermediate name.
-// Delegate::DownloadRenamedToFinalName() should be invoked after the final
-// rename.
TEST_F(DownloadItemTest, CallbackAfterRename) {
DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS);
DownloadItemImplDelegate::DownloadTargetCallback callback;
@@ -459,15 +453,9 @@ TEST_F(DownloadItemTest, CallbackAfterRename) {
FilePath new_intermediate_path(final_path.InsertBeforeExtensionASCII("y"));
EXPECT_CALL(*download_file, RenameAndUniquify(intermediate_path, _))
.WillOnce(ScheduleRenameCallback(new_intermediate_path));
+ EXPECT_CALL(*mock_delegate(), ShowDownloadInBrowser(item))
+ .Times(1);
- // DownloadItemImpl should invoke this callback on the delegate once the
- // download is renamed to the intermediate name. Also check that GetFullPath()
- // returns the intermediate path at the time of the call.
- EXPECT_CALL(*mock_delegate(),
- DownloadRenamedToIntermediateName(
- AllOf(item,
- Property(&DownloadItem::GetFullPath,
- new_intermediate_path))));
callback.Run(final_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, intermediate_path);
RunAllPendingInMessageLoops();
@@ -478,20 +466,10 @@ TEST_F(DownloadItemTest, CallbackAfterRename) {
item->OnAllDataSaved("");
EXPECT_CALL(*download_file, RenameAndAnnotate(final_path, _))
.WillOnce(ScheduleRenameCallback(final_path));
- // DownloadItemImpl should invoke this callback on the delegate after the
- // final rename has completed. Also check that GetFullPath() and
- // GetTargetFilePath() return the final path at the time of the call.
- EXPECT_CALL(*mock_delegate(),
- DownloadRenamedToFinalName(
- AllOf(item,
- Property(&DownloadItem::GetFullPath, final_path),
- Property(&DownloadItem::GetTargetFilePath,
- final_path))));
EXPECT_CALL(*mock_delegate(), DownloadCompleted(item));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, Detach());
- item->SetIsPersisted();
item->MaybeCompleteDownload();
RunAllPendingInMessageLoops();
::testing::Mock::VerifyAndClearExpectations(download_file);

Powered by Google App Engine
This is Rietveld 408576698