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

Unified Diff: net/url_request/url_request_data_job_fuzzer.cc

Issue 2265873002: Adjust callers and networking delegates in net/ to modified APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@URLRequestRead
Patch Set: rebased on top of URLRequest::Read CL 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 6610c6bd3500f7f4640b79646c7aed2e28556df1..4632de670a4083dfec4f47a5ccbc1afd0b1dee2f 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 @@ class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
}
void ReadFromRequest(net::URLRequest* request) {
- bool sync = false;
+ int bytes_read = 0;
do {
// If possible, pop the next read size. If none exists, then this should
// be the last call to Read.
@@ -110,11 +110,10 @@ class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
read_lengths_.pop_back();
}
- int bytes_read = 0;
- sync = request->Read(buf_.get(), read_size, &bytes_read);
- } while (sync);
+ bytes_read = request->Read(buf_.get(), read_size);
+ } while (bytes_read > 0);
- if (!request->status().is_io_pending())
+ if (bytes_read != net::ERR_IO_PENDING)
QuitLoop();
}
@@ -130,21 +129,23 @@ class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
void OnSSLCertificateError(net::URLRequest* request,
const net::SSLInfo& ssl_info,
bool fatal) override {}
- void OnResponseStarted(net::URLRequest* request) override {
- DCHECK(!request->status().is_io_pending());
+ void OnResponseStarted(net::URLRequest* request, int net_error) override {
DCHECK(buf_.get());
DCHECK(read_loop_);
- if (request->status().is_success()) {
+ DCHECK_NE(net::ERR_IO_PENDING, net_error);
+
+ if (net_error == net::OK) {
ReadFromRequest(request);
} else {
QuitLoop();
}
}
void OnReadCompleted(net::URLRequest* request, int bytes_read) override {
- DCHECK(!request->status().is_io_pending());
+ DCHECK_NE(net::ERR_IO_PENDING, bytes_read);
DCHECK(buf_.get());
DCHECK(read_loop_);
- if (request->status().is_success() && bytes_read > 0) {
+
+ if (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