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

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

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 9 years 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
« no previous file with comments | « content/browser/download/download_file_manager.cc ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_file_unittest.cc
diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc
index e037f56de86b676eb066fd8250f5a89ea794e20d..4bc6ec3546ceec7ada34161bc923ef2aaac43534 100644
--- a/content/browser/download/download_file_unittest.cc
+++ b/content/browser/download/download_file_unittest.cc
@@ -68,14 +68,16 @@ class DownloadFileTest : public testing::Test {
ui_thread_.message_loop()->RunAllPending();
}
- virtual void CreateDownloadFile(scoped_ptr<DownloadFile>* file, int offset) {
+ virtual void CreateDownloadFile(scoped_ptr<DownloadFile>* file,
+ int offset,
+ bool calculate_hash) {
DownloadCreateInfo info;
info.download_id = DownloadId(kValidIdDomain, kDummyDownloadId + offset);
// info.request_handle default constructed to null.
info.save_info.file_stream = file_stream_;
file->reset(
new DownloadFileImpl(&info, new DownloadRequestHandle(),
- download_manager_));
+ download_manager_, calculate_hash));
}
virtual void DestroyDownloadFile(scoped_ptr<DownloadFile>* file, int offset) {
@@ -141,8 +143,8 @@ const int DownloadFileTest::kDummyRequestId = 67;
// Rename the file before any data is downloaded, after some has, after it all
// has, and after it's closed.
TEST_F(DownloadFileTest, RenameFileFinal) {
- CreateDownloadFile(&download_file_, 0);
- ASSERT_EQ(net::OK, download_file_->Initialize(true));
+ CreateDownloadFile(&download_file_, 0, true);
+ ASSERT_EQ(net::OK, download_file_->Initialize());
FilePath initial_path(download_file_->FullPath());
EXPECT_TRUE(file_util::PathExists(initial_path));
FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1"));
@@ -185,7 +187,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) {
// Should not be able to get the hash until the file is closed.
std::string hash;
- EXPECT_FALSE(download_file_->GetSha256Hash(&hash));
+ EXPECT_FALSE(download_file_->GetHash(&hash));
download_file_->Finish();
@@ -199,7 +201,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) {
EXPECT_TRUE(file_util::PathExists(path_4));
// Check the hash.
- EXPECT_TRUE(download_file_->GetSha256Hash(&hash));
+ EXPECT_TRUE(download_file_->GetHash(&hash));
EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size()));
DestroyDownloadFile(&download_file_, 0);
« no previous file with comments | « content/browser/download/download_file_manager.cc ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698