Index: net/test/url_request/url_request_slow_download_job.cc |
diff --git a/net/test/url_request/url_request_slow_download_job.cc b/net/test/url_request/url_request_slow_download_job.cc |
index 52fd71cac03cac5f0c4a03df3d15abf5da5cc0c1..f344feb1c4d8f69f22008c6ef9fee22cf70f0997 100644 |
--- a/net/test/url_request/url_request_slow_download_job.cc |
+++ b/net/test/url_request/url_request_slow_download_job.cc |
@@ -179,34 +179,39 @@ URLRequestSlowDownloadJob::FillBufferHelper(IOBuffer* buf, |
return REQUEST_COMPLETE; |
} |
-int URLRequestSlowDownloadJob::ReadRawData(IOBuffer* buf, int buf_size) { |
+bool URLRequestSlowDownloadJob::ReadRawData(IOBuffer* buf, |
+ int buf_size, |
+ int* bytes_read) { |
if (base::LowerCaseEqualsASCII(kFinishDownloadUrl, |
request_->url().spec().c_str()) || |
base::LowerCaseEqualsASCII(kErrorDownloadUrl, |
request_->url().spec().c_str())) { |
VLOG(10) << __FUNCTION__ << " called w/ kFinish/ErrorDownloadUrl."; |
- return 0; |
+ *bytes_read = 0; |
+ return true; |
} |
VLOG(10) << __FUNCTION__ << " called at position " << bytes_already_sent_ |
<< " in the stream."; |
- int bytes_read = 0; |
- ReadStatus status = FillBufferHelper(buf, buf_size, &bytes_read); |
+ ReadStatus status = FillBufferHelper(buf, buf_size, bytes_read); |
switch (status) { |
case BUFFER_FILLED: |
- case REQUEST_COMPLETE: |
- return bytes_read; |
+ return true; |
case REQUEST_BLOCKED: |
buffer_ = buf; |
buffer_size_ = buf_size; |
+ SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
FROM_HERE, base::Bind(&URLRequestSlowDownloadJob::CheckDoneStatus, |
weak_factory_.GetWeakPtr()), |
base::TimeDelta::FromMilliseconds(100)); |
- return ERR_IO_PENDING; |
+ return false; |
+ case REQUEST_COMPLETE: |
+ *bytes_read = 0; |
+ return true; |
} |
NOTREACHED(); |
- return OK; |
+ return true; |
} |
void URLRequestSlowDownloadJob::CheckDoneStatus() { |
@@ -218,10 +223,12 @@ void URLRequestSlowDownloadJob::CheckDoneStatus() { |
FillBufferHelper(buffer_.get(), buffer_size_, &bytes_written); |
DCHECK_EQ(BUFFER_FILLED, status); |
buffer_ = NULL; // Release the reference. |
- ReadRawDataComplete(bytes_written); |
+ SetStatus(URLRequestStatus()); |
+ NotifyReadComplete(bytes_written); |
} else if (should_error_download_) { |
VLOG(10) << __FUNCTION__ << " called w/ should_finish_ownload_ set."; |
- ReadRawDataComplete(ERR_CONNECTION_RESET); |
+ NotifyDone( |
+ URLRequestStatus(URLRequestStatus::FAILED, ERR_CONNECTION_RESET)); |
} else { |
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
FROM_HERE, base::Bind(&URLRequestSlowDownloadJob::CheckDoneStatus, |