| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 class MockDownloadItemImpl : public DownloadItemImpl { | 58 class MockDownloadItemImpl : public DownloadItemImpl { |
| 59 public: | 59 public: |
| 60 // Use history constructor for minimal base object. | 60 // Use history constructor for minimal base object. |
| 61 MockDownloadItemImpl(DownloadItemImplDelegate* delegate) | 61 MockDownloadItemImpl(DownloadItemImplDelegate* delegate) |
| 62 : DownloadItemImpl(delegate, content::DownloadId(), | 62 : DownloadItemImpl(delegate, content::DownloadId(), |
| 63 content::DownloadPersistentStoreInfo(), | 63 content::DownloadPersistentStoreInfo(), |
| 64 net::BoundNetLog()) {} | 64 net::BoundNetLog()) {} |
| 65 virtual ~MockDownloadItemImpl() {} | 65 virtual ~MockDownloadItemImpl() {} |
| 66 | 66 |
| 67 MOCK_METHOD4(OnDownloadTargetDetermined, |
| 68 void(const FilePath&, TargetDisposition, |
| 69 content::DownloadDangerType, const FilePath&)); |
| 67 MOCK_METHOD1(AddObserver, void(content::DownloadItem::Observer*)); | 70 MOCK_METHOD1(AddObserver, void(content::DownloadItem::Observer*)); |
| 68 MOCK_METHOD1(RemoveObserver, void(content::DownloadItem::Observer*)); | 71 MOCK_METHOD1(RemoveObserver, void(content::DownloadItem::Observer*)); |
| 69 MOCK_METHOD0(UpdateObservers, void()); | 72 MOCK_METHOD0(UpdateObservers, void()); |
| 70 MOCK_METHOD0(CanShowInFolder, bool()); | 73 MOCK_METHOD0(CanShowInFolder, bool()); |
| 71 MOCK_METHOD0(CanOpenDownload, bool()); | 74 MOCK_METHOD0(CanOpenDownload, bool()); |
| 72 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool()); | 75 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool()); |
| 73 MOCK_METHOD0(OpenDownload, void()); | 76 MOCK_METHOD0(OpenDownload, void()); |
| 74 MOCK_METHOD0(ShowDownloadInShell, void()); | 77 MOCK_METHOD0(ShowDownloadInShell, void()); |
| 75 MOCK_METHOD0(DangerousDownloadValidated, void()); | 78 MOCK_METHOD0(DangerousDownloadValidated, void()); |
| 76 MOCK_METHOD3(UpdateProgress, void(int64, int64, const std::string&)); | 79 MOCK_METHOD3(UpdateProgress, void(int64, int64, const std::string&)); |
| 77 MOCK_METHOD1(Cancel, void(bool)); | 80 MOCK_METHOD1(Cancel, void(bool)); |
| 78 MOCK_METHOD0(MarkAsComplete, void()); | 81 MOCK_METHOD0(MarkAsComplete, void()); |
| 79 MOCK_METHOD1(DelayedDownloadOpened, void(bool)); | 82 MOCK_METHOD1(DelayedDownloadOpened, void(bool)); |
| 80 MOCK_METHOD2(OnAllDataSaved, void(int64, const std::string&)); | 83 MOCK_METHOD2(OnAllDataSaved, void(int64, const std::string&)); |
| 81 MOCK_METHOD0(OnDownloadedFileRemoved, void()); | 84 MOCK_METHOD0(OnDownloadedFileRemoved, void()); |
| 82 MOCK_METHOD0(MaybeCompleteDownload, void()); | 85 MOCK_METHOD0(MaybeCompleteDownload, void()); |
| 83 MOCK_METHOD1(Interrupt, void(DownloadInterruptReason)); | 86 MOCK_METHOD1(Interrupt, void(DownloadInterruptReason)); |
| 84 MOCK_METHOD1(Delete, void(DeleteReason)); | 87 MOCK_METHOD1(Delete, void(DeleteReason)); |
| 85 MOCK_METHOD0(Remove, void()); | 88 MOCK_METHOD0(Remove, void()); |
| 86 MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*)); | 89 MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*)); |
| 87 MOCK_CONST_METHOD0(CurrentSpeed, int64()); | 90 MOCK_CONST_METHOD0(CurrentSpeed, int64()); |
| 88 MOCK_CONST_METHOD0(PercentComplete, int()); | 91 MOCK_CONST_METHOD0(PercentComplete, int()); |
| 89 MOCK_CONST_METHOD0(AllDataSaved, bool()); | 92 MOCK_CONST_METHOD0(AllDataSaved, bool()); |
| 90 MOCK_METHOD0(TogglePause, void()); | 93 MOCK_METHOD0(TogglePause, void()); |
| 91 MOCK_METHOD1(OnDownloadCompleting, void(DownloadFileManager*)); | 94 MOCK_METHOD0(OnDownloadCompleting, void()); |
| 92 MOCK_CONST_METHOD1(MatchesQuery, bool(const string16& query)); | 95 MOCK_CONST_METHOD1(MatchesQuery, bool(const string16& query)); |
| 93 MOCK_CONST_METHOD0(IsPartialDownload, bool()); | 96 MOCK_CONST_METHOD0(IsPartialDownload, bool()); |
| 94 MOCK_CONST_METHOD0(IsInProgress, bool()); | 97 MOCK_CONST_METHOD0(IsInProgress, bool()); |
| 95 MOCK_CONST_METHOD0(IsCancelled, bool()); | 98 MOCK_CONST_METHOD0(IsCancelled, bool()); |
| 96 MOCK_CONST_METHOD0(IsInterrupted, bool()); | 99 MOCK_CONST_METHOD0(IsInterrupted, bool()); |
| 97 MOCK_CONST_METHOD0(IsComplete, bool()); | 100 MOCK_CONST_METHOD0(IsComplete, bool()); |
| 98 MOCK_CONST_METHOD0(GetFullPath, const FilePath&()); | 101 MOCK_CONST_METHOD0(GetFullPath, const FilePath&()); |
| 99 MOCK_CONST_METHOD0(GetTargetFilePath, const FilePath&()); | 102 MOCK_CONST_METHOD0(GetTargetFilePath, const FilePath&()); |
| 100 MOCK_CONST_METHOD0(GetTargetDisposition, TargetDisposition()); | 103 MOCK_CONST_METHOD0(GetTargetDisposition, TargetDisposition()); |
| 101 MOCK_METHOD3(OnTargetPathDetermined, void(const FilePath&, | |
| 102 TargetDisposition, | |
| 103 content::DownloadDangerType)); | |
| 104 MOCK_METHOD1(OnTargetPathSelected, void(const FilePath&)); | |
| 105 MOCK_METHOD1(OnContentCheckCompleted, void(content::DownloadDangerType)); | 104 MOCK_METHOD1(OnContentCheckCompleted, void(content::DownloadDangerType)); |
| 106 MOCK_METHOD2(OnIntermediatePathDetermined, void(DownloadFileManager*, | |
| 107 const FilePath&)); | |
| 108 MOCK_CONST_METHOD0(GetState, DownloadState()); | 105 MOCK_CONST_METHOD0(GetState, DownloadState()); |
| 109 MOCK_CONST_METHOD0(GetUrlChain, const std::vector<GURL>&()); | 106 MOCK_CONST_METHOD0(GetUrlChain, const std::vector<GURL>&()); |
| 110 MOCK_METHOD1(SetTotalBytes, void(int64)); | 107 MOCK_METHOD1(SetTotalBytes, void(int64)); |
| 111 MOCK_CONST_METHOD0(GetURL, const GURL&()); | 108 MOCK_CONST_METHOD0(GetURL, const GURL&()); |
| 112 MOCK_CONST_METHOD0(GetOriginalUrl, const GURL&()); | 109 MOCK_CONST_METHOD0(GetOriginalUrl, const GURL&()); |
| 113 MOCK_CONST_METHOD0(GetReferrerUrl, const GURL&()); | 110 MOCK_CONST_METHOD0(GetReferrerUrl, const GURL&()); |
| 114 MOCK_CONST_METHOD0(GetSuggestedFilename, std::string()); | 111 MOCK_CONST_METHOD0(GetSuggestedFilename, std::string()); |
| 115 MOCK_CONST_METHOD0(GetContentDisposition, std::string()); | 112 MOCK_CONST_METHOD0(GetContentDisposition, std::string()); |
| 116 MOCK_CONST_METHOD0(GetMimeType, std::string()); | 113 MOCK_CONST_METHOD0(GetMimeType, std::string()); |
| 117 MOCK_CONST_METHOD0(GetOriginalMimeType, std::string()); | 114 MOCK_CONST_METHOD0(GetOriginalMimeType, std::string()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 MOCK_CONST_METHOD0(GetLastModifiedTime, const std::string&()); | 147 MOCK_CONST_METHOD0(GetLastModifiedTime, const std::string&()); |
| 151 MOCK_CONST_METHOD0(GetETag, const std::string&()); | 148 MOCK_CONST_METHOD0(GetETag, const std::string&()); |
| 152 MOCK_CONST_METHOD0(GetLastReason, DownloadInterruptReason()); | 149 MOCK_CONST_METHOD0(GetLastReason, DownloadInterruptReason()); |
| 153 MOCK_CONST_METHOD0(GetPersistentStoreInfo, | 150 MOCK_CONST_METHOD0(GetPersistentStoreInfo, |
| 154 content::DownloadPersistentStoreInfo()); | 151 content::DownloadPersistentStoreInfo()); |
| 155 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); | 152 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); |
| 156 MOCK_CONST_METHOD0(GetWebContents, content::WebContents*()); | 153 MOCK_CONST_METHOD0(GetWebContents, content::WebContents*()); |
| 157 MOCK_CONST_METHOD0(GetFileNameToReportUser, FilePath()); | 154 MOCK_CONST_METHOD0(GetFileNameToReportUser, FilePath()); |
| 158 MOCK_METHOD1(SetDisplayName, void(const FilePath&)); | 155 MOCK_METHOD1(SetDisplayName, void(const FilePath&)); |
| 159 MOCK_CONST_METHOD0(GetUserVerifiedFilePath, FilePath()); | 156 MOCK_CONST_METHOD0(GetUserVerifiedFilePath, FilePath()); |
| 160 MOCK_METHOD1(OffThreadCancel, void(DownloadFileManager* file_manager)); | 157 MOCK_METHOD0(OffThreadCancel, void()); |
| 161 MOCK_CONST_METHOD1(DebugString, std::string(bool)); | 158 MOCK_CONST_METHOD1(DebugString, std::string(bool)); |
| 162 MOCK_METHOD0(MockDownloadOpenForTesting, void()); | 159 MOCK_METHOD0(MockDownloadOpenForTesting, void()); |
| 163 MOCK_METHOD1(GetExternalData, ExternalData*(const void*)); | 160 MOCK_METHOD1(GetExternalData, ExternalData*(const void*)); |
| 164 MOCK_CONST_METHOD1(GetExternalData, const ExternalData*(const void*)); | 161 MOCK_CONST_METHOD1(GetExternalData, const ExternalData*(const void*)); |
| 165 MOCK_METHOD2(SetExternalData, void(const void*, ExternalData*)); | 162 MOCK_METHOD2(SetExternalData, void(const void*, ExternalData*)); |
| 166 }; | 163 }; |
| 167 | 164 |
| 168 class MockDownloadManagerDelegate : public content::DownloadManagerDelegate { | 165 class MockDownloadManagerDelegate : public content::DownloadManagerDelegate { |
| 169 public: | 166 public: |
| 170 MockDownloadManagerDelegate(); | 167 MockDownloadManagerDelegate(); |
| 171 virtual ~MockDownloadManagerDelegate(); | 168 virtual ~MockDownloadManagerDelegate(); |
| 172 | 169 |
| 173 MOCK_METHOD0(Shutdown, void()); | 170 MOCK_METHOD0(Shutdown, void()); |
| 174 MOCK_METHOD0(GetNextId, content::DownloadId()); | 171 MOCK_METHOD0(GetNextId, content::DownloadId()); |
| 175 MOCK_METHOD1(ShouldStartDownload, bool(int32)); | 172 MOCK_METHOD2(DetermineDownloadTarget, |
| 176 MOCK_METHOD1(ChooseDownloadPath, void(DownloadItem*)); | 173 bool(DownloadItem* item, |
| 177 MOCK_METHOD1(GetIntermediatePath, FilePath(const DownloadItem&)); | 174 const content::DownloadTargetCallback&)); |
| 178 MOCK_METHOD0(GetAlternativeWebContentsToNotifyForDownload, WebContents*()); | 175 MOCK_METHOD0(GetAlternativeWebContentsToNotifyForDownload, WebContents*()); |
| 179 MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const FilePath&)); | 176 MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const FilePath&)); |
| 180 MOCK_METHOD2(ShouldCompleteDownload, bool( | 177 MOCK_METHOD2(ShouldCompleteDownload, bool( |
| 181 DownloadItem*, const base::Closure&)); | 178 DownloadItem*, const base::Closure&)); |
| 182 MOCK_METHOD1(ShouldOpenDownload, bool(DownloadItem*)); | 179 MOCK_METHOD1(ShouldOpenDownload, bool(DownloadItem*)); |
| 183 MOCK_METHOD0(GenerateFileHash, bool()); | 180 MOCK_METHOD0(GenerateFileHash, bool()); |
| 184 MOCK_METHOD1(AddItemToPersistentStore, void(DownloadItem*)); | 181 MOCK_METHOD1(AddItemToPersistentStore, void(DownloadItem*)); |
| 185 MOCK_METHOD1(UpdateItemInPersistentStore, void(DownloadItem*)); | 182 MOCK_METHOD1(UpdateItemInPersistentStore, void(DownloadItem*)); |
| 186 MOCK_METHOD2(UpdatePathForItemInPersistentStore, | 183 MOCK_METHOD2(UpdatePathForItemInPersistentStore, |
| 187 void(DownloadItem*, const FilePath&)); | 184 void(DownloadItem*, const FilePath&)); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 EXPECT_CALL(GetMockDownloadManagerDelegate(), GenerateFileHash()) | 560 EXPECT_CALL(GetMockDownloadManagerDelegate(), GenerateFileHash()) |
| 564 .WillOnce(Return(true)); | 561 .WillOnce(Return(true)); |
| 565 EXPECT_CALL(GetMockDownloadFileManager(), MockCreateDownloadFile( | 562 EXPECT_CALL(GetMockDownloadFileManager(), MockCreateDownloadFile( |
| 566 info.get(), static_cast<content::ByteStreamReader*>(NULL), | 563 info.get(), static_cast<content::ByteStreamReader*>(NULL), |
| 567 download_manager_.get(), true, _, _)); | 564 download_manager_.get(), true, _, _)); |
| 568 | 565 |
| 569 download_manager_->StartDownload(info.Pass(), stream.Pass()); | 566 download_manager_->StartDownload(info.Pass(), stream.Pass()); |
| 570 EXPECT_TRUE(download_manager_->GetActiveDownloadItem(local_id)); | 567 EXPECT_TRUE(download_manager_->GetActiveDownloadItem(local_id)); |
| 571 } | 568 } |
| 572 | 569 |
| 573 // Does the DownloadManager prompt when requested? | |
| 574 TEST_F(DownloadManagerTest, RestartDownload) { | |
| 575 // Put a mock we have a handle to on the download manager. | |
| 576 MockDownloadItemImpl& item(AddItemToManager()); | |
| 577 int download_id = item.GetId(); | |
| 578 | |
| 579 // Confirm we're internally consistent. | |
| 580 EXPECT_EQ(&item, download_manager_->GetActiveDownloadItem(download_id)); | |
| 581 | |
| 582 ScopedTempDir download_dir; | |
| 583 ASSERT_TRUE(download_dir.CreateUniqueTempDir()); | |
| 584 FilePath expected_path(download_dir.path().Append( | |
| 585 FILE_PATH_LITERAL("location"))); | |
| 586 | |
| 587 EXPECT_CALL(item, GetTargetDisposition()) | |
| 588 .WillOnce(Return(DownloadItem::TARGET_DISPOSITION_PROMPT)); | |
| 589 EXPECT_CALL(GetMockDownloadManagerDelegate(), ChooseDownloadPath(&item)); | |
| 590 download_manager_->RestartDownload(download_id); | |
| 591 | |
| 592 // The alternative pathway goes straight to OnTargetPathAvailable, | |
| 593 // so it more naturally belongs below. | |
| 594 } | |
| 595 | |
| 596 // Do the results of GetIntermediatePath get passed through to the | |
| 597 // download? Note that this path is tested from RestartDownload | |
| 598 // to test the non-prompting path in RestartDownload as well. | |
| 599 TEST_F(DownloadManagerTest, OnTargetPathAvailable) { | |
| 600 // Put a mock we have a handle to on the download manager. | |
| 601 MockDownloadItemImpl& item(AddItemToManager()); | |
| 602 | |
| 603 ScopedTempDir download_dir; | |
| 604 ASSERT_TRUE(download_dir.CreateUniqueTempDir()); | |
| 605 FilePath target_path(download_dir.path().Append( | |
| 606 FILE_PATH_LITERAL("location"))); | |
| 607 FilePath intermediate_path(download_dir.path().Append( | |
| 608 FILE_PATH_LITERAL("location.crdownload"))); | |
| 609 | |
| 610 EXPECT_CALL(item, GetTargetDisposition()) | |
| 611 .WillOnce(Return(DownloadItem::TARGET_DISPOSITION_OVERWRITE)); | |
| 612 EXPECT_CALL(GetMockDownloadManagerDelegate(), | |
| 613 GetIntermediatePath(Ref(item))) | |
| 614 .WillOnce(Return(intermediate_path)); | |
| 615 // Finesse DCHECK with WillRepeatedly. | |
| 616 EXPECT_CALL(item, GetTargetFilePath()) | |
| 617 .WillRepeatedly(ReturnRef(target_path)); | |
| 618 EXPECT_CALL(item, OnIntermediatePathDetermined( | |
| 619 &GetMockDownloadFileManager(), intermediate_path)); | |
| 620 download_manager_->RestartDownload(item.GetId()); | |
| 621 } | |
| 622 | |
| 623 // Do the results of an OnDownloadInterrupted get passed through properly | 570 // Do the results of an OnDownloadInterrupted get passed through properly |
| 624 // to the DownloadItem? | 571 // to the DownloadItem? |
| 625 TEST_F(DownloadManagerTest, OnDownloadInterrupted) { | 572 TEST_F(DownloadManagerTest, OnDownloadInterrupted) { |
| 626 // Put a mock we have a handle to on the download manager. | 573 // Put a mock we have a handle to on the download manager. |
| 627 MockDownloadItemImpl& item(AddItemToManager()); | 574 MockDownloadItemImpl& item(AddItemToManager()); |
| 628 int download_id = item.GetId(); | 575 int download_id = item.GetId(); |
| 629 | 576 |
| 630 content::DownloadInterruptReason reason( | 577 content::DownloadInterruptReason reason( |
| 631 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); | 578 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); |
| 632 | 579 |
| 633 EXPECT_CALL(item, Interrupt(reason)); | 580 EXPECT_CALL(item, Interrupt(reason)); |
| 634 download_manager_->OnDownloadInterrupted(download_id, reason); | 581 download_manager_->OnDownloadInterrupted(download_id, reason); |
| 635 EXPECT_EQ(&item, download_manager_->GetActiveDownloadItem(download_id)); | 582 EXPECT_EQ(&item, download_manager_->GetActiveDownloadItem(download_id)); |
| 636 } | 583 } |
| 637 | 584 |
| 638 // Does DownloadStopped remove Download from appropriate queues? | 585 // Does DownloadStopped remove Download from appropriate queues? |
| 639 // This test tests non-persisted downloads. | 586 // This test tests non-persisted downloads. |
| 640 TEST_F(DownloadManagerTest, OnDownloadStopped_NonPersisted) { | 587 TEST_F(DownloadManagerTest, OnDownloadStopped_NonPersisted) { |
| 641 // Put a mock we have a handle to on the download manager. | 588 // Put a mock we have a handle to on the download manager. |
| 642 MockDownloadItemImpl& item(AddItemToManager()); | 589 MockDownloadItemImpl& item(AddItemToManager()); |
| 643 | 590 |
| 644 EXPECT_CALL(item, IsPersisted()) | 591 EXPECT_CALL(item, IsPersisted()) |
| 645 .WillRepeatedly(Return(false)); | 592 .WillRepeatedly(Return(false)); |
| 646 EXPECT_CALL(item, GetState()) | 593 EXPECT_CALL(item, GetState()) |
| 647 .WillRepeatedly(Return(DownloadItem::CANCELLED)); | 594 .WillRepeatedly(Return(DownloadItem::CANCELLED)); |
| 648 EXPECT_CALL(item, GetDbHandle()) | 595 EXPECT_CALL(item, GetDbHandle()) |
| 649 .WillRepeatedly(Return(DownloadItem::kUninitializedHandle)); | 596 .WillRepeatedly(Return(DownloadItem::kUninitializedHandle)); |
| 650 | 597 |
| 651 EXPECT_CALL(item, OffThreadCancel(&GetMockDownloadFileManager())); | 598 EXPECT_CALL(item, OffThreadCancel()); |
| 652 DownloadStopped(&item); | 599 DownloadStopped(&item); |
| 653 // TODO(rdsmith): Confirm that the download item is no longer on the | 600 // TODO(rdsmith): Confirm that the download item is no longer on the |
| 654 // active list by calling download_manager_->GetActiveDownloadItem(id). | 601 // active list by calling download_manager_->GetActiveDownloadItem(id). |
| 655 // Currently, the item is left on the active list for rendez-vous with | 602 // Currently, the item is left on the active list for rendez-vous with |
| 656 // the history system :-{. | 603 // the history system :-{. |
| 657 } | 604 } |
| 658 | 605 |
| 659 // Does DownloadStopped remove Download from appropriate queues? | 606 // Does DownloadStopped remove Download from appropriate queues? |
| 660 // This test tests persisted downloads. | 607 // This test tests persisted downloads. |
| 661 TEST_F(DownloadManagerTest, OnDownloadStopped_Persisted) { | 608 TEST_F(DownloadManagerTest, OnDownloadStopped_Persisted) { |
| 662 // Put a mock we have a handle to on the download manager. | 609 // Put a mock we have a handle to on the download manager. |
| 663 MockDownloadItemImpl& item(AddItemToManager()); | 610 MockDownloadItemImpl& item(AddItemToManager()); |
| 664 int download_id = item.GetId(); | 611 int download_id = item.GetId(); |
| 665 int64 db_handle = 0x7; | 612 int64 db_handle = 0x7; |
| 666 EXPECT_CALL(item, GetExternalData(_)) | 613 EXPECT_CALL(item, GetExternalData(_)) |
| 667 .WillOnce(Return(static_cast<DownloadItem::ExternalData*>(NULL))); | 614 .WillOnce(Return(static_cast<DownloadItem::ExternalData*>(NULL))); |
| 668 AddItemToHistory(item, db_handle); | 615 AddItemToHistory(item, db_handle); |
| 669 | 616 |
| 670 EXPECT_CALL(item, IsPersisted()) | 617 EXPECT_CALL(item, IsPersisted()) |
| 671 .WillRepeatedly(Return(true)); | 618 .WillRepeatedly(Return(true)); |
| 672 EXPECT_CALL(GetMockDownloadManagerDelegate(), | 619 EXPECT_CALL(GetMockDownloadManagerDelegate(), |
| 673 UpdateItemInPersistentStore(&item)); | 620 UpdateItemInPersistentStore(&item)); |
| 674 EXPECT_CALL(item, GetState()) | 621 EXPECT_CALL(item, GetState()) |
| 675 .WillRepeatedly(Return(DownloadItem::CANCELLED)); | 622 .WillRepeatedly(Return(DownloadItem::CANCELLED)); |
| 676 EXPECT_CALL(item, GetDbHandle()) | 623 EXPECT_CALL(item, GetDbHandle()) |
| 677 .WillRepeatedly(Return(db_handle)); | 624 .WillRepeatedly(Return(db_handle)); |
| 678 | 625 |
| 679 EXPECT_CALL(item, OffThreadCancel(&GetMockDownloadFileManager())); | 626 EXPECT_CALL(item, OffThreadCancel()); |
| 680 DownloadStopped(&item); | 627 DownloadStopped(&item); |
| 681 EXPECT_EQ(NULL, download_manager_->GetActiveDownloadItem(download_id)); | 628 EXPECT_EQ(NULL, download_manager_->GetActiveDownloadItem(download_id)); |
| 682 } | 629 } |
| OLD | NEW |