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

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: Comment updates Created 4 years, 10 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 96fcd95a3e48f57318f6f623829e240025f991de..5d5d88500fcb87a19d755b529f39570a3323437f 100644
--- a/content/public/test/test_file_error_injector.cc
+++ b/content/public/test/test_file_error_injector.cc
@@ -28,18 +28,18 @@ class DownloadFileWithErrors: public DownloadFileImpl {
typedef base::Callback<void(const GURL& url)> ConstructionCallback;
typedef base::Callback<void(const GURL& url)> DestructionCallback;
- DownloadFileWithErrors(
- scoped_ptr<DownloadSaveInfo> save_info,
- const base::FilePath& default_download_directory,
- const GURL& url,
- const GURL& referrer_url,
- bool calculate_hash,
- scoped_ptr<ByteStreamReader> stream,
- const net::BoundNetLog& bound_net_log,
- base::WeakPtr<DownloadDestinationObserver> observer,
- const TestFileErrorInjector::FileErrorInfo& error_info,
- const ConstructionCallback& ctor_callback,
- const DestructionCallback& dtor_callback);
+ DownloadFileWithErrors(const DownloadSaveInfo& save_info,
+ const base::FilePath& default_download_directory,
+ const GURL& url,
+ const GURL& referrer_url,
+ bool calculate_hash,
+ base::File file,
+ scoped_ptr<ByteStreamReader> byte_stream,
+ const net::BoundNetLog& bound_net_log,
+ base::WeakPtr<DownloadDestinationObserver> observer,
+ const TestFileErrorInjector::FileErrorInfo& error_info,
+ const ConstructionCallback& ctor_callback,
+ const DestructionCallback& dtor_callback);
~DownloadFileWithErrors() override;
@@ -101,23 +101,25 @@ 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,
+ base::File file,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer,
const TestFileErrorInjector::FileErrorInfo& error_info,
const ConstructionCallback& ctor_callback,
const DestructionCallback& dtor_callback)
- : DownloadFileImpl(std::move(save_info),
+ : DownloadFileImpl(save_info,
default_download_directory,
url,
referrer_url,
calculate_hash,
- std::move(stream),
+ std::move(file),
+ std::move(byte_stream),
bound_net_log,
observer),
source_url_(url),
@@ -262,12 +264,13 @@ class DownloadFileWithErrorsFactory : public DownloadFileFactory {
// DownloadFileFactory interface.
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,
+ base::File file,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer) override;
@@ -296,12 +299,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,
+ base::File file,
+ scoped_ptr<ByteStreamReader> byte_stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer) {
if (injected_errors_.find(url.spec()) == injected_errors_.end()) {
@@ -316,8 +320,8 @@ DownloadFile* DownloadFileWithErrorsFactory::CreateFile(
}
return new DownloadFileWithErrors(
- std::move(save_info), default_download_directory, url, referrer_url,
- calculate_hash, std::move(stream), bound_net_log, observer,
+ save_info, default_download_directory, url, referrer_url, calculate_hash,
+ std::move(file), std::move(byte_stream), bound_net_log, observer,
injected_errors_[url.spec()], construction_callback_,
destruction_callback_);
}

Powered by Google App Engine
This is Rietveld 408576698