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

Side by Side Diff: content/browser/download/download_file_unittest.cc

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/test/test_file_util.h" 8 #include "base/test/test_file_util.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/byte_stream.h" 10 #include "content/browser/byte_stream.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 input_stream_ = new StrictMock<MockByteStreamReader>(); 123 input_stream_ = new StrictMock<MockByteStreamReader>();
124 124
125 // TODO: Need to actually create a function that'll set the variables 125 // TODO: Need to actually create a function that'll set the variables
126 // based on the inputs from the callback. 126 // based on the inputs from the callback.
127 EXPECT_CALL(*input_stream_, RegisterCallback(_)) 127 EXPECT_CALL(*input_stream_, RegisterCallback(_))
128 .WillOnce(Invoke(this, &DownloadFileTest::RegisterCallback)) 128 .WillOnce(Invoke(this, &DownloadFileTest::RegisterCallback))
129 .RetiresOnSaturation(); 129 .RetiresOnSaturation();
130 130
131 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); 131 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
132 download_file_.reset( 132 download_file_.reset(
133 new DownloadFileImpl(save_info.Pass(), 133 new DownloadFileImpl(*save_info,
134 base::FilePath(), 134 base::FilePath(),
135 GURL(), // Source 135 GURL(), // Source
136 GURL(), // Referrer 136 GURL(), // Referrer
137 calculate_hash, 137 calculate_hash,
138 save_info->file_stream.Pass(),
138 scoped_ptr<ByteStreamReader>(input_stream_), 139 scoped_ptr<ByteStreamReader>(input_stream_),
139 net::BoundNetLog(), 140 net::BoundNetLog(),
140 scoped_ptr<PowerSaveBlocker>().Pass(), 141 scoped_ptr<PowerSaveBlocker>().Pass(),
141 observer_factory_.GetWeakPtr())); 142 observer_factory_.GetWeakPtr()));
142 download_file_->SetClientGuid( 143 download_file_->SetClientGuid(
143 "12345678-ABCD-1234-DCBA-123456789ABC"); 144 "12345678-ABCD-1234-DCBA-123456789ABC");
144 145
145 EXPECT_CALL(*input_stream_, Read(_, _)) 146 EXPECT_CALL(*input_stream_, Read(_, _))
146 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) 147 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY))
147 .RetiresOnSaturation(); 148 .RetiresOnSaturation();
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 597
597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), 598 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)),
598 bytes_); 599 bytes_);
599 EXPECT_EQ(download_file_->GetHashState(), hash_state_); 600 EXPECT_EQ(download_file_->GetHashState(), hash_state_);
600 601
601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); 602 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true);
602 DestroyDownloadFile(0); 603 DestroyDownloadFile(0);
603 } 604 }
604 605
605 } // namespace content 606 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698