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

Unified Diff: content/public/test/test_file_error_injector.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 side-by-side diff with in-line comments
Download patch
Index: content/public/test/test_file_error_injector.cc
diff --git a/content/public/test/test_file_error_injector.cc b/content/public/test/test_file_error_injector.cc
index 04e9acc3deda5477eefbe22890550805f85199a7..5b25e2e9a34c3120eafd89a4336afb454df1adba 100644
--- a/content/public/test/test_file_error_injector.cc
+++ b/content/public/test/test_file_error_injector.cc
@@ -29,12 +29,13 @@ class DownloadFileWithErrors: public DownloadFileImpl {
typedef base::Callback<void(const GURL& url)> DestructionCallback;
DownloadFileWithErrors(
- scoped_ptr<DownloadSaveInfo> save_info,
+ const DownloadSaveInfo& save_info,
const base::FilePath& default_download_directory,
const GURL& url,
const GURL& referrer_url,
bool calculate_hash,
- scoped_ptr<ByteStreamReader> stream,
+ scoped_ptr<net::FileStream> file_stream,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
scoped_ptr<PowerSaveBlocker> power_save_blocker,
base::WeakPtr<DownloadDestinationObserver> observer,
@@ -104,25 +105,32 @@ static void RenameErrorCallback(
}
DownloadFileWithErrors::DownloadFileWithErrors(
- scoped_ptr<DownloadSaveInfo> save_info,
+ const DownloadSaveInfo& save_info,
const base::FilePath& default_download_directory,
const GURL& url,
const GURL& referrer_url,
bool calculate_hash,
- scoped_ptr<ByteStreamReader> stream,
+ scoped_ptr<net::FileStream> file_stream,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
scoped_ptr<PowerSaveBlocker> power_save_blocker,
base::WeakPtr<DownloadDestinationObserver> observer,
const TestFileErrorInjector::FileErrorInfo& error_info,
const ConstructionCallback& ctor_callback,
const DestructionCallback& dtor_callback)
- : DownloadFileImpl(
- save_info.Pass(), default_download_directory, url, referrer_url,
- calculate_hash, stream.Pass(), bound_net_log,
- power_save_blocker.Pass(), observer),
- source_url_(url),
- error_info_(error_info),
- destruction_callback_(dtor_callback) {
+ : DownloadFileImpl(save_info,
+ default_download_directory,
+ url,
+ referrer_url,
+ calculate_hash,
+ file_stream.Pass(),
+ byte_stream.Pass(),
+ bound_net_log,
+ power_save_blocker.Pass(),
+ observer),
+ source_url_(url),
+ error_info_(error_info),
+ destruction_callback_(dtor_callback) {
// DownloadFiles are created on the UI thread and are destroyed on the FILE
// thread. Schedule the ConstructionCallback on the FILE thread so that if a
// DownloadItem schedules a DownloadFile to be destroyed and creates another
@@ -262,12 +270,13 @@ class DownloadFileWithErrorsFactory : public DownloadFileFactory {
// DownloadFileFactory interface.
virtual DownloadFile* CreateFile(
- scoped_ptr<DownloadSaveInfo> save_info,
+ const DownloadSaveInfo& save_info,
const base::FilePath& default_download_directory,
const GURL& url,
const GURL& referrer_url,
bool calculate_hash,
- scoped_ptr<ByteStreamReader> stream,
+ scoped_ptr<net::FileStream> file_stream,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer) OVERRIDE;
@@ -296,12 +305,13 @@ DownloadFileWithErrorsFactory::~DownloadFileWithErrorsFactory() {
}
DownloadFile* DownloadFileWithErrorsFactory::CreateFile(
- scoped_ptr<DownloadSaveInfo> save_info,
+ const DownloadSaveInfo& save_info,
const base::FilePath& default_download_directory,
const GURL& url,
const GURL& referrer_url,
bool calculate_hash,
- scoped_ptr<ByteStreamReader> stream,
+ scoped_ptr<net::FileStream> file_stream,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer) {
if (injected_errors_.find(url.spec()) == injected_errors_.end()) {
@@ -321,12 +331,13 @@ DownloadFile* DownloadFileWithErrorsFactory::CreateFile(
"Download in progress"));
return new DownloadFileWithErrors(
- save_info.Pass(),
+ save_info,
default_download_directory,
url,
referrer_url,
calculate_hash,
- stream.Pass(),
+ file_stream.Pass(),
+ byte_stream.Pass(),
bound_net_log,
psb.Pass(),
observer,

Powered by Google App Engine
This is Rietveld 408576698