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

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

Issue 10542089: Power save blocker: switch to new implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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.h" 6 #include "base/message_loop.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "content/browser/browser_thread_impl.h" 8 #include "content/browser/browser_thread_impl.h"
9 #include "content/browser/download/byte_stream.h" 9 #include "content/browser/download/byte_stream.h"
10 #include "content/browser/download/download_create_info.h" 10 #include "content/browser/download/download_create_info.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 DownloadCreateInfo info; 119 DownloadCreateInfo info;
120 info.download_id = DownloadId(kValidIdDomain, kDummyDownloadId + offset); 120 info.download_id = DownloadId(kValidIdDomain, kDummyDownloadId + offset);
121 // info.request_handle default constructed to null. 121 // info.request_handle default constructed to null.
122 info.save_info.file_stream = file_stream_; 122 info.save_info.file_stream = file_stream_;
123 download_file_.reset( 123 download_file_.reset(
124 new DownloadFileImpl( 124 new DownloadFileImpl(
125 &info, 125 &info,
126 scoped_ptr<content::ByteStreamReader>(input_stream_).Pass(), 126 scoped_ptr<content::ByteStreamReader>(input_stream_).Pass(),
127 new DownloadRequestHandle(), 127 new DownloadRequestHandle(),
128 download_manager_, calculate_hash, 128 download_manager_, calculate_hash,
129 scoped_ptr<PowerSaveBlocker>(NULL).Pass(), 129 scoped_ptr<content::PowerSaveBlocker>(NULL).Pass(),
130 net::BoundNetLog())); 130 net::BoundNetLog()));
131 131
132 EXPECT_CALL(*input_stream_, Read(_, _)) 132 EXPECT_CALL(*input_stream_, Read(_, _))
133 .WillOnce(Return(content::ByteStreamReader::STREAM_EMPTY)) 133 .WillOnce(Return(content::ByteStreamReader::STREAM_EMPTY))
134 .RetiresOnSaturation(); 134 .RetiresOnSaturation();
135 net::Error result = download_file_->Initialize(); 135 net::Error result = download_file_->Initialize();
136 ::testing::Mock::VerifyAndClearExpectations(input_stream_); 136 ::testing::Mock::VerifyAndClearExpectations(input_stream_);
137 return result == net::OK; 137 return result == net::OK;
138 } 138 }
139 139
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 base::TimeDelta::FromMilliseconds(750)); 435 base::TimeDelta::FromMilliseconds(750));
436 loop_.Run(); 436 loop_.Run();
437 437
438 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), 438 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)),
439 bytes_); 439 bytes_);
440 EXPECT_EQ(download_file_->GetHashState(), hash_state_); 440 EXPECT_EQ(download_file_->GetHashState(), hash_state_);
441 441
442 FinishStream(content::DOWNLOAD_INTERRUPT_REASON_NONE, true); 442 FinishStream(content::DOWNLOAD_INTERRUPT_REASON_NONE, true);
443 DestroyDownloadFile(0); 443 DestroyDownloadFile(0);
444 } 444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698