| 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();
|
|
|