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

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

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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: content/browser/download/download_manager_impl_unittest.cc
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index 0865c04b2fac04ec93af29aacf688a942a044695..1ecbfb4b58df82c2c3f00c4a4dd2d4b10e659d16 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -107,13 +107,12 @@ class MockDownloadItemImpl : public DownloadItemImpl {
MOCK_METHOD0(MarkAsComplete, void());
MOCK_METHOD1(OnAllDataSaved, void(const std::string&));
MOCK_METHOD0(OnDownloadedFileRemoved, void());
- virtual void Start(
- scoped_ptr<DownloadFile> download_file,
- scoped_ptr<DownloadRequestHandleInterface> req_handle) OVERRIDE {
+ virtual void Start(scoped_ptr<DownloadFile> download_file,
+ scoped_ptr<DownloadRequestHandle> req_handle) OVERRIDE {
MockStart(download_file.get(), req_handle.get());
}
- MOCK_METHOD2(MockStart, void(DownloadFile*, DownloadRequestHandleInterface*));
+ MOCK_METHOD2(MockStart, void(DownloadFile*, DownloadRequestHandle*));
MOCK_METHOD0(Remove, void());
MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*));
@@ -243,19 +242,12 @@ class MockDownloadItemFactory
DownloadInterruptReason interrupt_reason,
bool opened,
const net::BoundNetLog& bound_net_log) OVERRIDE;
+
virtual DownloadItemImpl* CreateActiveItem(
DownloadItemImplDelegate* delegate,
uint32 download_id,
const DownloadCreateInfo& info,
const net::BoundNetLog& bound_net_log) OVERRIDE;
- virtual DownloadItemImpl* CreateSavePageItem(
- DownloadItemImplDelegate* delegate,
- uint32 download_id,
- const base::FilePath& path,
- const GURL& url,
- const std::string& mime_type,
- scoped_ptr<DownloadRequestHandleInterface> request_handle,
- const net::BoundNetLog& bound_net_log) OVERRIDE;
private:
std::map<uint32, MockDownloadItemImpl*> items_;
@@ -337,25 +329,6 @@ DownloadItemImpl* MockDownloadItemFactory::CreateActiveItem(
return result;
}
-DownloadItemImpl* MockDownloadItemFactory::CreateSavePageItem(
- DownloadItemImplDelegate* delegate,
- uint32 download_id,
- const base::FilePath& path,
- const GURL& url,
- const std::string& mime_type,
- scoped_ptr<DownloadRequestHandleInterface> request_handle,
- const net::BoundNetLog& bound_net_log) {
- DCHECK(items_.find(download_id) == items_.end());
-
- MockDownloadItemImpl* result =
- new StrictMock<MockDownloadItemImpl>(&item_delegate_);
- EXPECT_CALL(*result, GetId())
- .WillRepeatedly(Return(download_id));
- items_[download_id] = result;
-
- return result;
-}
-
class MockDownloadFileFactory
: public DownloadFileFactory,
public base::SupportsWeakPtr<MockDownloadFileFactory> {
@@ -500,14 +473,13 @@ class DownloadManagerTest : public testing::Test {
// null.
uint32 id = next_download_id_;
++next_download_id_;
- info.request_handle = DownloadRequestHandle();
download_manager_->CreateActiveItem(id, info);
DCHECK(mock_download_item_factory_->GetItem(id));
MockDownloadItemImpl& item(*mock_download_item_factory_->GetItem(id));
// Satisfy expectation. If the item is created in StartDownload(),
// we call Start on it immediately, so we need to set that expectation
// in the factory.
- scoped_ptr<DownloadRequestHandleInterface> req_handle;
+ scoped_ptr<DownloadRequestHandle> req_handle;
item.Start(scoped_ptr<DownloadFile>(), req_handle.Pass());
return item;
@@ -605,8 +577,8 @@ TEST_F(DownloadManagerTest, StartDownload) {
stream.get(), _, _))
.WillOnce(Return(mock_file));
- download_manager_->StartDownload(
- info.Pass(), stream.Pass(), DownloadUrlParameters::OnStartedCallback());
+ download_manager_->StartDownloadWithActiveRequest(
+ scoped_ptr<DownloadRequestHandle>(), info.Pass());
EXPECT_TRUE(download_manager_->GetDownload(local_id));
}
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/download_net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698