Chromium Code Reviews| Index: content/public/test/test_download_request_handler.cc |
| diff --git a/content/public/test/test_download_request_handler.cc b/content/public/test/test_download_request_handler.cc |
| index 89e2cdc1180c0c618b9eaf1a500f9f85f1818c4d..c076dfd4033cbc3bdad03495ee13b30df801b0cd 100644 |
| --- a/content/public/test/test_download_request_handler.cc |
| +++ b/content/public/test/test_download_request_handler.cc |
| @@ -149,6 +149,7 @@ class TestDownloadRequestHandler::PartialResponseJob |
| int64_t offset_of_next_read_ = -1; |
| int64_t requested_range_begin_ = -1; |
| int64_t requested_range_end_ = -1; |
| + bool should_report_completed_request_ = false; |
| base::WeakPtrFactory<PartialResponseJob> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(PartialResponseJob); |
| @@ -222,7 +223,10 @@ TestDownloadRequestHandler::PartialResponseJob::PartialResponseJob( |
| DCHECK_NE(-1, parameters_->pattern_generator_seed); |
| } |
| -TestDownloadRequestHandler::PartialResponseJob::~PartialResponseJob() {} |
| +TestDownloadRequestHandler::PartialResponseJob::~PartialResponseJob() { |
| + if (should_report_completed_request_) |
| + ReportCompletedRequest(0); |
| +} |
| void TestDownloadRequestHandler::PartialResponseJob::Start() { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| @@ -309,6 +313,7 @@ int TestDownloadRequestHandler::PartialResponseJob::ReadRawData( |
| void TestDownloadRequestHandler::PartialResponseJob::ReportCompletedRequest( |
| int64_t transferred_byte_count) { |
| + should_report_completed_request_ = false; |
|
svaldez
2016/01/13 17:29:18
Seems unnecessary since we only call this on destr
asanka
2016/01/28 02:24:17
We also call ReportCompletedRequest when the URLRe
|
| if (interceptor_.get()) { |
| TestDownloadRequestHandler::CompletedRequest completed_request; |
| completed_request.transferred_byte_count = transferred_byte_count; |
| @@ -474,6 +479,9 @@ void TestDownloadRequestHandler::PartialResponseJob:: |
| parameters_->injected_errors.front().offset <= requested_range_begin_) |
| parameters_->injected_errors.pop(); |
| + // From this point on, the request is considered successful. |
| + should_report_completed_request_ = true; |
| + |
| base::MessageLoop::current()->PostTask( |
| FROM_HERE, base::Bind(&PartialResponseJob::NotifyHeadersComplete, |
| weak_factory_.GetWeakPtr())); |