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

Unified Diff: net/url_request/url_request_data_job_fuzzer.cc

Issue 2313013002: Revert of Adjust callers and networking delegates in net/ to modified APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@URLRequestRead
Patch Set: Created 4 years, 3 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: net/url_request/url_request_data_job_fuzzer.cc
diff --git a/net/url_request/url_request_data_job_fuzzer.cc b/net/url_request/url_request_data_job_fuzzer.cc
index 4632de670a4083dfec4f47a5ccbc1afd0b1dee2f..6610c6bd3500f7f4640b79646c7aed2e28556df1 100644
--- a/net/url_request/url_request_data_job_fuzzer.cc
+++ b/net/url_request/url_request_data_job_fuzzer.cc
@@ -99,7 +99,7 @@
}
void ReadFromRequest(net::URLRequest* request) {
- int bytes_read = 0;
+ bool sync = false;
do {
// If possible, pop the next read size. If none exists, then this should
// be the last call to Read.
@@ -110,10 +110,11 @@
read_lengths_.pop_back();
}
- bytes_read = request->Read(buf_.get(), read_size);
- } while (bytes_read > 0);
+ int bytes_read = 0;
+ sync = request->Read(buf_.get(), read_size, &bytes_read);
+ } while (sync);
- if (bytes_read != net::ERR_IO_PENDING)
+ if (!request->status().is_io_pending())
QuitLoop();
}
@@ -129,23 +130,21 @@
void OnSSLCertificateError(net::URLRequest* request,
const net::SSLInfo& ssl_info,
bool fatal) override {}
- void OnResponseStarted(net::URLRequest* request, int net_error) override {
+ void OnResponseStarted(net::URLRequest* request) override {
+ DCHECK(!request->status().is_io_pending());
DCHECK(buf_.get());
DCHECK(read_loop_);
- DCHECK_NE(net::ERR_IO_PENDING, net_error);
-
- if (net_error == net::OK) {
+ if (request->status().is_success()) {
ReadFromRequest(request);
} else {
QuitLoop();
}
}
void OnReadCompleted(net::URLRequest* request, int bytes_read) override {
- DCHECK_NE(net::ERR_IO_PENDING, bytes_read);
+ DCHECK(!request->status().is_io_pending());
DCHECK(buf_.get());
DCHECK(read_loop_);
-
- if (bytes_read > 0) {
+ if (request->status().is_success() && bytes_read > 0) {
ReadFromRequest(request);
} else {
QuitLoop();
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_file_dir_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698