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

Unified Diff: mojo/services/network/url_loader_impl_apptest.cc

Issue 1459333002: Revert "Reland: URLRequestJob: change ReadRawData contract" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « ios/web/webui/url_data_manager_ios_backend.cc ('k') | net/test/url_request/url_request_failed_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/url_loader_impl_apptest.cc
diff --git a/mojo/services/network/url_loader_impl_apptest.cc b/mojo/services/network/url_loader_impl_apptest.cc
index 0b9de67dad75032b9dc72b94f8f99a86cc9c94a6..0fe17495404ca8802cfcb00630f9ca2696d646c9 100644
--- a/mojo/services/network/url_loader_impl_apptest.cc
+++ b/mojo/services/network/url_loader_impl_apptest.cc
@@ -49,28 +49,32 @@ class TestURLRequestJob : public net::URLRequestJob {
void Start() override { status_ = STARTED; }
- int ReadRawData(net::IOBuffer* buf, int buf_size) override {
+ bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override {
status_ = READING;
buf_size_ = buf_size;
- return net::ERR_IO_PENDING;
+ SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+ return false;
}
void NotifyHeadersComplete() { net::URLRequestJob::NotifyHeadersComplete(); }
void NotifyReadComplete(int bytes_read) {
if (bytes_read < 0) {
- // Map errors to net::ERR_FAILED.
- ReadRawDataComplete(net::ERR_FAILED);
+ NotifyDone(net::URLRequestStatus(
+ net::URLRequestStatus::FromError(net::ERR_FAILED)));
+ net::URLRequestJob::NotifyReadComplete(0);
// Set this after calling ReadRawDataComplete since that ends up calling
// ReadRawData.
status_ = COMPLETED;
} else if (bytes_read == 0) {
- ReadRawDataComplete(bytes_read);
+ NotifyDone(net::URLRequestStatus());
+ net::URLRequestJob::NotifyReadComplete(bytes_read);
// Set this after calling ReadRawDataComplete since that ends up calling
// ReadRawData.
status_ = COMPLETED;
} else {
- ReadRawDataComplete(bytes_read);
+ SetStatus(net::URLRequestStatus());
+ net::URLRequestJob::NotifyReadComplete(bytes_read);
// Set this after calling ReadRawDataComplete since that ends up calling
// ReadRawData.
status_ = STARTED;
« no previous file with comments | « ios/web/webui/url_data_manager_ios_backend.cc ('k') | net/test/url_request/url_request_failed_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698