| Index: net/spdy/spdy_network_transaction_spdy2_unittest.cc
|
| diff --git a/net/spdy/spdy_network_transaction_spdy2_unittest.cc b/net/spdy/spdy_network_transaction_spdy2_unittest.cc
|
| index a52859f810bf86cadfc026b5af4efb29c3ca4fc5..d983093224a94f4fa3e2ec9c3914483c34e9b1c4 100644
|
| --- a/net/spdy/spdy_network_transaction_spdy2_unittest.cc
|
| +++ b/net/spdy/spdy_network_transaction_spdy2_unittest.cc
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| +#include "base/memory/scoped_vector.h"
|
| #include "net/base/auth.h"
|
| #include "net/base/net_log_unittest.h"
|
| #include "net/http/http_network_session_peer.h"
|
| @@ -229,24 +230,24 @@ class SpdyNetworkTransactionSpdy2Test
|
| void AddData(StaticSocketDataProvider* data) {
|
| DCHECK(!deterministic_);
|
| data_vector_.push_back(data);
|
| - linked_ptr<SSLSocketDataProvider> ssl_(
|
| - new SSLSocketDataProvider(ASYNC, OK));
|
| - if (test_type_ == SPDYNPN) {
|
| - ssl_->SetNextProto(kProtoSPDY2);
|
| - }
|
| - ssl_vector_.push_back(ssl_);
|
| + SSLSocketDataProvider* ssl_provider =
|
| + new SSLSocketDataProvider(ASYNC, OK);
|
| + if (test_type_ == SPDYNPN)
|
| + ssl_provider->SetNextProto(kProtoSPDY2);
|
| +
|
| + ssl_vector_.push_back(ssl_provider);
|
| if (test_type_ == SPDYNPN || test_type_ == SPDYSSL)
|
| - session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get());
|
| + session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_provider);
|
| +
|
| session_deps_->socket_factory->AddSocketDataProvider(data);
|
| if (test_type_ == SPDYNPN) {
|
| MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
|
| - linked_ptr<StaticSocketDataProvider>
|
| - hanging_non_alternate_protocol_socket(
|
| - new StaticSocketDataProvider(NULL, 0, NULL, 0));
|
| + StaticSocketDataProvider* hanging_non_alternate_protocol_socket =
|
| + new StaticSocketDataProvider(NULL, 0, NULL, 0);
|
| hanging_non_alternate_protocol_socket->set_connect_data(
|
| never_finishing_connect);
|
| session_deps_->socket_factory->AddSocketDataProvider(
|
| - hanging_non_alternate_protocol_socket.get());
|
| + hanging_non_alternate_protocol_socket);
|
| alternate_vector_.push_back(hanging_non_alternate_protocol_socket);
|
| }
|
| }
|
| @@ -254,22 +255,21 @@ class SpdyNetworkTransactionSpdy2Test
|
| void AddDeterministicData(DeterministicSocketData* data) {
|
| DCHECK(deterministic_);
|
| data_vector_.push_back(data);
|
| - linked_ptr<SSLSocketDataProvider> ssl_(
|
| - new SSLSocketDataProvider(ASYNC, OK));
|
| - if (test_type_ == SPDYNPN) {
|
| - ssl_->SetNextProto(kProtoSPDY2);
|
| - }
|
| - ssl_vector_.push_back(ssl_);
|
| + SSLSocketDataProvider* ssl_provider =
|
| + new SSLSocketDataProvider(ASYNC, OK);
|
| + if (test_type_ == SPDYNPN)
|
| + ssl_provider->SetNextProto(kProtoSPDY2);
|
| +
|
| + ssl_vector_.push_back(ssl_provider);
|
| if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) {
|
| session_deps_->deterministic_socket_factory->
|
| - AddSSLSocketDataProvider(ssl_.get());
|
| + AddSSLSocketDataProvider(ssl_provider);
|
| }
|
| session_deps_->deterministic_socket_factory->AddSocketDataProvider(data);
|
| if (test_type_ == SPDYNPN) {
|
| MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
|
| - scoped_refptr<DeterministicSocketData>
|
| - hanging_non_alternate_protocol_socket(
|
| - new DeterministicSocketData(NULL, 0, NULL, 0));
|
| + DeterministicSocketData* hanging_non_alternate_protocol_socket =
|
| + new DeterministicSocketData(NULL, 0, NULL, 0);
|
| hanging_non_alternate_protocol_socket->set_connect_data(
|
| never_finishing_connect);
|
| session_deps_->deterministic_socket_factory->AddSocketDataProvider(
|
| @@ -310,10 +310,9 @@ class SpdyNetworkTransactionSpdy2Test
|
|
|
| private:
|
| typedef std::vector<StaticSocketDataProvider*> DataVector;
|
| - typedef std::vector<linked_ptr<SSLSocketDataProvider> > SSLVector;
|
| - typedef std::vector<linked_ptr<StaticSocketDataProvider> > AlternateVector;
|
| - typedef std::vector<scoped_refptr<DeterministicSocketData> >
|
| - AlternateDeterministicVector;
|
| + typedef ScopedVector<SSLSocketDataProvider> SSLVector;
|
| + typedef ScopedVector<StaticSocketDataProvider> AlternateVector;
|
| + typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector;
|
| HttpRequestInfo request_;
|
| scoped_ptr<SpdySessionDependencies> session_deps_;
|
| scoped_refptr<HttpNetworkSession> session_;
|
| @@ -1773,14 +1772,15 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SocketWriteReturnsZero) {
|
| MockRead(ASYNC, 0, 0, 4) // EOF
|
| };
|
|
|
| - scoped_refptr<DeterministicSocketData> data(
|
| + DeterministicSocketData* data =
|
| new DeterministicSocketData(reads, arraysize(reads),
|
| - writes, arraysize(writes)));
|
| + writes, arraysize(writes));
|
| +
|
| NormalSpdyTransactionHelper helper(CreateGetRequest(),
|
| BoundNetLog(), GetParam(), NULL);
|
| helper.SetDeterministic();
|
| helper.RunPreTestSetup();
|
| - helper.AddDeterministicData(data.get());
|
| + helper.AddDeterministicData(data);
|
| HttpNetworkTransaction* trans = helper.trans();
|
|
|
| TestCompletionCallback callback;
|
| @@ -1981,16 +1981,16 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransactionSendRst) {
|
| MockRead(ASYNC, 0, 0, 3) // EOF
|
| };
|
|
|
| - scoped_refptr<DeterministicSocketData> data(
|
| + DeterministicSocketData* data =
|
| new DeterministicSocketData(reads, arraysize(reads),
|
| - writes, arraysize(writes)));
|
| + writes, arraysize(writes));
|
|
|
| NormalSpdyTransactionHelper helper(CreateGetRequest(),
|
| BoundNetLog(),
|
| GetParam(), NULL);
|
| helper.SetDeterministic();
|
| helper.RunPreTestSetup();
|
| - helper.AddDeterministicData(data.get());
|
| + helper.AddDeterministicData(data);
|
| HttpNetworkTransaction* trans = helper.trans();
|
|
|
| TestCompletionCallback callback;
|
| @@ -4986,16 +4986,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) {
|
| HttpResponseInfo response;
|
| HttpResponseInfo response2;
|
| std::string expected_push_result("pushed");
|
| - scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData(
|
| - reads,
|
| - arraysize(reads),
|
| - writes,
|
| - arraysize(writes)));
|
| + DeterministicSocketData* data =
|
| + new DeterministicSocketData(reads, arraysize(reads),
|
| + writes, arraysize(writes));
|
|
|
| NormalSpdyTransactionHelper helper(CreateGetRequest(),
|
| BoundNetLog(), GetParam(), NULL);
|
| helper.SetDeterministic();
|
| - helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data));
|
| + helper.AddDeterministicData(data);
|
| helper.RunPreTestSetup();
|
|
|
| HttpNetworkTransaction* trans = helper.trans();
|
| @@ -5026,7 +5024,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) {
|
|
|
| // Read the server push body.
|
| std::string result2;
|
| - ReadResult(trans2.get(), data.get(), &result2);
|
| + ReadResult(trans2.get(), data, &result2);
|
| // Read the response body.
|
| std::string result;
|
| ReadResult(trans, data, &result);
|
| @@ -5137,16 +5135,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithTwoHeaderFrames) {
|
| HttpResponseInfo response;
|
| HttpResponseInfo response2;
|
| std::string expected_push_result("pushed");
|
| - scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData(
|
| - reads,
|
| - arraysize(reads),
|
| - writes,
|
| - arraysize(writes)));
|
| + DeterministicSocketData* data =
|
| + new DeterministicSocketData(reads, arraysize(reads),
|
| + writes, arraysize(writes));
|
|
|
| NormalSpdyTransactionHelper helper(CreateGetRequest(),
|
| BoundNetLog(), GetParam(), NULL);
|
| helper.SetDeterministic();
|
| - helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data));
|
| + helper.AddDeterministicData(data);
|
| helper.RunPreTestSetup();
|
|
|
| HttpNetworkTransaction* trans = helper.trans();
|
| @@ -5591,14 +5587,15 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, OutOfOrderSynStream) {
|
| MockRead(ASYNC, 0, 9) // EOF
|
| };
|
|
|
| - scoped_refptr<DeterministicSocketData> data(
|
| + DeterministicSocketData* data =
|
| new DeterministicSocketData(reads, arraysize(reads),
|
| - writes, arraysize(writes)));
|
| + writes, arraysize(writes));
|
| +
|
| NormalSpdyTransactionHelper helper(CreateGetRequest(),
|
| BoundNetLog(), GetParam(), NULL);
|
| helper.SetDeterministic();
|
| helper.RunPreTestSetup();
|
| - helper.AddDeterministicData(data.get());
|
| + helper.AddDeterministicData(data);
|
|
|
| // Start the first transaction to set up the SpdySession
|
| HttpNetworkTransaction* trans = helper.trans();
|
|
|