Chromium Code Reviews| 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 dd53d14c6a83f1d1ce1994d18c49979bff682684..34bc90eb495bbe54570bd3262b1b8c0b6d292dac 100644 |
| --- a/content/public/test/test_file_error_injector.cc |
| +++ b/content/public/test/test_file_error_injector.cc |
| @@ -39,12 +39,13 @@ class DownloadFileWithErrors: public DownloadFileImpl { |
| typedef base::Callback<void(const GURL& url)> DestructionCallback; |
| DownloadFileWithErrors( |
| - const DownloadCreateInfo* info, |
| + scoped_ptr<DownloadCreateInfo> info, |
| scoped_ptr<content::ByteStreamReader> stream, |
| DownloadRequestHandleInterface* request_handle, |
| content::DownloadManager* download_manager, |
| bool calculate_hash, |
| const net::BoundNetLog& bound_net_log, |
| + const GURL& source_url, |
| const content::TestFileErrorInjector::FileErrorInfo& error_info, |
| const ConstructionCallback& ctor_callback, |
| const DestructionCallback& dtor_callback); |
| @@ -102,25 +103,26 @@ static void RenameErrorCallback( |
| DownloadFileWithErrors::DownloadFileWithErrors( |
| - const DownloadCreateInfo* info, |
| + scoped_ptr<DownloadCreateInfo> info, |
| scoped_ptr<content::ByteStreamReader> stream, |
| DownloadRequestHandleInterface* request_handle, |
| content::DownloadManager* download_manager, |
| bool calculate_hash, |
| const net::BoundNetLog& bound_net_log, |
| + const GURL& source_url, |
| const content::TestFileErrorInjector::FileErrorInfo& error_info, |
| const ConstructionCallback& ctor_callback, |
| const DestructionCallback& dtor_callback) |
| - : DownloadFileImpl(info, |
| - stream.Pass(), |
| - request_handle, |
| - download_manager, |
| - calculate_hash, |
| - scoped_ptr<content::PowerSaveBlocker>(NULL).Pass(), |
| - bound_net_log), |
| - source_url_(info->url()), |
| - error_info_(error_info), |
| - destruction_callback_(dtor_callback) { |
| + : DownloadFileImpl(info.Pass(), |
| + stream.Pass(), |
| + request_handle, |
| + download_manager, |
| + calculate_hash, |
| + scoped_ptr<content::PowerSaveBlocker>(NULL).Pass(), |
| + bound_net_log), |
| + source_url_(source_url), |
| + error_info_(error_info), |
| + destruction_callback_(dtor_callback) { |
| ctor_callback.Run(source_url_, info->download_id); |
| } |
| @@ -198,7 +200,7 @@ class DownloadFileWithErrorsFactory : public content::DownloadFileFactory { |
| // DownloadFileFactory interface. |
| virtual DownloadFile* CreateFile( |
| - DownloadCreateInfo* info, |
| + scoped_ptr<DownloadCreateInfo> info, |
| scoped_ptr<content::ByteStreamReader> stream, |
| content::DownloadManager* download_manager, |
| bool calculate_hash, |
| @@ -229,32 +231,36 @@ DownloadFileWithErrorsFactory::~DownloadFileWithErrorsFactory() { |
| } |
| content::DownloadFile* DownloadFileWithErrorsFactory::CreateFile( |
| - DownloadCreateInfo* info, |
| + scoped_ptr<DownloadCreateInfo> info, |
| scoped_ptr<content::ByteStreamReader> stream, |
| content::DownloadManager* download_manager, |
| bool calculate_hash, |
| const net::BoundNetLog& bound_net_log) { |
| - std::string url = info->url().spec(); |
| + GURL url = info->url(); |
| - if (injected_errors_.find(url) == injected_errors_.end()) { |
| + if (injected_errors_.find(url.spec()) == injected_errors_.end()) { |
| // Have to create entry, because FileErrorInfo is not a POD type. |
| TestFileErrorInjector::FileErrorInfo err_info = { |
| - url, |
| + url.spec(), |
| TestFileErrorInjector::FILE_OPERATION_INITIALIZE, |
| -1, |
| content::DOWNLOAD_INTERRUPT_REASON_NONE |
| }; |
| - injected_errors_[url] = err_info; |
| + injected_errors_[url.spec()] = err_info; |
| } |
| + DownloadRequestHandle* request_handle( |
| + new DownloadRequestHandle(info->request_handle)); |
| + |
| return new DownloadFileWithErrors( |
| - info, |
| + info.Pass(), |
| stream.Pass(), |
| - new DownloadRequestHandle(info->request_handle), |
| + request_handle, // Takes ownership. |
|
benjhayden
2012/10/11 19:41:12
Again, this comment belongs in DFWE, not here.
Randy Smith (Not in Mondays)
2012/10/15 18:56:32
Moot because of your other suggestion, but if I we
|
| download_manager, |
| calculate_hash, |
| bound_net_log, |
| - injected_errors_[url], |
| + url, |
| + injected_errors_[url.spec()], |
| construction_callback_, |
| destruction_callback_); |
| } |