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

Unified Diff: net/url_request/url_request_data_job_fuzzer.cc

Issue 2330863002: Use modifed URLRequest API in net/url_request context builder, data job fuzzer and file dir test (Closed)
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 3df1d3882c6c7ae55adb6765cc46a03413471a0c..4c76e2cbd614071827da492e3fa51fe2cfba73e0 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