diff options
Diffstat (limited to 'net/url_request/url_request_unittest.h')
-rw-r--r-- | net/url_request/url_request_unittest.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index 9389ce8..58a0218 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -21,7 +21,6 @@ #include "base/thread.h" #include "base/time.h" #include "base/waitable_event.h" -#include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/http/http_network_layer.h" #include "net/url_request/url_request.h" @@ -63,8 +62,7 @@ class TestDelegate : public URLRequest::Delegate { received_bytes_count_(0), received_redirect_count_(0), received_data_before_response_(false), - request_failed_(false), - buf_(new net::IOBuffer(kBufferSize)) { + request_failed_(false) { } virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url) { @@ -89,7 +87,7 @@ class TestDelegate : public URLRequest::Delegate { } else { // Initiate the first read. int bytes_read = 0; - if (request->Read(buf_, kBufferSize, &bytes_read)) + if (request->Read(buf_, sizeof(buf_), &bytes_read)) OnReadCompleted(request, bytes_read); else if (!request->status().is_io_pending()) OnResponseCompleted(request); @@ -111,15 +109,15 @@ class TestDelegate : public URLRequest::Delegate { received_bytes_count_ += bytes_read; // consume the data - data_received_.append(buf_->data(), bytes_read); + data_received_.append(buf_, bytes_read); } // If it was not end of stream, request to read more. if (request->status().is_success() && bytes_read > 0) { bytes_read = 0; - while (request->Read(buf_, kBufferSize, &bytes_read)) { + while (request->Read(buf_, sizeof(buf_), &bytes_read)) { if (bytes_read > 0) { - data_received_.append(buf_->data(), bytes_read); + data_received_.append(buf_, bytes_read); received_bytes_count_ += bytes_read; } else { break; @@ -175,7 +173,6 @@ class TestDelegate : public URLRequest::Delegate { bool request_failed() const { return request_failed_; } private: - static const int kBufferSize = 4096; // options for controlling behavior bool cancel_in_rr_; bool cancel_in_rs_; @@ -195,7 +192,7 @@ class TestDelegate : public URLRequest::Delegate { std::string data_received_; // our read buffer - scoped_refptr<net::IOBuffer> buf_; + char buf_[4096]; }; // This object bounds the lifetime of an external python-based HTTP/FTP server |