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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate_unittest.cc

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r158560 Created 8 years, 3 months 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: chrome/browser/download/chrome_download_manager_delegate_unittest.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
index 054969d65220e38e4f803999557d2a176184ca53..97204f4a52138046807334cd097e3095a0ee3e75 100644
--- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
@@ -300,6 +300,10 @@ void ChromeDownloadManagerDelegateTest::SetUp() {
CHECK(profile());
delegate_ = new TestChromeDownloadManagerDelegate(profile());
+ EXPECT_CALL(*download_manager_.get(), GetAllDownloads(_))
+ .WillRepeatedly(Return());
+ EXPECT_CALL(*download_manager_.get(), AddObserver(_))
+ .WillRepeatedly(Return());
delegate_->SetDownloadManager(download_manager_.get());
pref_service_ = profile()->GetTestingPrefService();
contents()->SetDelegate(&web_contents_delegate_);
@@ -317,12 +321,20 @@ void ChromeDownloadManagerDelegateTest::TearDown() {
void ChromeDownloadManagerDelegateTest::VerifyAndClearExpectations() {
::testing::Mock::VerifyAndClearExpectations(delegate_);
::testing::Mock::VerifyAndClearExpectations(download_manager_);
+ EXPECT_CALL(*download_manager_.get(), RemoveObserver(_))
+ .WillRepeatedly(Return());
}
content::MockDownloadItem*
ChromeDownloadManagerDelegateTest::CreateActiveDownloadItem(int32 id) {
content::MockDownloadItem* item =
new ::testing::NiceMock<content::MockDownloadItem>();
+ EXPECT_CALL(*item, GetState())
+ .WillRepeatedly(Return(DownloadItem::IN_PROGRESS));
+ EXPECT_CALL(*item, AddObserver(_))
+ .WillRepeatedly(Return());
+ EXPECT_CALL(*item, RemoveObserver(_))
+ .WillRepeatedly(Return());
ON_CALL(*item, GetFullPath())
.WillByDefault(ReturnRefOfCopy(FilePath()));
ON_CALL(*item, GetHash())
@@ -341,6 +353,8 @@ content::MockDownloadItem*
.WillByDefault(Return(contents()));
EXPECT_CALL(*item, GetId())
.WillRepeatedly(Return(id));
+ EXPECT_CALL(*download_manager_, GetDownload(id))
+ .WillRepeatedly(Return(item));
EXPECT_CALL(*download_manager_, GetActiveDownloadItem(id))
.WillRepeatedly(Return(item));
return item;

Powered by Google App Engine
This is Rietveld 408576698