summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-15 05:50:11 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-15 05:50:11 +0000
commitbf3eb00891aaa033bdaee57797e665eb71f28817 (patch)
tree72bda1e59fa1f379d578298272eb2e3729174c05 /net/http
parent67d13d556a713a64e41c2ff76f58f4839296f37e (diff)
downloadchromium_src-bf3eb00891aaa033bdaee57797e665eb71f28817.zip
chromium_src-bf3eb00891aaa033bdaee57797e665eb71f28817.tar.gz
chromium_src-bf3eb00891aaa033bdaee57797e665eb71f28817.tar.bz2
net: Remove UploadDataStream* argument from HttpStream::SendRequest
HttpInfo::upload_data is used instead. BUG=156574 TEST=net_unittests Review URL: https://chromiumcodereview.appspot.com/11361116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_basic_stream.cc4
-rw-r--r--net/http/http_basic_stream.h2
-rw-r--r--net/http/http_network_transaction.cc17
-rw-r--r--net/http/http_network_transaction.h2
-rw-r--r--net/http/http_pipelined_connection_impl.cc4
-rw-r--r--net/http/http_pipelined_connection_impl.h3
-rw-r--r--net/http/http_pipelined_connection_impl_unittest.cc152
-rw-r--r--net/http/http_pipelined_stream.cc12
-rw-r--r--net/http/http_pipelined_stream.h2
-rw-r--r--net/http/http_proxy_client_socket.cc2
-rw-r--r--net/http/http_response_body_drainer_unittest.cc1
-rw-r--r--net/http/http_stream.h1
-rw-r--r--net/http/http_stream_base.h2
-rw-r--r--net/http/http_stream_parser.cc52
-rw-r--r--net/http/http_stream_parser.h4
-rw-r--r--net/http/http_stream_parser_unittest.cc9
16 files changed, 117 insertions, 152 deletions
diff --git a/net/http/http_basic_stream.cc b/net/http/http_basic_stream.cc
index 7077ee2..b39a4cd 100644
--- a/net/http/http_basic_stream.cc
+++ b/net/http/http_basic_stream.cc
@@ -46,7 +46,6 @@ int HttpBasicStream::InitializeStream(
int HttpBasicStream::SendRequest(const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) {
DCHECK(parser_.get());
@@ -58,8 +57,7 @@ int HttpBasicStream::SendRequest(const HttpRequestHeaders& headers,
request_info_->method.c_str(),
path.c_str());
response_ = response;
- return parser_->SendRequest(request_line_, headers, request_body,
- response, callback);
+ return parser_->SendRequest(request_line_, headers, response, callback);
}
UploadProgress HttpBasicStream::GetUploadProgress() const {
diff --git a/net/http/http_basic_stream.h b/net/http/http_basic_stream.h
index 9a85770..a65fc5b 100644
--- a/net/http/http_basic_stream.h
+++ b/net/http/http_basic_stream.h
@@ -24,7 +24,6 @@ struct HttpRequestInfo;
class HttpRequestHeaders;
class HttpStreamParser;
class IOBuffer;
-class UploadDataStream;
class HttpBasicStream : public HttpStream {
public:
@@ -43,7 +42,6 @@ class HttpBasicStream : public HttpStream {
const CompletionCallback& callback) OVERRIDE;
virtual int SendRequest(const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) OVERRIDE;
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index fde5e34..05ed0b0 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -116,7 +116,6 @@ HttpNetworkTransaction::HttpNetworkTransaction(HttpNetworkSession* session)
ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_(
base::Bind(&HttpNetworkTransaction::OnIOComplete,
base::Unretained(this)))),
- request_body_(NULL),
session_(session),
request_(NULL),
headers_valid_(false),
@@ -717,14 +716,14 @@ void HttpNetworkTransaction::BuildRequestHeaders(bool using_proxy) {
}
// Add a content length header?
- if (request_body_) {
- if (request_body_->is_chunked()) {
+ if (request_->upload_data_stream) {
+ if (request_->upload_data_stream->is_chunked()) {
request_headers_.SetHeader(
HttpRequestHeaders::kTransferEncoding, "chunked");
} else {
request_headers_.SetHeader(
HttpRequestHeaders::kContentLength,
- base::Uint64ToString(request_body_->size()));
+ base::Uint64ToString(request_->upload_data_stream->size()));
}
} else if (request_->method == "POST" || request_->method == "PUT" ||
request_->method == "HEAD") {
@@ -755,18 +754,15 @@ void HttpNetworkTransaction::BuildRequestHeaders(bool using_proxy) {
int HttpNetworkTransaction::DoInitRequestBody() {
next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE;
- request_body_ = request_->upload_data_stream;
int rv = OK;
- if (request_body_)
- rv = request_body_->Init(io_callback_);
+ if (request_->upload_data_stream)
+ rv = request_->upload_data_stream->Init(io_callback_);
return rv;
}
int HttpNetworkTransaction::DoInitRequestBodyComplete(int result) {
if (result == OK)
next_state_ = STATE_BUILD_REQUEST;
- else
- request_body_ = NULL;
return result;
}
@@ -794,8 +790,7 @@ int HttpNetworkTransaction::DoBuildRequestComplete(int result) {
int HttpNetworkTransaction::DoSendRequest() {
next_state_ = STATE_SEND_REQUEST_COMPLETE;
- return stream_->SendRequest(
- request_headers_, request_body_, &response_, io_callback_);
+ return stream_->SendRequest(request_headers_, &response_, io_callback_);
}
int HttpNetworkTransaction::DoSendRequestComplete(int result) {
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index cd517e3..92dabe5 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -29,7 +29,6 @@ class HttpNetworkSession;
class HttpStreamBase;
class HttpStreamRequest;
class IOBuffer;
-class UploadDataStream;
struct HttpRequestInfo;
class NET_EXPORT_PRIVATE HttpNetworkTransaction
@@ -252,7 +251,6 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
CompletionCallback io_callback_;
CompletionCallback callback_;
- UploadDataStream* request_body_;
scoped_refptr<HttpNetworkSession> session_;
diff --git a/net/http/http_pipelined_connection_impl.cc b/net/http/http_pipelined_connection_impl.cc
index 7b5b0d2..f604a26 100644
--- a/net/http/http_pipelined_connection_impl.cc
+++ b/net/http/http_pipelined_connection_impl.cc
@@ -174,7 +174,6 @@ int HttpPipelinedConnectionImpl::SendRequest(
int pipeline_id,
const std::string& request_line,
const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) {
CHECK(ContainsKey(stream_info_map_, pipeline_id));
@@ -187,7 +186,6 @@ int HttpPipelinedConnectionImpl::SendRequest(
send_request->pipeline_id = pipeline_id;
send_request->request_line = request_line;
send_request->headers = headers;
- send_request->request_body = request_body;
send_request->response = response;
send_request->callback = callback;
pending_send_request_queue_.push(send_request);
@@ -277,7 +275,6 @@ int HttpPipelinedConnectionImpl::DoSendActiveRequest(int result) {
int rv = stream_info_map_[active_send_request_->pipeline_id].parser->
SendRequest(active_send_request_->request_line,
active_send_request_->headers,
- active_send_request_->request_body,
active_send_request_->response,
base::Bind(&HttpPipelinedConnectionImpl::OnSendIOCallback,
base::Unretained(this)));
@@ -826,7 +823,6 @@ NextProto HttpPipelinedConnectionImpl::protocol_negotiated()
HttpPipelinedConnectionImpl::PendingSendRequest::PendingSendRequest()
: pipeline_id(0),
- request_body(NULL),
response(NULL) {
}
diff --git a/net/http/http_pipelined_connection_impl.h b/net/http/http_pipelined_connection_impl.h
index 787f672..f358c05 100644
--- a/net/http/http_pipelined_connection_impl.h
+++ b/net/http/http_pipelined_connection_impl.h
@@ -33,7 +33,6 @@ class HttpResponseInfo;
class IOBuffer;
class SSLCertRequestInfo;
class SSLInfo;
-class UploadDataStream;
// This class manages all of the state for a single pipelined connection. It
// tracks the order that HTTP requests are sent and enforces that the
@@ -100,7 +99,6 @@ class NET_EXPORT_PRIVATE HttpPipelinedConnectionImpl
int SendRequest(int pipeline_id,
const std::string& request_line,
const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback);
@@ -176,7 +174,6 @@ class NET_EXPORT_PRIVATE HttpPipelinedConnectionImpl
int pipeline_id;
std::string request_line;
HttpRequestHeaders headers;
- UploadDataStream* request_body;
HttpResponseInfo* response;
CompletionCallback callback;
};
diff --git a/net/http/http_pipelined_connection_impl_unittest.cc b/net/http/http_pipelined_connection_impl_unittest.cc
index 55c4de9..d807a6b 100644
--- a/net/http/http_pipelined_connection_impl_unittest.cc
+++ b/net/http/http_pipelined_connection_impl_unittest.cc
@@ -137,7 +137,7 @@ class HttpPipelinedConnectionImplTest : public testing::Test {
const std::string& filename) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK, stream->ReadResponseHeaders(callback_.callback()));
ExpectResponse(filename, stream, false);
@@ -209,7 +209,7 @@ TEST_F(HttpPipelinedConnectionImplTest, AsyncSingleRequest) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(headers, &response,
callback_.callback()));
data_->RunFor(1);
EXPECT_LE(OK, callback_.WaitForResult());
@@ -243,12 +243,12 @@ TEST_F(HttpPipelinedConnectionImplTest, LockStepAsyncRequests) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequest(headers1, NULL, &response1,
+ EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequest(headers1, &response1,
callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequest(headers2, NULL, &response2,
+ EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequest(headers2, &response2,
callback_.callback()));
data_->RunFor(1);
@@ -295,11 +295,11 @@ TEST_F(HttpPipelinedConnectionImplTest, TwoResponsesInOnePacket) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
EXPECT_EQ(OK, stream1->ReadResponseHeaders(callback_.callback()));
@@ -353,12 +353,12 @@ TEST_F(HttpPipelinedConnectionImplTest, ReadOrderSwapped) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
EXPECT_EQ(ERR_IO_PENDING, stream2->ReadResponseHeaders(callback_.callback()));
@@ -394,13 +394,13 @@ TEST_F(HttpPipelinedConnectionImplTest, SendWhileReading) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
EXPECT_EQ(OK, stream1->ReadResponseHeaders(callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
ExpectResponse("ok.html", stream1, false);
@@ -431,7 +431,7 @@ TEST_F(HttpPipelinedConnectionImplTest, AsyncSendWhileAsyncReadBlocked) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
EXPECT_EQ(OK, stream1->ReadResponseHeaders(callback_.callback()));
TestCompletionCallback callback1;
@@ -444,7 +444,7 @@ TEST_F(HttpPipelinedConnectionImplTest, AsyncSendWhileAsyncReadBlocked) {
HttpRequestHeaders headers2;
HttpResponseInfo response2;
TestCompletionCallback callback2;
- EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequest(headers2, NULL, &response2,
+ EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequest(headers2, &response2,
callback2.callback()));
data_->RunFor(1);
@@ -500,17 +500,15 @@ TEST_F(HttpPipelinedConnectionImplTest, UnsentStreamAllowsLaterUse) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(headers, &response,
callback_.callback()));
scoped_ptr<HttpStream> unsent_stream(NewTestStream("unsent.html"));
HttpRequestHeaders unsent_headers;
HttpResponseInfo unsent_response;
- EXPECT_EQ(ERR_IO_PENDING,
- unsent_stream->SendRequest(unsent_headers,
- NULL,
- &unsent_response,
- callback_.callback()));
+ EXPECT_EQ(ERR_IO_PENDING, unsent_stream->SendRequest(unsent_headers,
+ &unsent_response,
+ callback_.callback()));
unsent_stream->Close(false);
data_->RunFor(1);
@@ -544,15 +542,13 @@ TEST_F(HttpPipelinedConnectionImplTest, FailedSend) {
HttpResponseInfo response;
TestCompletionCallback failed_callback;
EXPECT_EQ(ERR_IO_PENDING,
- failed_stream->SendRequest(headers, NULL,
- &response, failed_callback.callback()));
+ failed_stream->SendRequest(headers, &response,
+ failed_callback.callback()));
TestCompletionCallback evicted_callback;
EXPECT_EQ(ERR_IO_PENDING,
- evicted_stream->SendRequest(headers,
- NULL,
- &response,
+ evicted_stream->SendRequest(headers, &response,
evicted_callback.callback()));
- EXPECT_EQ(ERR_IO_PENDING, closed_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(ERR_IO_PENDING, closed_stream->SendRequest(headers, &response,
callback_.callback()));
closed_stream->Close(false);
@@ -560,7 +556,7 @@ TEST_F(HttpPipelinedConnectionImplTest, FailedSend) {
EXPECT_EQ(ERR_FAILED, failed_callback.WaitForResult());
EXPECT_EQ(ERR_PIPELINE_EVICTION, evicted_callback.WaitForResult());
EXPECT_EQ(ERR_PIPELINE_EVICTION,
- rejected_stream->SendRequest(headers, NULL, &response,
+ rejected_stream->SendRequest(headers, &response,
callback_.callback()));
failed_stream->Close(true);
@@ -595,19 +591,19 @@ TEST_F(HttpPipelinedConnectionImplTest, ConnectionSuddenlyClosedAfterResponse) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, closed_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, closed_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, read_evicted_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, read_evicted_stream->SendRequest(headers, &response,
callback_.callback()));
- EXPECT_EQ(OK, read_rejected_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, read_rejected_stream->SendRequest(headers, &response,
callback_.callback()));
TestCompletionCallback send_closed_callback;
EXPECT_EQ(ERR_IO_PENDING,
- send_closed_stream->SendRequest(headers, NULL, &response,
+ send_closed_stream->SendRequest(headers, &response,
send_closed_callback.callback()));
TestCompletionCallback send_evicted_callback;
EXPECT_EQ(ERR_IO_PENDING,
- send_evicted_stream->SendRequest(headers, NULL, &response,
+ send_evicted_stream->SendRequest(headers, &response,
send_evicted_callback.callback()));
TestCompletionCallback read_evicted_callback;
@@ -634,7 +630,7 @@ TEST_F(HttpPipelinedConnectionImplTest, ConnectionSuddenlyClosedAfterResponse) {
send_evicted_stream->Close(true);
EXPECT_EQ(ERR_PIPELINE_EVICTION,
- send_rejected_stream->SendRequest(headers, NULL, &response,
+ send_rejected_stream->SendRequest(headers, &response,
callback_.callback()));
send_rejected_stream->Close(true);
}
@@ -652,11 +648,11 @@ TEST_F(HttpPipelinedConnectionImplTest, AbortWhileSending) {
HttpResponseInfo response;
TestCompletionCallback aborted_callback;
EXPECT_EQ(ERR_IO_PENDING,
- aborted_stream->SendRequest(headers, NULL, &response,
+ aborted_stream->SendRequest(headers, &response,
aborted_callback.callback()));
TestCompletionCallback evicted_callback;
EXPECT_EQ(ERR_IO_PENDING,
- evicted_stream->SendRequest(headers, NULL, &response,
+ evicted_stream->SendRequest(headers, &response,
evicted_callback.callback()));
aborted_stream->Close(true);
@@ -679,15 +675,15 @@ TEST_F(HttpPipelinedConnectionImplTest, AbortWhileSendingSecondRequest) {
HttpRequestHeaders headers;
HttpResponseInfo response;
TestCompletionCallback ok_callback;
- EXPECT_EQ(ERR_IO_PENDING, ok_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(ERR_IO_PENDING, ok_stream->SendRequest(headers, &response,
ok_callback.callback()));
TestCompletionCallback aborted_callback;
EXPECT_EQ(ERR_IO_PENDING,
- aborted_stream->SendRequest(headers, NULL, &response,
+ aborted_stream->SendRequest(headers, &response,
aborted_callback.callback()));
TestCompletionCallback evicted_callback;
EXPECT_EQ(ERR_IO_PENDING,
- evicted_stream->SendRequest(headers, NULL, &response,
+ evicted_stream->SendRequest(headers, &response,
evicted_callback.callback()));
data_->RunFor(1);
@@ -717,10 +713,10 @@ TEST_F(HttpPipelinedConnectionImplTest, AbortWhileReadingHeaders) {
HttpRequestHeaders headers;
HttpResponseInfo response;
EXPECT_EQ(OK,
- aborted_stream->SendRequest(headers, NULL, &response,
+ aborted_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK,
- evicted_stream->SendRequest(headers, NULL, &response,
+ evicted_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(ERR_IO_PENDING,
@@ -734,7 +730,7 @@ TEST_F(HttpPipelinedConnectionImplTest, AbortWhileReadingHeaders) {
evicted_stream->Close(true);
EXPECT_EQ(ERR_PIPELINE_EVICTION,
- rejected_stream->SendRequest(headers, NULL, &response,
+ rejected_stream->SendRequest(headers, &response,
callback_.callback()));
rejected_stream->Close(true);
}
@@ -758,11 +754,11 @@ TEST_F(HttpPipelinedConnectionImplTest, PendingResponseAbandoned) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, ok_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, ok_stream->SendRequest(headers, &response,
callback_.callback()));
- EXPECT_EQ(OK, abandoned_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, abandoned_stream->SendRequest(headers, &response,
callback_.callback()));
- EXPECT_EQ(OK, evicted_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, evicted_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK, ok_stream->ReadResponseHeaders(callback_.callback()));
@@ -805,9 +801,9 @@ TEST_F(HttpPipelinedConnectionImplTest, DisconnectedAfterOneRequestRecovery) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, ok_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, ok_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, rejected_read_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, rejected_read_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK, ok_stream->ReadResponseHeaders(callback_.callback()));
@@ -816,7 +812,7 @@ TEST_F(HttpPipelinedConnectionImplTest, DisconnectedAfterOneRequestRecovery) {
TestCompletionCallback read_callback;
EXPECT_EQ(ERR_IO_PENDING,
- evicted_send_stream->SendRequest(headers, NULL, &response,
+ evicted_send_stream->SendRequest(headers, &response,
read_callback.callback()));
data_->RunFor(1);
EXPECT_EQ(ERR_PIPELINE_EVICTION, read_callback.WaitForResult());
@@ -824,7 +820,7 @@ TEST_F(HttpPipelinedConnectionImplTest, DisconnectedAfterOneRequestRecovery) {
EXPECT_EQ(ERR_PIPELINE_EVICTION,
rejected_read_stream->ReadResponseHeaders(callback_.callback()));
EXPECT_EQ(ERR_PIPELINE_EVICTION,
- rejected_send_stream->SendRequest(headers, NULL, &response,
+ rejected_send_stream->SendRequest(headers, &response,
callback_.callback()));
rejected_read_stream->Close(true);
@@ -849,9 +845,9 @@ TEST_F(HttpPipelinedConnectionImplTest, DisconnectedPendingReadRecovery) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, ok_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, ok_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, evicted_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, evicted_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK, ok_stream->ReadResponseHeaders(callback_.callback()));
@@ -885,9 +881,9 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseCalledBeforeNextReadLoop) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, ok_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, ok_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, evicted_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, evicted_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK, ok_stream->ReadResponseHeaders(callback_.callback()));
@@ -919,9 +915,9 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseCalledBeforeReadCallback) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, ok_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, ok_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, evicted_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, evicted_stream->SendRequest(headers, &response,
callback_.callback()));
EXPECT_EQ(OK, ok_stream->ReadResponseHeaders(callback_.callback()));
@@ -972,7 +968,7 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseCalledDuringSendCallback) {
StreamDeleter deleter(stream);
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(ERR_IO_PENDING, stream->SendRequest(headers, &response,
deleter.callback()));
data_->RunFor(1);
}
@@ -991,7 +987,7 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseCalledDuringReadCallback) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, stream->SendRequest(headers,
&response, callback_.callback()));
StreamDeleter deleter(stream);
@@ -1016,9 +1012,9 @@ TEST_F(HttpPipelinedConnectionImplTest,
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, failed_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, failed_stream->SendRequest(headers, &response,
callback_.callback()));
- EXPECT_EQ(OK, evicted_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, evicted_stream->SendRequest(headers, &response,
callback_.callback()));
StreamDeleter failed_deleter(failed_stream);
@@ -1046,9 +1042,9 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseOtherDuringReadCallback) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, deleter_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, deleter_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, deleted_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, deleted_stream->SendRequest(headers,
&response, callback_.callback()));
StreamDeleter deleter(deleted_stream);
@@ -1074,7 +1070,7 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseBeforeSendCallbackRuns) {
HttpRequestHeaders headers;
HttpResponseInfo response;
EXPECT_EQ(ERR_IO_PENDING,
- close_stream->SendRequest(headers, NULL,
+ close_stream->SendRequest(headers,
&response, close_callback->callback()));
data_->RunFor(1);
@@ -1103,7 +1099,7 @@ TEST_F(HttpPipelinedConnectionImplTest, CloseBeforeReadCallbackRuns) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, close_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, close_stream->SendRequest(headers,
&response, callback_.callback()));
scoped_ptr<TestCompletionCallback> close_callback(
@@ -1134,13 +1130,13 @@ TEST_F(HttpPipelinedConnectionImplTest, AbortWhileSendQueued) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
TestCompletionCallback callback1;
- EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequest(headers1, NULL, &response1,
+ EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequest(headers1, &response1,
callback1.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
TestCompletionCallback callback2;
- EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequest(headers2, NULL, &response2,
+ EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequest(headers2, &response2,
callback2.callback()));
stream2.reset();
@@ -1165,14 +1161,14 @@ TEST_F(HttpPipelinedConnectionImplTest, NoGapBetweenCloseAndEviction) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, close_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, close_stream->SendRequest(headers, &response,
callback_.callback()));
TestCompletionCallback close_callback;
EXPECT_EQ(ERR_IO_PENDING,
close_stream->ReadResponseHeaders(close_callback.callback()));
- EXPECT_EQ(OK, dummy_stream->SendRequest(headers, NULL, &response,
+ EXPECT_EQ(OK, dummy_stream->SendRequest(headers, &response,
callback_.callback()));
TestCompletionCallback dummy_callback;
@@ -1211,11 +1207,11 @@ TEST_F(HttpPipelinedConnectionImplTest, RecoverFromDrainOnRedirect) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
EXPECT_EQ(OK, stream1->ReadResponseHeaders(callback_.callback()));
@@ -1243,11 +1239,11 @@ TEST_F(HttpPipelinedConnectionImplTest, EvictAfterDrainOfUnknownSize) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
EXPECT_EQ(OK, stream1->ReadResponseHeaders(callback_.callback()));
@@ -1276,11 +1272,11 @@ TEST_F(HttpPipelinedConnectionImplTest, EvictAfterFailedDrain) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
@@ -1311,11 +1307,11 @@ TEST_F(HttpPipelinedConnectionImplTest, EvictIfDrainingChunkedEncoding) {
HttpRequestHeaders headers1;
HttpResponseInfo response1;
- EXPECT_EQ(OK, stream1->SendRequest(headers1, NULL,
+ EXPECT_EQ(OK, stream1->SendRequest(headers1,
&response1, callback_.callback()));
HttpRequestHeaders headers2;
HttpResponseInfo response2;
- EXPECT_EQ(OK, stream2->SendRequest(headers2, NULL,
+ EXPECT_EQ(OK, stream2->SendRequest(headers2,
&response2, callback_.callback()));
@@ -1346,11 +1342,11 @@ TEST_F(HttpPipelinedConnectionImplTest, EvictionDueToMissingContentLength) {
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, ok_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, ok_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, evicted_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, evicted_stream->SendRequest(headers,
&response, callback_.callback()));
- EXPECT_EQ(OK, rejected_stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, rejected_stream->SendRequest(headers,
&response, callback_.callback()));
TestCompletionCallback ok_callback;
@@ -1393,7 +1389,7 @@ TEST_F(HttpPipelinedConnectionImplTest, FeedbackOnSocketError) {
scoped_ptr<HttpStream> stream(NewTestStream("ok.html"));
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, stream->SendRequest(headers,
&response, callback_.callback()));
EXPECT_EQ(ERR_FAILED, stream->ReadResponseHeaders(callback_.callback()));
}
@@ -1413,7 +1409,7 @@ TEST_F(HttpPipelinedConnectionImplTest, FeedbackOnNoInternetConnection) {
scoped_ptr<HttpStream> stream(NewTestStream("ok.html"));
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, stream->SendRequest(headers,
&response, callback_.callback()));
EXPECT_EQ(ERR_INTERNET_DISCONNECTED,
stream->ReadResponseHeaders(callback_.callback()));
@@ -1516,7 +1512,7 @@ TEST_F(HttpPipelinedConnectionImplTest, OnPipelineHasCapacity) {
EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(1);
HttpRequestHeaders headers;
HttpResponseInfo response;
- EXPECT_EQ(OK, stream->SendRequest(headers, NULL,
+ EXPECT_EQ(OK, stream->SendRequest(headers,
&response, callback_.callback()));
EXPECT_CALL(delegate_, OnPipelineHasCapacity(pipeline_.get())).Times(0);
diff --git a/net/http/http_pipelined_stream.cc b/net/http/http_pipelined_stream.cc
index 9dc85df..236d475 100644
--- a/net/http/http_pipelined_stream.cc
+++ b/net/http/http_pipelined_stream.cc
@@ -35,11 +35,9 @@ int HttpPipelinedStream::InitializeStream(
}
-int HttpPipelinedStream::SendRequest(
- const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
- HttpResponseInfo* response,
- const CompletionCallback& callback) {
+int HttpPipelinedStream::SendRequest(const HttpRequestHeaders& headers,
+ HttpResponseInfo* response,
+ const CompletionCallback& callback) {
CHECK(pipeline_id_);
CHECK(request_info_);
// TODO(simonjam): Proxy support will be needed here.
@@ -47,8 +45,8 @@ int HttpPipelinedStream::SendRequest(
std::string request_line_ = base::StringPrintf("%s %s HTTP/1.1\r\n",
request_info_->method.c_str(),
path.c_str());
- return pipeline_->SendRequest(pipeline_id_, request_line_, headers,
- request_body, response, callback);
+ return pipeline_->SendRequest(pipeline_id_, request_line_, headers, response,
+ callback);
}
UploadProgress HttpPipelinedStream::GetUploadProgress() const {
diff --git a/net/http/http_pipelined_stream.h b/net/http/http_pipelined_stream.h
index 92f2130..6379d7c 100644
--- a/net/http/http_pipelined_stream.h
+++ b/net/http/http_pipelined_stream.h
@@ -22,7 +22,6 @@ struct HttpRequestInfo;
class IOBuffer;
class ProxyInfo;
struct SSLConfig;
-class UploadDataStream;
// HttpPipelinedStream is the pipelined implementation of HttpStream. It has
// very little code in it. Instead, it serves as the client's interface to the
@@ -43,7 +42,6 @@ class HttpPipelinedStream : public HttpStream {
const CompletionCallback& callback) OVERRIDE;
virtual int SendRequest(const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) OVERRIDE;
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 4042a17..83c10ed 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -434,7 +434,7 @@ int HttpProxyClientSocket::DoSendRequest() {
http_stream_parser_.reset(
new HttpStreamParser(transport_.get(), &request_, parser_buf_, net_log_));
return http_stream_parser_->SendRequest(
- request_line_, request_headers_, NULL, &response_, io_callback_);
+ request_line_, request_headers_, &response_, io_callback_);
}
int HttpProxyClientSocket::DoSendRequestComplete(int result) {
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc
index 45d647f..a052cd6 100644
--- a/net/http/http_response_body_drainer_unittest.cc
+++ b/net/http/http_response_body_drainer_unittest.cc
@@ -82,7 +82,6 @@ class MockHttpStream : public HttpStream {
return ERR_UNEXPECTED;
}
virtual int SendRequest(const HttpRequestHeaders& request_headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) OVERRIDE {
return ERR_UNEXPECTED;
diff --git a/net/http/http_stream.h b/net/http/http_stream.h
index 7fe4753..2143057 100644
--- a/net/http/http_stream.h
+++ b/net/http/http_stream.h
@@ -20,7 +20,6 @@
namespace net {
class IOBuffer;
-class UploadDataStream;
class NET_EXPORT_PRIVATE HttpStream : public HttpStreamBase {
public:
diff --git a/net/http/http_stream_base.h b/net/http/http_stream_base.h
index f6a9797..dbf51de 100644
--- a/net/http/http_stream_base.h
+++ b/net/http/http_stream_base.h
@@ -28,7 +28,6 @@ class HttpResponseInfo;
class IOBuffer;
class SSLCertRequestInfo;
class SSLInfo;
-class UploadDataStream;
class NET_EXPORT_PRIVATE HttpStreamBase {
public:
@@ -46,7 +45,6 @@ class NET_EXPORT_PRIVATE HttpStreamBase {
// synchronously, in which case the result will be passed to the callback
// when available. Returns OK on success.
virtual int SendRequest(const HttpRequestHeaders& request_headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) = 0;
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 03c48e3..95e2ba6 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -175,7 +175,6 @@ HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection,
: io_state_(STATE_NONE),
request_(request),
request_headers_(NULL),
- request_body_(NULL),
read_buf_(read_buffer),
read_buf_unused_offset_(0),
response_header_start_offset_(-1),
@@ -197,7 +196,6 @@ HttpStreamParser::~HttpStreamParser() {
int HttpStreamParser::SendRequest(const std::string& request_line,
const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) {
DCHECK_EQ(STATE_NONE, io_state_);
@@ -225,10 +223,9 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
std::string request = request_line + headers.ToString();
- request_body_ = request_body;
- if (request_body_ != NULL) {
+ if (request_->upload_data_stream != NULL) {
request_body_send_buf_ = new SeekableIOBuffer(kRequestBodyBufferSize);
- if (request_body_->is_chunked()) {
+ if (request_->upload_data_stream->is_chunked()) {
// Read buffer is adjusted to guarantee that |request_body_send_buf_| is
// large enough to hold the encoded chunk.
request_body_read_buf_ =
@@ -244,8 +241,8 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
// If we have a small request body, then we'll merge with the headers into a
// single write.
bool did_merge = false;
- if (ShouldMergeRequestHeadersAndBody(request, request_body_)) {
- size_t merged_size = request.size() + request_body_->size();
+ if (ShouldMergeRequestHeadersAndBody(request, request_->upload_data_stream)) {
+ size_t merged_size = request.size() + request_->upload_data_stream->size();
scoped_refptr<IOBuffer> merged_request_headers_and_body(
new IOBuffer(merged_size));
// We'll repurpose |request_headers_| to store the merged headers and
@@ -256,14 +253,15 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
memcpy(request_headers_->data(), request.data(), request.size());
request_headers_->DidConsume(request.size());
- size_t todo = request_body_->size();
+ size_t todo = request_->upload_data_stream->size();
while (todo) {
- int consumed = request_body_->ReadSync(request_headers_, todo);
+ int consumed = request_->upload_data_stream->ReadSync(request_headers_,
+ todo);
DCHECK_GT(consumed, 0); // Read() won't fail if not chunked.
request_headers_->DidConsume(consumed);
todo -= consumed;
}
- DCHECK(request_body_->IsEOF());
+ DCHECK(request_->upload_data_stream->IsEOF());
// Reset the offset, so the buffer can be read from the beginning.
request_headers_->SetOffset(0);
did_merge = true;
@@ -271,7 +269,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
net_log_.AddEvent(
NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_BODY,
base::Bind(&NetLogSendRequestBodyCallback,
- request_body_->size(),
+ request_->upload_data_stream->size(),
false, /* not chunked */
true /* merged */));
}
@@ -427,15 +425,16 @@ int HttpStreamParser::DoSendHeaders(int result) {
result = connection_->socket()->Write(request_headers_,
bytes_remaining,
io_callback_);
- } else if (request_body_ != NULL &&
- (request_body_->is_chunked() ||
+ } else if (request_->upload_data_stream != NULL &&
+ (request_->upload_data_stream->is_chunked() ||
// !IsEOF() indicates that the body wasn't merged.
- (request_body_->size() > 0 && !request_body_->IsEOF()))) {
+ (request_->upload_data_stream->size() > 0 &&
+ !request_->upload_data_stream->IsEOF()))) {
net_log_.AddEvent(
NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_BODY,
base::Bind(&NetLogSendRequestBodyCallback,
- request_body_->size(),
- request_body_->is_chunked(),
+ request_->upload_data_stream->size(),
+ request_->upload_data_stream->is_chunked(),
false /* not merged */));
io_state_ = STATE_SENDING_BODY;
result = OK;
@@ -458,16 +457,16 @@ int HttpStreamParser::DoSendBody(int result) {
io_callback_);
}
- if (request_body_->is_chunked() && sent_last_chunk_) {
+ if (request_->upload_data_stream->is_chunked() && sent_last_chunk_) {
io_state_ = STATE_REQUEST_SENT;
return OK;
}
request_body_read_buf_->Clear();
io_state_ = STATE_SEND_REQUEST_READING_BODY;
- return request_body_->Read(request_body_read_buf_,
- request_body_read_buf_->capacity(),
- io_callback_);
+ return request_->upload_data_stream->Read(request_body_read_buf_,
+ request_body_read_buf_->capacity(),
+ io_callback_);
}
int HttpStreamParser::DoSendRequestReadingBody(int result) {
@@ -476,9 +475,9 @@ int HttpStreamParser::DoSendRequestReadingBody(int result) {
DCHECK_GE(result, 0); // There won't be errors.
// Chunked data needs to be encoded.
- if (request_body_->is_chunked()) {
+ if (request_->upload_data_stream->is_chunked()) {
if (result == 0) { // Reached the end.
- DCHECK(request_body_->IsEOF());
+ DCHECK(request_->upload_data_stream->IsEOF());
sent_last_chunk_ = true;
}
// Encode the buffer as 1 chunk.
@@ -492,8 +491,8 @@ int HttpStreamParser::DoSendRequestReadingBody(int result) {
if (result == 0) { // Reached the end.
// Reaching EOF means we can finish sending request body unless the data is
// chunked. (i.e. No need to send the terminal chunk.)
- DCHECK(request_body_->IsEOF());
- DCHECK(!request_body_->is_chunked());
+ DCHECK(request_->upload_data_stream->IsEOF());
+ DCHECK(!request_->upload_data_stream->is_chunked());
io_state_ = STATE_REQUEST_SENT;
} else if (result > 0) {
request_body_send_buf_->DidAppend(result);
@@ -850,10 +849,11 @@ void HttpStreamParser::CalculateResponseBodySize() {
}
UploadProgress HttpStreamParser::GetUploadProgress() const {
- if (!request_body_)
+ if (!request_->upload_data_stream)
return UploadProgress();
- return UploadProgress(request_body_->position(), request_body_->size());
+ return UploadProgress(request_->upload_data_stream->position(),
+ request_->upload_data_stream->size());
}
HttpResponseInfo* HttpStreamParser::GetResponseInfo() {
diff --git a/net/http/http_stream_parser.h b/net/http/http_stream_parser.h
index 259badf..493165e 100644
--- a/net/http/http_stream_parser.h
+++ b/net/http/http_stream_parser.h
@@ -49,7 +49,6 @@ class NET_EXPORT_PRIVATE HttpStreamParser {
// some additional functionality
int SendRequest(const std::string& request_line,
const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
HttpResponseInfo* response,
const CompletionCallback& callback);
@@ -175,9 +174,6 @@ class NET_EXPORT_PRIVATE HttpStreamParser {
// The request header data.
scoped_refptr<DrainableIOBuffer> request_headers_;
- // The request body data.
- UploadDataStream* request_body_;
-
// Temporary buffer for reading.
scoped_refptr<GrowableIOBuffer> read_buf_;
diff --git a/net/http/http_stream_parser_unittest.cc b/net/http/http_stream_parser_unittest.cc
index 2fb8730..bfe2d46 100644
--- a/net/http/http_stream_parser_unittest.cc
+++ b/net/http/http_stream_parser_unittest.cc
@@ -199,9 +199,8 @@ TEST(HttpStreamParser, AsyncChunkAndAsyncSocket) {
upload_data->AppendChunk(kChunk1, arraysize(kChunk1) - 1, false);
- scoped_ptr<UploadDataStream> upload_stream(
- new UploadDataStream(upload_data));
- ASSERT_EQ(OK, upload_stream->InitSync());
+ UploadDataStream upload_stream(upload_data);
+ ASSERT_EQ(OK, upload_stream.InitSync());
DeterministicSocketData data(reads, arraysize(reads),
writes, arraysize(writes));
@@ -223,6 +222,7 @@ TEST(HttpStreamParser, AsyncChunkAndAsyncSocket) {
request_info.method = "GET";
request_info.url = GURL("http://localhost");
request_info.load_flags = LOAD_NORMAL;
+ request_info.upload_data_stream = &upload_stream;
scoped_refptr<GrowableIOBuffer> read_buffer(new GrowableIOBuffer);
HttpStreamParser parser(socket_handle.get(), &request_info, read_buffer,
@@ -237,8 +237,7 @@ TEST(HttpStreamParser, AsyncChunkAndAsyncSocket) {
// This will attempt to Write() the initial request and headers, which will
// complete asynchronously.
rv = parser.SendRequest("GET /one.html HTTP/1.1\r\n", request_headers,
- upload_stream.get(), &response_info,
- callback.callback());
+ &response_info, callback.callback());
ASSERT_EQ(ERR_IO_PENDING, rv);
// Complete the initial request write. Additionally, this should enqueue the