diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 23:44:57 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 23:44:57 +0000 |
commit | dd54bd86ae45868728991c656afd46237dd1efdd (patch) | |
tree | 24533f32d9590d6430de47c162b679a639ecd1f3 /net/spdy | |
parent | c9bdcbdb323f5f7ca6d06f8c3e6426a9074d72b5 (diff) | |
download | chromium_src-dd54bd86ae45868728991c656afd46237dd1efdd.zip chromium_src-dd54bd86ae45868728991c656afd46237dd1efdd.tar.gz chromium_src-dd54bd86ae45868728991c656afd46237dd1efdd.tar.bz2 |
Remove most usages of scoped_ptr<*SocketData> in net unittests.
This anti-pattern simply complicates tests and adds no value.
Review URL: https://chromiumcodereview.appspot.com/10809022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r-- | net/spdy/spdy_http_stream_spdy2_unittest.cc | 25 | ||||
-rw-r--r-- | net/spdy/spdy_http_stream_spdy3_unittest.cc | 59 | ||||
-rw-r--r-- | net/spdy/spdy_network_transaction_spdy2_unittest.cc | 758 | ||||
-rw-r--r-- | net/spdy/spdy_network_transaction_spdy3_unittest.cc | 812 | ||||
-rw-r--r-- | net/spdy/spdy_stream_spdy2_unittest.cc | 25 | ||||
-rw-r--r-- | net/spdy/spdy_stream_spdy3_unittest.cc | 25 |
6 files changed, 738 insertions, 966 deletions
diff --git a/net/spdy/spdy_http_stream_spdy2_unittest.cc b/net/spdy/spdy_http_stream_spdy2_unittest.cc index e78c8d7..58461ab 100644 --- a/net/spdy/spdy_http_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_http_stream_spdy2_unittest.cc @@ -213,13 +213,12 @@ TEST_F(SpdyHttpStreamSpdy2Test, DelayedSendChunkedPost) { HostPortPair host_port_pair("www.google.com", 80); HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); DeterministicMockClientSocketFactory* socket_factory = session_deps_.deterministic_socket_factory.get(); - socket_factory->AddSocketDataProvider(data.get()); + socket_factory->AddSocketDataProvider(&data); http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( &session_deps_); @@ -276,7 +275,7 @@ TEST_F(SpdyHttpStreamSpdy2Test, DelayedSendChunkedPost) { EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); // Complete the initial request write and the first chunk. - data->RunFor(2); + data.RunFor(2); ASSERT_TRUE(callback.have_result()); EXPECT_GT(callback.WaitForResult(), 0); @@ -285,14 +284,14 @@ TEST_F(SpdyHttpStreamSpdy2Test, DelayedSendChunkedPost) { request.upload_data->AppendChunk(kUploadData, kUploadDataSize, true); // Finish writing all the chunks. - data->RunFor(2); + data.RunFor(2); // Read response headers. - data->RunFor(1); + data.RunFor(1); ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); // Read and check |chunk1| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize)); ASSERT_EQ(kUploadDataSize, http_stream->ReadResponseBody(buf1, @@ -301,7 +300,7 @@ TEST_F(SpdyHttpStreamSpdy2Test, DelayedSendChunkedPost) { EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); // Read and check |chunk2| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf2(new IOBuffer(kUploadData1Size)); ASSERT_EQ(kUploadData1Size, http_stream->ReadResponseBody(buf2, @@ -310,7 +309,7 @@ TEST_F(SpdyHttpStreamSpdy2Test, DelayedSendChunkedPost) { EXPECT_EQ(kUploadData1, std::string(buf2->data(), kUploadData1Size)); // Read and check |chunk3| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf3(new IOBuffer(kUploadDataSize)); ASSERT_EQ(kUploadDataSize, http_stream->ReadResponseBody(buf3, @@ -319,11 +318,11 @@ TEST_F(SpdyHttpStreamSpdy2Test, DelayedSendChunkedPost) { EXPECT_EQ(kUploadData, std::string(buf3->data(), kUploadDataSize)); // Finish reading the |EOF|. - data->RunFor(1); + data.RunFor(1); ASSERT_TRUE(response.headers.get()); ASSERT_EQ(200, response.headers->response_code()); - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); } // Test case for bug: http://code.google.com/p/chromium/issues/detail?id=50058 diff --git a/net/spdy/spdy_http_stream_spdy3_unittest.cc b/net/spdy/spdy_http_stream_spdy3_unittest.cc index f5e4b99..4903801 100644 --- a/net/spdy/spdy_http_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_http_stream_spdy3_unittest.cc @@ -221,13 +221,12 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPost) { HostPortPair host_port_pair("www.google.com", 80); HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); DeterministicMockClientSocketFactory* socket_factory = session_deps_.deterministic_socket_factory.get(); - socket_factory->AddSocketDataProvider(data.get()); + socket_factory->AddSocketDataProvider(&data); http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( &session_deps_); @@ -284,7 +283,7 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPost) { EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); // Complete the initial request write and the first chunk. - data->RunFor(2); + data.RunFor(2); ASSERT_TRUE(callback.have_result()); EXPECT_GT(callback.WaitForResult(), 0); @@ -293,14 +292,14 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPost) { request.upload_data->AppendChunk(kUploadData, kUploadDataSize, true); // Finish writing all the chunks. - data->RunFor(2); + data.RunFor(2); // Read response headers. - data->RunFor(1); + data.RunFor(1); ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); // Read and check |chunk1| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize)); ASSERT_EQ(kUploadDataSize, http_stream->ReadResponseBody(buf1, @@ -309,7 +308,7 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPost) { EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); // Read and check |chunk2| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf2(new IOBuffer(kUploadData1Size)); ASSERT_EQ(kUploadData1Size, http_stream->ReadResponseBody(buf2, @@ -318,7 +317,7 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPost) { EXPECT_EQ(kUploadData1, std::string(buf2->data(), kUploadData1Size)); // Read and check |chunk3| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf3(new IOBuffer(kUploadDataSize)); ASSERT_EQ(kUploadDataSize, http_stream->ReadResponseBody(buf3, @@ -327,11 +326,11 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPost) { EXPECT_EQ(kUploadData, std::string(buf3->data(), kUploadDataSize)); // Finish reading the |EOF|. - data->RunFor(1); + data.RunFor(1); ASSERT_TRUE(response.headers.get()); ASSERT_EQ(200, response.headers->response_code()); - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); } // Test the receipt of a WINDOW_UPDATE frame while waiting for a chunk to be @@ -358,13 +357,12 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPostWithWindowUpdate) { HostPortPair host_port_pair("www.google.com", 80); HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); DeterministicMockClientSocketFactory* socket_factory = session_deps_.deterministic_socket_factory.get(); - socket_factory->AddSocketDataProvider(data.get()); + socket_factory->AddSocketDataProvider(&data); http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( &session_deps_); @@ -421,7 +419,7 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPostWithWindowUpdate) { EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); // Complete the initial request write and first chunk. - data->RunFor(2); + data.RunFor(2); ASSERT_TRUE(callback.have_result()); EXPECT_GT(callback.WaitForResult(), 0); @@ -431,7 +429,7 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPostWithWindowUpdate) { http_stream->stream()->send_window_size()); // Read window update. - data->RunFor(1); + data.RunFor(1); // Verify the window update. ASSERT_TRUE(http_stream->stream() != NULL); @@ -439,11 +437,11 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPostWithWindowUpdate) { http_stream->stream()->send_window_size()); // Read response headers. - data->RunFor(1); + data.RunFor(1); ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); // Read and check |chunk1| response. - data->RunFor(1); + data.RunFor(1); scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize)); ASSERT_EQ(kUploadDataSize, http_stream->ReadResponseBody(buf1, @@ -452,11 +450,11 @@ TEST_F(SpdyHttpStreamSpdy3Test, DelayedSendChunkedPostWithWindowUpdate) { EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); // Finish reading the |EOF|. - data->RunFor(1); + data.RunFor(1); ASSERT_TRUE(response.headers.get()); ASSERT_EQ(200, response.headers->response_code()); - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); } // Test case for bug: http://code.google.com/p/chromium/issues/detail?id=50058 @@ -651,10 +649,9 @@ void SpdyHttpStreamSpdy3Test::TestSendCredentials( DeterministicMockClientSocketFactory* socket_factory = session_deps_.deterministic_socket_factory.get(); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - socket_factory->AddSocketDataProvider(data.get()); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + socket_factory->AddSocketDataProvider(&data); SSLSocketDataProvider ssl(SYNCHRONOUS, OK); ssl.channel_id_sent = true; ssl.server_bound_cert_service = server_bound_cert_service; @@ -714,7 +711,7 @@ void SpdyHttpStreamSpdy3Test::TestSendCredentials( &response, callback.callback())); EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair)); - data->RunFor(2); + data.RunFor(2); callback.WaitForResult(); // Start up second request for resource on a new origin. @@ -727,12 +724,12 @@ void SpdyHttpStreamSpdy3Test::TestSendCredentials( EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers, scoped_ptr<UploadDataStream>(), &response, callback.callback())); - data->RunFor(2); + data.RunFor(2); callback.WaitForResult(); EXPECT_EQ(ERR_IO_PENDING, http_stream2->ReadResponseHeaders( callback.callback())); - data->RunFor(1); + data.RunFor(1); EXPECT_EQ(OK, callback.WaitForResult()); ASSERT_TRUE(response.headers.get() != NULL); ASSERT_EQ(200, response.headers->response_code()); diff --git a/net/spdy/spdy_network_transaction_spdy2_unittest.cc b/net/spdy/spdy_network_transaction_spdy2_unittest.cc index 53fe545..639c818 100644 --- a/net/spdy/spdy_network_transaction_spdy2_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy2_unittest.cc @@ -550,12 +550,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Get) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -600,15 +599,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, GetAtEachPriority) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); HttpRequestInfo http_req = CreateGetRequest(); http_req.priority = p; NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -661,22 +659,20 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGets) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -745,25 +741,23 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, TwoGetsLateBinding) { CreateMockRead(*fbody2), MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); - data_placeholder->set_connect_data(never_finishing_connect); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); + data_placeholder.set_connect_data(never_finishing_connect); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because two get requests are sent out, so // there needs to be two sets of SSL connection data. - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -832,26 +826,24 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, TwoGetsLateBindingFromPreconnect) { CreateMockRead(*fbody2), MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> preconnect_data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData preconnect_data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect never_finishing_connect(ASYNC, ERR_IO_PENDING); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); - data_placeholder->set_connect_data(never_finishing_connect); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); + data_placeholder.set_connect_data(never_finishing_connect); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(preconnect_data.get()); + helper.AddData(&preconnect_data); // We require placeholder data because 3 connections are attempted (first is // the preconnect, 2nd and 3rd are the never finished connections. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); @@ -957,11 +949,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrent) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; @@ -969,11 +959,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrent) { NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -1002,7 +992,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrent) { ASSERT_EQ(out.rv, ERR_IO_PENDING); out.rv = callback2.WaitForResult(); ASSERT_EQ(OK, out.rv); - EXPECT_EQ(7U, data->read_index()); // i.e. the third trans was queued + EXPECT_EQ(7U, data.read_index()); // i.e. the third trans was queued out.rv = callback3.WaitForResult(); ASSERT_EQ(OK, out.rv); @@ -1094,23 +1084,21 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, FourGetsWithMaxConcurrentPriority) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because four get requests are sent out, so // there needs to be four sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -1146,7 +1134,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, FourGetsWithMaxConcurrentPriority) { out.rv = callback2.WaitForResult(); ASSERT_EQ(OK, out.rv); - EXPECT_EQ(data->read_index(), 7U); // i.e. the third & fourth trans queued + EXPECT_EQ(data.read_index(), 7U); // i.e. the third & fourth trans queued out.rv = callback3.WaitForResult(); ASSERT_EQ(OK, out.rv); @@ -1228,22 +1216,20 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentDelete) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -1273,7 +1259,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentDelete) { out.rv = callback2.WaitForResult(); ASSERT_EQ(OK, out.rv); - EXPECT_EQ(8U, data->read_index()); + EXPECT_EQ(8U, data.read_index()); const HttpResponseInfo* response1 = trans1->GetResponseInfo(); ASSERT_TRUE(response1 != NULL); @@ -1359,22 +1345,20 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentSocketClose) { MockRead(ASYNC, ERR_CONNECTION_RESET, 0), // Abort! }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); HttpNetworkTransaction trans1(helper.session()); HttpNetworkTransaction trans2(helper.session()); HttpNetworkTransaction* trans3(new HttpNetworkTransaction(helper.session())); @@ -1400,7 +1384,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ThreeGetsWithMaxConcurrentSocketClose) { out.rv = callback3.WaitForResult(); ASSERT_EQ(ERR_ABORTED, out.rv); - EXPECT_EQ(6U, data->read_index()); + EXPECT_EQ(6U, data.read_index()); const HttpResponseInfo* response1 = trans1.GetResponseInfo(); ASSERT_TRUE(response1 != NULL); @@ -1480,12 +1464,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Put) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1551,12 +1534,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Head) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1579,12 +1561,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Post) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(2, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreatePostRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1612,12 +1593,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ChunkedPost) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(2, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1650,13 +1630,12 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, NullPost) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1697,13 +1676,12 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, EmptyPost) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1736,12 +1714,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, PostWithEarlySynReply) { MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(0, reads, arraysize(reads), NULL, 0)); + DelayedSocketData data(0, reads, arraysize(reads), NULL, 0); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunDefaultTest(); helper.VerifyDataConsumed(); @@ -1768,14 +1745,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SocketWriteReturnsZero) { MockRead(ASYNC, 0, 0, 4) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + 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; @@ -1783,11 +1759,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SocketWriteReturnsZero) { &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->SetStop(2); - data->Run(); + data.SetStop(2); + data.Run(); helper.ResetTrans(); - data->SetStop(20); - data->Run(); + data.SetStop(20); + data.Run(); helper.VerifyDataConsumed(); } @@ -1800,11 +1776,10 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResponseWithoutSynReply) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), NULL, 0)); + DelayedSocketData data(1, reads, arraysize(reads), NULL, 0); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); } @@ -1824,14 +1799,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResponseWithTwoSynReplies) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -1872,12 +1846,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResetReplyWithTransferEncoding) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -1907,12 +1880,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ResetPushWithTransferEncoding) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1976,16 +1948,15 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransactionSendRst) { MockRead(ASYNC, 0, 0, 3) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + 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; @@ -1994,11 +1965,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CancelledTransactionSendRst) { &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->SetStop(2); - data->Run(); + data.SetStop(2); + data.Run(); helper.ResetTrans(); - data->SetStop(20); - data->Run(); + data.SetStop(20); + data.Run(); helper.VerifyDataConsumed(); } @@ -2034,18 +2005,16 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, StartTransactionOnReadCallback) { MockRead(ASYNC, 0, 0, 3), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<DelayedSocketData> data2( - new DelayedSocketData(1, reads2, arraysize(reads2), - writes2, arraysize(writes2))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + DelayedSocketData data2(1, reads2, arraysize(reads2), + writes2, arraysize(writes2)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); - helper.AddData(data2.get()); + helper.AddData(&data); + helper.AddData(&data2); HttpNetworkTransaction* trans = helper.trans(); // Start the transaction with basic parameters. @@ -2061,9 +2030,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, StartTransactionOnReadCallback) { base::Bind(&SpdyNetworkTransactionSpdy2Test::StartTransactionCallback, helper.session())); // This forces an err_IO_pending, which sets the callback. - data->CompleteRead(); + data.CompleteRead(); // This finishes the read. - data->CompleteRead(); + data.CompleteRead(); helper.VerifyDataConsumed(); } @@ -2083,14 +2052,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DeleteSessionOnReadCallback) { MockRead(ASYNC, 0, 0, 5), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); // Start the transaction with basic parameters. @@ -2108,7 +2076,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DeleteSessionOnReadCallback) { base::Bind(&SpdyNetworkTransactionSpdy2Test::DeleteSessionCallback, base::Unretained(&helper))); ASSERT_EQ(ERR_IO_PENDING, rv); - data->CompleteRead(); + data.CompleteRead(); // Finish running rest of tasks. MessageLoop::current()->RunAllPending(); @@ -2179,12 +2147,10 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectGetRequest) { CreateMockRead(*body2, 3), MockRead(ASYNC, 0, 0, 4) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data2( - new OrderedSocketData(reads2, arraysize(reads2), - writes2, arraysize(writes2))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data2(reads2, arraysize(reads2), + writes2, arraysize(writes2)); // TODO(erikchen): Make test support SPDYSSL, SPDYNPN HttpStreamFactory::set_force_spdy_over_ssl(false); @@ -2195,9 +2161,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectGetRequest) { net::URLRequest r( GURL("http://www.google.com/"), &d, &spdy_url_request_context); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data.get()); + AddSocketDataProvider(&data); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data2.get()); + AddSocketDataProvider(&data2); d.set_quit_on_redirect(true); r.Start(); @@ -2213,10 +2179,10 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectGetRequest) { std::string contents("hello!"); EXPECT_EQ(contents, d.data_received()); } - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); - EXPECT_TRUE(data2->at_read_eof()); - EXPECT_TRUE(data2->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); + EXPECT_TRUE(data2.at_read_eof()); + EXPECT_TRUE(data2.at_write_eof()); } // Detect response with upper case headers and reset the stream. @@ -2240,14 +2206,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeaders) { HttpResponseInfo response; HttpResponseInfo response2; - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -2301,12 +2264,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeadersInHeadersFrame) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -2337,14 +2299,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, UpperCaseHeadersOnPush) { HttpResponseInfo response; HttpResponseInfo response2; - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); } @@ -2434,12 +2393,10 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { CreateMockRead(*body2, 3), MockRead(ASYNC, 0, 0, 5) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data2( - new OrderedSocketData(reads2, arraysize(reads2), - writes2, arraysize(writes2))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data2(reads2, arraysize(reads2), + writes2, arraysize(writes2)); // TODO(erikchen): Make test support SPDYSSL, SPDYNPN HttpStreamFactory::set_force_spdy_over_ssl(false); @@ -2451,7 +2408,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { net::URLRequest r( GURL("http://www.google.com/"), &d, &spdy_url_request_context); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data.get()); + AddSocketDataProvider(&data); r.Start(); MessageLoop::current()->Run(); @@ -2463,7 +2420,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { net::URLRequest r2( GURL("http://www.google.com/foo.dat"), &d2, &spdy_url_request_context); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data2.get()); + AddSocketDataProvider(&data2); d2.set_quit_on_redirect(true); r2.Start(); @@ -2478,12 +2435,12 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RedirectServerPush) { std::string contents2("hello!"); EXPECT_EQ(contents2, d2.data_received()); } - data->CompleteRead(); - data2->CompleteRead(); - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); - EXPECT_TRUE(data2->at_read_eof()); - EXPECT_TRUE(data2->at_write_eof()); + data.CompleteRead(); + data2.CompleteRead(); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); + EXPECT_TRUE(data2.at_read_eof()); + EXPECT_TRUE(data2.at_write_eof()); } TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushSingleDataFrame) { @@ -2520,12 +2477,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushSingleDataFrame) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -2573,12 +2527,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushBeforeSynReply) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -2626,12 +2577,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushSingleDataFrame2) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -2672,14 +2620,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushServerAborted) { MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -2692,14 +2639,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushServerAborted) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -2754,12 +2701,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushDuplicate) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -2817,12 +2761,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushMultipleDataFrame) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed my darling hello my baby"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -2882,12 +2823,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed my darling hello my baby"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -2928,14 +2866,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID0) { MockRead(ASYNC, ERR_IO_PENDING, 5) // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -2948,14 +2885,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID0) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -2990,14 +2927,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID9) { MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -3010,14 +2946,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushInvalidAssociatedStreamID9) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -3048,14 +2984,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushNoURL) { MockRead(ASYNC, ERR_IO_PENDING, 5) // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -3067,14 +3002,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushNoURL) { rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -3137,12 +3072,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -3285,12 +3219,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyHeadersVary) { request.extra_headers.SetHeader(header_key, header_value); } - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv) << i; @@ -3390,12 +3323,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, InvalidSynReply) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_INCOMPLETE_SPDY_HEADERS, out.rv); } @@ -3429,12 +3361,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CorruptFrameSessionError) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -3450,15 +3381,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, WriteError) { MockWrite(ASYNC, ERR_FAILED), }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, NULL, 0, - writes, arraysize(writes))); + DelayedSocketData data(2, NULL, 0, + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_FAILED, out.rv); - data->Reset(); + data.Reset(); } // Test that partial writes work. @@ -3476,12 +3406,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, PartialWrite) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(kChunks, reads, arraysize(reads), - writes.get(), kChunks)); + DelayedSocketData data(kChunks, reads, arraysize(reads), + writes.get(), kChunks); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -3508,15 +3437,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DecompressFailureOnSynReply) { CreateMockRead(*resp), }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); - data->Reset(); + data.Reset(); } // Test that the NetLog contains good data for a simple GET request. @@ -3538,12 +3466,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, NetLog) { CapturingBoundNetLog log; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequestWithUserAgent(), log.bound(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -3640,17 +3567,15 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferFull) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); - + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); TestCompletionCallback callback; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); int rv = trans->Start( &CreateGetRequest(), callback.callback(), BoundNetLog()); @@ -3676,7 +3601,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferFull) { scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { - data->CompleteRead(); + data.CompleteRead(); rv = read_callback.WaitForResult(); } if (rv > 0) { @@ -3733,14 +3658,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Buffering) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -3769,7 +3693,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, Buffering) { scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { - data->CompleteRead(); + data.CompleteRead(); rv = read_callback.WaitForResult(); } if (rv > 0) { @@ -3829,14 +3753,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedAll) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -3918,14 +3841,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedClosed) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -3955,7 +3877,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedClosed) { scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { - data->CompleteRead(); + data.CompleteRead(); rv = read_callback.WaitForResult(); } if (rv > 0) { @@ -3999,14 +3921,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedCancelled) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4033,7 +3954,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, BufferedCancelled) { rv = trans->Read(buf, kReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { // Complete the read now, which causes buffering to start. - data->CompleteRead(); + data.CompleteRead(); // Destroy the transaction, causing the stream to get cancelled // and orphaning the buffered IO task. helper.ResetTrans(); @@ -4124,10 +4045,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); - helper.AddData(data.get()); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); + helper.AddData(&data); helper.RunDefaultTest(); helper.VerifyDataConsumed(); TransactionHelperResult out = helper.output(); @@ -4240,10 +4160,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsPlayback) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, reads, arraysize(reads), - writes, arraysize(writes))); - helper.AddData(data.get()); + DelayedSocketData data(2, reads, arraysize(reads), + writes, arraysize(writes)); + helper.AddData(&data); helper.RunDefaultTest(); helper.VerifyDataConsumed(); TransactionHelperResult out = helper.output(); @@ -4284,13 +4203,12 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, GoAwayWithActiveStream) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); - helper.RunToCompletion(data.get()); + helper.AddData(&data); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_ABORTED, out.rv); } @@ -4305,14 +4223,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, CloseWithActiveStream) { MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); BoundNetLog log; NormalSpdyTransactionHelper helper(CreateGetRequest(), log, GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4467,10 +4384,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DirectConnectProxyReconnect) { MockRead(ASYNC, ERR_IO_PENDING, 4), // Force a pause MockRead(ASYNC, 0, 5) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - helper.AddData(data.get()); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4605,7 +4521,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, DirectConnectProxyReconnect) { ASSERT_EQ(OK, ReadTransaction(trans_proxy, &response_data)); EXPECT_EQ("hello!", response_data); - data->CompleteRead(); + data.CompleteRead(); helper_proxy.VerifyDataConsumed(); } @@ -4641,18 +4557,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, VerifyRetryOnConnectionReset) { for (int variant = VARIANT_RST_DURING_SEND_COMPLETION; variant <= VARIANT_RST_DURING_READ_COMPLETION; ++variant) { - scoped_ptr<DelayedSocketData> data1( - new DelayedSocketData(1, reads, arraysize(reads), - NULL, 0)); + DelayedSocketData data1(1, reads, arraysize(reads), NULL, 0); - scoped_ptr<DelayedSocketData> data2( - new DelayedSocketData(1, reads2, arraysize(reads2), - NULL, 0)); + DelayedSocketData data2(1, reads2, arraysize(reads2), NULL, 0); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.AddData(data1.get()); - helper.AddData(data2.get()); + helper.AddData(&data1); + helper.AddData(&data2); helper.RunPreTestSetup(); for (int i = 0; i < 2; ++i) { @@ -4672,9 +4584,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, VerifyRetryOnConnectionReset) { } // Now schedule the ERR_CONNECTION_RESET. - EXPECT_EQ(3u, data1->read_index()); - data1->CompleteRead(); - EXPECT_EQ(4u, data1->read_index()); + EXPECT_EQ(3u, data1.read_index()); + data1.CompleteRead(); + EXPECT_EQ(4u, data1.read_index()); } rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -4708,13 +4620,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SpdyOnOffToggle) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, - spdy_reads, arraysize(spdy_reads), - spdy_writes, arraysize(spdy_writes))); + DelayedSocketData data(1, spdy_reads, arraysize(spdy_reads), + spdy_writes, arraysize(spdy_writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -4726,13 +4636,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SpdyOnOffToggle) { MockRead("hello from http"), MockRead(SYNCHRONOUS, OK), }; - scoped_ptr<DelayedSocketData> data2( - new DelayedSocketData(1, http_reads, arraysize(http_reads), - NULL, 0)); + DelayedSocketData data2(1, http_reads, arraysize(http_reads), NULL, 0); NormalSpdyTransactionHelper helper2(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper2.SetSpdyDisabled(); - helper2.RunToCompletion(data2.get()); + helper2.RunToCompletion(&data2); TransactionHelperResult out2 = helper2.output(); EXPECT_EQ(OK, out2.rv); EXPECT_EQ("HTTP/1.1 200 OK", out2.status_line); @@ -4788,15 +4696,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SpdyBasicAuth) { MockRead(ASYNC, 0, 7), }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(spdy_reads, arraysize(spdy_reads), - spdy_writes, arraysize(spdy_writes))); + OrderedSocketData data(spdy_reads, arraysize(spdy_reads), + spdy_writes, arraysize(spdy_writes)); HttpRequestInfo request(CreateGetRequest()); BoundNetLog net_log; NormalSpdyTransactionHelper helper(request, net_log, GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; const int rv_start = trans->Start(&request, callback.callback(), net_log); @@ -4897,12 +4804,9 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithHeaders) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -4981,14 +4885,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); - helper.AddDeterministicData(data.get()); + helper.AddDeterministicData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -4996,14 +4899,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) { // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, // and the body of the primary stream, but before we've received the HEADERS // for the pushed stream. - data->SetStop(3); + data.SetStop(3); // Start the transaction. TestCompletionCallback callback; int rv = trans->Start( &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->Run(); + data.Run(); rv = callback.WaitForResult(); EXPECT_EQ(0, rv); @@ -5014,19 +4917,19 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushClaimBeforeHeaders) { rv = trans2->Start( &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->RunFor(3); + data.RunFor(3); MessageLoop::current()->RunAllPending(); // 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.get(), &result); + ReadResult(trans, &data, &result); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); // Verify that the received push data is same as the expected push data. EXPECT_EQ(result2.compare(expected_push_result), 0) @@ -5130,14 +5033,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithTwoHeaderFrames) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); - helper.AddDeterministicData(data.get()); + helper.AddDeterministicData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -5145,14 +5047,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithTwoHeaderFrames) { // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, // the first HEADERS frame, and the body of the primary stream, but before // we've received the final HEADERS for the pushed stream. - data->SetStop(4); + data.SetStop(4); // Start the transaction. TestCompletionCallback callback; int rv = trans->Start( &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->Run(); + data.Run(); rv = callback.WaitForResult(); EXPECT_EQ(0, rv); @@ -5163,19 +5065,19 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushWithTwoHeaderFrames) { rv = trans2->Start( &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->RunFor(3); + data.RunFor(3); MessageLoop::current()->RunAllPending(); // 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.get(), &result); + ReadResult(trans, &data, &result); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); // Verify that the received push data is same as the expected push data. EXPECT_EQ(result2.compare(expected_push_result), 0) @@ -5252,12 +5154,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyWithHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -5310,12 +5211,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyWithLateHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -5368,12 +5268,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SynReplyWithDuplicateLateHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -5446,11 +5345,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushCrossOriginCorrectness) { }; HttpResponseInfo response; - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); HttpRequestInfo request; request.method = "GET"; @@ -5466,7 +5362,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushCrossOriginCorrectness) { BoundNetLog(), GetParam(), session_deps.release()); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -5479,11 +5375,11 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, ServerPushCrossOriginCorrectness) { // Read the response body. std::string result; - ReadResult(trans, data.get(), &result); + ReadResult(trans, &data, &result); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); // Verify the SYN_REPLY. // Copy the response info, because trans goes away. @@ -5517,14 +5413,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RetryAfterRefused) { MockRead(ASYNC, 0, 6) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -5537,14 +5432,14 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, RetryAfterRefused) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -5582,14 +5477,13 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, OutOfOrderSynStream) { MockRead(ASYNC, 0, 9) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + 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(); @@ -5626,12 +5520,12 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, OutOfOrderSynStream) { // We now have two SYN_STREAM frames queued up which will be // dequeued only once the first write completes, which we // now allow to happen. - data->RunFor(2); + data.RunFor(2); EXPECT_EQ(OK, callback.WaitForResult()); // And now we can allow everything else to run to completion. - data->SetStop(10); - data->Run(); + data.SetStop(10); + data.Run(); EXPECT_EQ(OK, callback2.WaitForResult()); EXPECT_EQ(OK, callback3.WaitForResult()); diff --git a/net/spdy/spdy_network_transaction_spdy3_unittest.cc b/net/spdy/spdy_network_transaction_spdy3_unittest.cc index e66bad9..ff9437e 100644 --- a/net/spdy/spdy_network_transaction_spdy3_unittest.cc +++ b/net/spdy/spdy_network_transaction_spdy3_unittest.cc @@ -550,12 +550,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Get) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -602,15 +601,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, GetAtEachPriority) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); HttpRequestInfo http_req = CreateGetRequest(); http_req.priority = p; NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -663,22 +661,20 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGets) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -747,25 +743,23 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, TwoGetsLateBinding) { CreateMockRead(*fbody2), MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); - data_placeholder->set_connect_data(never_finishing_connect); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); + data_placeholder.set_connect_data(never_finishing_connect); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because two get requests are sent out, so // there needs to be two sets of SSL connection data. - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -834,26 +828,24 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, TwoGetsLateBindingFromPreconnect) { CreateMockRead(*fbody2), MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> preconnect_data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData preconnect_data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect never_finishing_connect(ASYNC, ERR_IO_PENDING); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); - data_placeholder->set_connect_data(never_finishing_connect); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); + data_placeholder.set_connect_data(never_finishing_connect); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(preconnect_data.get()); + helper.AddData(&preconnect_data); // We require placeholder data because 3 connections are attempted (first is // the preconnect, 2nd and 3rd are the never finished connections. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); @@ -959,11 +951,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrent) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; @@ -971,11 +961,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrent) { NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -1004,7 +994,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrent) { ASSERT_EQ(out.rv, ERR_IO_PENDING); out.rv = callback2.WaitForResult(); ASSERT_EQ(OK, out.rv); - EXPECT_EQ(7U, data->read_index()); // i.e. the third trans was queued + EXPECT_EQ(7U, data.read_index()); // i.e. the third trans was queued out.rv = callback3.WaitForResult(); ASSERT_EQ(OK, out.rv); @@ -1096,23 +1086,21 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FourGetsWithMaxConcurrentPriority) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because four get requests are sent out, so // there needs to be four sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -1148,7 +1136,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FourGetsWithMaxConcurrentPriority) { out.rv = callback2.WaitForResult(); ASSERT_EQ(OK, out.rv); - EXPECT_EQ(data->read_index(), 7U); // i.e. the third & fourth trans queued + EXPECT_EQ(data.read_index(), 7U); // i.e. the third & fourth trans queued out.rv = callback3.WaitForResult(); ASSERT_EQ(OK, out.rv); @@ -1230,22 +1218,20 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentDelete) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); scoped_ptr<HttpNetworkTransaction> trans1( new HttpNetworkTransaction(helper.session())); scoped_ptr<HttpNetworkTransaction> trans2( @@ -1275,7 +1261,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentDelete) { out.rv = callback2.WaitForResult(); ASSERT_EQ(OK, out.rv); - EXPECT_EQ(8U, data->read_index()); + EXPECT_EQ(8U, data.read_index()); const HttpResponseInfo* response1 = trans1->GetResponseInfo(); ASSERT_TRUE(response1 != NULL); @@ -1361,22 +1347,20 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentSocketClose) { MockRead(ASYNC, ERR_CONNECTION_RESET, 0), // Abort! }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data_placeholder( - new OrderedSocketData(NULL, 0, NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data_placeholder(NULL, 0, NULL, 0); BoundNetLog log; TransactionHelperResult out; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); // We require placeholder data because three get requests are sent out, so // there needs to be three sets of SSL connection data. - helper.AddData(data_placeholder.get()); - helper.AddData(data_placeholder.get()); + helper.AddData(&data_placeholder); + helper.AddData(&data_placeholder); HttpNetworkTransaction trans1(helper.session()); HttpNetworkTransaction trans2(helper.session()); HttpNetworkTransaction* trans3(new HttpNetworkTransaction(helper.session())); @@ -1402,7 +1386,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentSocketClose) { out.rv = callback3.WaitForResult(); ASSERT_EQ(ERR_ABORTED, out.rv); - EXPECT_EQ(6U, data->read_index()); + EXPECT_EQ(6U, data.read_index()); const HttpResponseInfo* response1 = trans1.GetResponseInfo(); ASSERT_TRUE(response1 != NULL); @@ -1484,12 +1468,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Put) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1557,12 +1540,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Head) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -1585,12 +1567,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Post) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(2, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreatePostRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1618,12 +1599,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ChunkedPost) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(2, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1656,13 +1636,12 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, NullPost) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1703,13 +1682,12 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, EmptyPost) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -1742,12 +1720,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, PostWithEarlySynReply) { MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(0, reads, arraysize(reads), NULL, 0)); + DelayedSocketData data(0, reads, arraysize(reads), NULL, 0); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunDefaultTest(); helper.VerifyDataConsumed(); @@ -1774,14 +1751,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SocketWriteReturnsZero) { MockRead(ASYNC, 0, 0, 4) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + 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; @@ -1789,11 +1765,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SocketWriteReturnsZero) { &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->SetStop(2); - data->Run(); + data.SetStop(2); + data.Run(); helper.ResetTrans(); - data->SetStop(20); - data->Run(); + data.SetStop(20); + data.Run(); helper.VerifyDataConsumed(); } @@ -1806,11 +1782,10 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResponseWithoutSynReply) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), NULL, 0)); + DelayedSocketData data(1, reads, arraysize(reads), NULL, 0); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); } @@ -1830,14 +1805,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResponseWithTwoSynReplies) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -1916,9 +1890,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateReceived) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(0, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(0, reads, arraysize(reads), + writes, arraysize(writes)); // Setup the request HttpRequestInfo request; @@ -1929,7 +1902,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateReceived) { request.upload_data->AppendBytes(content->c_str(), content->size()); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -1978,13 +1951,12 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateSent) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -2023,14 +1995,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateSent) { EXPECT_STREQ(kUploadData, content.c_str()); // Schedule the reading of empty data frame with FIN - data->CompleteRead(); + data.CompleteRead(); // Force write of WINDOW_UPDATE which was scheduled during the above // read. MessageLoop::current()->RunAllPending(); // Read EOF. - data->CompleteRead(); + data.CompleteRead(); helper.VerifyDataConsumed(); } @@ -2066,9 +2038,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateOverflow) { MockRead(ASYNC, 0, 4) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); // Setup the request HttpRequestInfo request; @@ -2082,14 +2053,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WindowUpdateOverflow) { BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); helper.RunPreTestSetup(); - helper.AddDeterministicData(data.get()); + helper.AddDeterministicData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); ASSERT_EQ(ERR_IO_PENDING, rv); - data->RunFor(5); + data.RunFor(5); ASSERT_TRUE(callback.have_result()); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, callback.WaitForResult()); helper.VerifyDataConsumed(); @@ -2163,9 +2134,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResume) { // Force all writes to happen before any read, last write will not // actually queue a frame, due to window size being 0. - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(num_writes, reads, arraysize(reads), - writes.get(), num_writes)); + DelayedSocketData data(num_writes, reads, arraysize(reads), + writes.get(), num_writes); HttpRequestInfo request; request.method = "POST"; @@ -2176,7 +2146,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResume) { upload_data->append(kUploadData, kUploadDataSize); request.upload_data->AppendBytes(upload_data->c_str(), upload_data->size()); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -2198,7 +2168,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResume) { // But the body is not yet fully sent (kUploadData is not yet sent). EXPECT_FALSE(stream->stream()->body_sent()); - data->ForceNextRead(); // Read in WINDOW_UPDATE frame. + data.ForceNextRead(); // Read in WINDOW_UPDATE frame. rv = callback.WaitForResult(); helper.VerifyDataConsumed(); } @@ -2259,9 +2229,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { // Force all writes to happen before any read, last write will not // actually queue a frame, due to window size being 0. - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(num_writes, reads, arraysize(reads), - writes.get(), num_writes)); + DelayedSocketData data(num_writes, reads, arraysize(reads), + writes.get(), num_writes); HttpRequestInfo request; request.method = "POST"; @@ -2271,7 +2240,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { upload_data.append(kUploadData, kUploadDataSize); request.upload_data->AppendBytes(upload_data.c_str(), upload_data.size()); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -2295,7 +2264,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlStallResumeAfterSettings) { EXPECT_FALSE(stream->stream()->body_sent()); EXPECT_TRUE(stream->stream()->stalled_by_flow_control()); - data->ForceNextRead(); // Read in SETTINGS frame to unstall. + data.ForceNextRead(); // Read in SETTINGS frame to unstall. rv = callback.WaitForResult(); helper.VerifyDataConsumed(); EXPECT_FALSE(stream->stream()->stalled_by_flow_control()); @@ -2363,9 +2332,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlNegativeSendWindowSize) { // Force all writes to happen before any read, last write will not actually // queue a frame, due to window size being 0. - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(num_writes, reads, arraysize(reads), - writes.get(), num_writes)); + DelayedSocketData data(num_writes, reads, arraysize(reads), + writes.get(), num_writes); HttpRequestInfo request; request.method = "POST"; @@ -2375,7 +2343,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlNegativeSendWindowSize) { upload_data.append(kUploadData, kUploadDataSize); request.upload_data->AppendBytes(upload_data.c_str(), upload_data.size()); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); + helper.AddData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -2398,7 +2366,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, FlowControlNegativeSendWindowSize) { // But the body is not yet fully sent (kUploadData is not yet sent). EXPECT_FALSE(stream->stream()->body_sent()); - data->ForceNextRead(); // Read in WINDOW_UPDATE or SETTINGS frame. + data.ForceNextRead(); // Read in WINDOW_UPDATE or SETTINGS frame. rv = callback.WaitForResult(); helper.VerifyDataConsumed(); } @@ -2423,12 +2391,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResetReplyWithTransferEncoding) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); @@ -2460,12 +2427,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ResetPushWithTransferEncoding) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -2529,16 +2495,15 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransactionSendRst) { MockRead(ASYNC, 0, 0, 3) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + 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; @@ -2547,11 +2512,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CancelledTransactionSendRst) { &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->SetStop(2); - data->Run(); + data.SetStop(2); + data.Run(); helper.ResetTrans(); - data->SetStop(20); - data->Run(); + data.SetStop(20); + data.Run(); helper.VerifyDataConsumed(); } @@ -2587,18 +2552,16 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, StartTransactionOnReadCallback) { MockRead(ASYNC, 0, 0, 3), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<DelayedSocketData> data2( - new DelayedSocketData(1, reads2, arraysize(reads2), - writes2, arraysize(writes2))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + DelayedSocketData data2(1, reads2, arraysize(reads2), + writes2, arraysize(writes2)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); - helper.AddData(data2.get()); + helper.AddData(&data); + helper.AddData(&data2); HttpNetworkTransaction* trans = helper.trans(); // Start the transaction with basic parameters. @@ -2614,9 +2577,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, StartTransactionOnReadCallback) { base::Bind(&SpdyNetworkTransactionSpdy3Test::StartTransactionCallback, helper.session())); // This forces an err_IO_pending, which sets the callback. - data->CompleteRead(); + data.CompleteRead(); // This finishes the read. - data->CompleteRead(); + data.CompleteRead(); helper.VerifyDataConsumed(); } @@ -2636,14 +2599,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DeleteSessionOnReadCallback) { MockRead(ASYNC, 0, 0, 5), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); // Start the transaction with basic parameters. @@ -2661,7 +2623,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DeleteSessionOnReadCallback) { base::Bind(&SpdyNetworkTransactionSpdy3Test::DeleteSessionCallback, base::Unretained(&helper))); ASSERT_EQ(ERR_IO_PENDING, rv); - data->CompleteRead(); + data.CompleteRead(); // Finish running rest of tasks. MessageLoop::current()->RunAllPending(); @@ -2732,12 +2694,10 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectGetRequest) { CreateMockRead(*body2, 3), MockRead(ASYNC, 0, 0, 4) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data2( - new OrderedSocketData(reads2, arraysize(reads2), - writes2, arraysize(writes2))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data2(reads2, arraysize(reads2), + writes2, arraysize(writes2)); // TODO(erikchen): Make test support SPDYSSL, SPDYNPN HttpStreamFactory::set_force_spdy_over_ssl(false); @@ -2748,9 +2708,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectGetRequest) { net::URLRequest r( GURL("http://www.google.com/"), &d, &spdy_url_request_context); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data.get()); + AddSocketDataProvider(&data); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data2.get()); + AddSocketDataProvider(&data2); d.set_quit_on_redirect(true); r.Start(); @@ -2765,10 +2725,10 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectGetRequest) { std::string contents("hello!"); EXPECT_EQ(contents, d.data_received()); } - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); - EXPECT_TRUE(data2->at_read_eof()); - EXPECT_TRUE(data2->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); + EXPECT_TRUE(data2.at_read_eof()); + EXPECT_TRUE(data2.at_write_eof()); } // Detect response with upper case headers and reset the stream. @@ -2792,14 +2752,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeaders) { HttpResponseInfo response; HttpResponseInfo response2; - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -2853,12 +2810,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeadersInHeadersFrame) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -2892,14 +2848,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, UpperCaseHeadersOnPush) { HttpResponseInfo response; HttpResponseInfo response2; - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); } @@ -2989,12 +2942,10 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { CreateMockRead(*body2, 3), MockRead(ASYNC, 0, 0, 5) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - scoped_ptr<OrderedSocketData> data2( - new OrderedSocketData(reads2, arraysize(reads2), - writes2, arraysize(writes2))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + OrderedSocketData data2(reads2, arraysize(reads2), + writes2, arraysize(writes2)); // TODO(erikchen): Make test support SPDYSSL, SPDYNPN HttpStreamFactory::set_force_spdy_over_ssl(false); @@ -3006,7 +2957,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { net::URLRequest r( GURL("http://www.google.com/"), &d, &spdy_url_request_context); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data.get()); + AddSocketDataProvider(&data); r.Start(); MessageLoop::current()->Run(); @@ -3018,7 +2969,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { net::URLRequest r2( GURL("http://www.google.com/foo.dat"), &d2, &spdy_url_request_context); spdy_url_request_context.socket_factory(). - AddSocketDataProvider(data2.get()); + AddSocketDataProvider(&data2); d2.set_quit_on_redirect(true); r2.Start(); @@ -3033,12 +2984,12 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RedirectServerPush) { std::string contents2("hello!"); EXPECT_EQ(contents2, d2.data_received()); } - data->CompleteRead(); - data2->CompleteRead(); - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); - EXPECT_TRUE(data2->at_read_eof()); - EXPECT_TRUE(data2->at_write_eof()); + data.CompleteRead(); + data2.CompleteRead(); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); + EXPECT_TRUE(data2.at_read_eof()); + EXPECT_TRUE(data2.at_write_eof()); } TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushSingleDataFrame) { @@ -3075,12 +3026,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushSingleDataFrame) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -3128,12 +3076,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushBeforeSynReply) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -3181,12 +3126,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushSingleDataFrame2) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -3227,14 +3169,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushServerAborted) { MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -3247,14 +3188,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushServerAborted) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -3309,12 +3250,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushDuplicate) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -3372,12 +3310,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushMultipleDataFrame) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed my darling hello my baby"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -3437,12 +3372,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed my darling hello my baby"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -3483,14 +3415,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID0) { MockRead(ASYNC, ERR_IO_PENDING, 5) // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -3503,14 +3434,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID0) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -3545,14 +3476,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID9) { MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -3565,14 +3495,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushInvalidAssociatedStreamID9) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -3603,14 +3533,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushNoURL) { MockRead(ASYNC, ERR_IO_PENDING, 5) // Force a pause }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -3622,14 +3551,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushNoURL) { rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -3692,12 +3621,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); @@ -3841,12 +3769,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyHeadersVary) { request.extra_headers.SetHeader(header_key, header_value); } - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(request, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv) << i; @@ -3947,12 +3874,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, InvalidSynReply) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_INCOMPLETE_SPDY_HEADERS, out.rv); } @@ -3986,12 +3912,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CorruptFrameSessionError) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -4007,15 +3932,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, WriteError) { MockWrite(ASYNC, ERR_FAILED), }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, NULL, 0, - writes, arraysize(writes))); + DelayedSocketData data(2, NULL, 0, + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_FAILED, out.rv); - data->Reset(); + data.Reset(); } // Test that partial writes work. @@ -4033,12 +3957,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, PartialWrite) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(kChunks, reads, arraysize(reads), - writes.get(), kChunks)); + DelayedSocketData data(kChunks, reads, arraysize(reads), + writes.get(), kChunks); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -4065,15 +3988,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DecompressFailureOnSynReply) { CreateMockRead(*resp), }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); - data->Reset(); + data.Reset(); } // Test that the NetLog contains good data for a simple GET request. @@ -4095,12 +4017,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, NetLog) { CapturingBoundNetLog log; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequestWithUserAgent(), log.bound(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -4197,17 +4118,15 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferFull) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); - + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); TestCompletionCallback callback; NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); int rv = trans->Start( &CreateGetRequest(), callback.callback(), BoundNetLog()); @@ -4233,7 +4152,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferFull) { scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { - data->CompleteRead(); + data.CompleteRead(); rv = read_callback.WaitForResult(); } if (rv > 0) { @@ -4290,14 +4209,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Buffering) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4326,7 +4244,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, Buffering) { scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { - data->CompleteRead(); + data.CompleteRead(); rv = read_callback.WaitForResult(); } if (rv > 0) { @@ -4386,14 +4304,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedAll) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4475,14 +4392,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedClosed) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4512,7 +4428,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedClosed) { scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { - data->CompleteRead(); + data.CompleteRead(); rv = read_callback.WaitForResult(); } if (rv > 0) { @@ -4556,14 +4472,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedCancelled) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -4590,7 +4505,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, BufferedCancelled) { rv = trans->Read(buf, kReadSize, read_callback.callback()); if (rv == net::ERR_IO_PENDING) { // Complete the read now, which causes buffering to start. - data->CompleteRead(); + data.CompleteRead(); // Destroy the transaction, causing the stream to get cancelled // and orphaning the buffered IO task. helper.ResetTrans(); @@ -4682,10 +4597,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); - helper.AddData(data.get()); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); + helper.AddData(&data); helper.RunDefaultTest(); helper.VerifyDataConsumed(); TransactionHelperResult out = helper.output(); @@ -4799,10 +4713,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsPlayback) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(2, reads, arraysize(reads), - writes, arraysize(writes))); - helper.AddData(data.get()); + DelayedSocketData data(2, reads, arraysize(reads), + writes, arraysize(writes)); + helper.AddData(&data); helper.RunDefaultTest(); helper.VerifyDataConsumed(); TransactionHelperResult out = helper.output(); @@ -4843,13 +4756,12 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, GoAwayWithActiveStream) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.AddData(data.get()); - helper.RunToCompletion(data.get()); + helper.AddData(&data); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_ABORTED, out.rv); } @@ -4864,14 +4776,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, CloseWithActiveStream) { MockRead(SYNCHRONOUS, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); BoundNetLog log; NormalSpdyTransactionHelper helper(CreateGetRequest(), log, GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -5026,10 +4937,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DirectConnectProxyReconnect) { MockRead(ASYNC, ERR_IO_PENDING, 4), // Force a pause MockRead(ASYNC, 0, 5) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); - helper.AddData(data.get()); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; @@ -5164,7 +5074,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, DirectConnectProxyReconnect) { ASSERT_EQ(OK, ReadTransaction(trans_proxy, &response_data)); EXPECT_EQ("hello!", response_data); - data->CompleteRead(); + data.CompleteRead(); helper_proxy.VerifyDataConsumed(); } @@ -5200,18 +5110,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, VerifyRetryOnConnectionReset) { for (int variant = VARIANT_RST_DURING_SEND_COMPLETION; variant <= VARIANT_RST_DURING_READ_COMPLETION; ++variant) { - scoped_ptr<DelayedSocketData> data1( - new DelayedSocketData(1, reads, arraysize(reads), - NULL, 0)); + DelayedSocketData data1(1, reads, arraysize(reads), NULL, 0); - scoped_ptr<DelayedSocketData> data2( - new DelayedSocketData(1, reads2, arraysize(reads2), - NULL, 0)); + DelayedSocketData data2(1, reads2, arraysize(reads2), NULL, 0); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.AddData(data1.get()); - helper.AddData(data2.get()); + helper.AddData(&data1); + helper.AddData(&data2); helper.RunPreTestSetup(); for (int i = 0; i < 2; ++i) { @@ -5231,9 +5137,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, VerifyRetryOnConnectionReset) { } // Now schedule the ERR_CONNECTION_RESET. - EXPECT_EQ(3u, data1->read_index()); - data1->CompleteRead(); - EXPECT_EQ(4u, data1->read_index()); + EXPECT_EQ(3u, data1.read_index()); + data1.CompleteRead(); + EXPECT_EQ(4u, data1.read_index()); } rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -5267,13 +5173,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SpdyOnOffToggle) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, - spdy_reads, arraysize(spdy_reads), - spdy_writes, arraysize(spdy_writes))); + DelayedSocketData data(1, spdy_reads, arraysize(spdy_reads), + spdy_writes, arraysize(spdy_writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -5285,13 +5189,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SpdyOnOffToggle) { MockRead("hello from http"), MockRead(SYNCHRONOUS, OK), }; - scoped_ptr<DelayedSocketData> data2( - new DelayedSocketData(1, http_reads, arraysize(http_reads), - NULL, 0)); + DelayedSocketData data2(1, http_reads, arraysize(http_reads), NULL, 0); NormalSpdyTransactionHelper helper2(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper2.SetSpdyDisabled(); - helper2.RunToCompletion(data2.get()); + helper2.RunToCompletion(&data2); TransactionHelperResult out2 = helper2.output(); EXPECT_EQ(OK, out2.rv); EXPECT_EQ("HTTP/1.1 200 OK", out2.status_line); @@ -5347,15 +5249,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SpdyBasicAuth) { MockRead(ASYNC, 0, 7), }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(spdy_reads, arraysize(spdy_reads), - spdy_writes, arraysize(spdy_writes))); + OrderedSocketData data(spdy_reads, arraysize(spdy_reads), + spdy_writes, arraysize(spdy_writes)); HttpRequestInfo request(CreateGetRequest()); BoundNetLog net_log; NormalSpdyTransactionHelper helper(request, net_log, GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); TestCompletionCallback callback; const int rv_start = trans->Start(&request, callback.callback(), net_log); @@ -5457,12 +5358,9 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithHeaders) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); - RunServerPushTest(data.get(), + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); + RunServerPushTest(&data, &response, &response2, expected_push_result); @@ -5542,14 +5440,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushClaimBeforeHeaders) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); - helper.AddDeterministicData(data.get()); + helper.AddDeterministicData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -5557,14 +5454,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushClaimBeforeHeaders) { // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, // and the body of the primary stream, but before we've received the HEADERS // for the pushed stream. - data->SetStop(3); + data.SetStop(3); // Start the transaction. TestCompletionCallback callback; int rv = trans->Start( &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->Run(); + data.Run(); rv = callback.WaitForResult(); EXPECT_EQ(0, rv); @@ -5575,19 +5472,19 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushClaimBeforeHeaders) { rv = trans2->Start( &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->RunFor(3); + data.RunFor(3); MessageLoop::current()->RunAllPending(); // 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.get(), &result); + ReadResult(trans, &data, &result); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); // Verify that the received push data is same as the expected push data. EXPECT_EQ(result2.compare(expected_push_result), 0) @@ -5692,14 +5589,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithTwoHeaderFrames) { HttpResponseInfo response; HttpResponseInfo response2; std::string expected_push_result("pushed"); - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.SetDeterministic(); - helper.AddDeterministicData(data.get()); + helper.AddDeterministicData(&data); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -5707,14 +5603,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithTwoHeaderFrames) { // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, // the first HEADERS frame, and the body of the primary stream, but before // we've received the final HEADERS for the pushed stream. - data->SetStop(4); + data.SetStop(4); // Start the transaction. TestCompletionCallback callback; int rv = trans->Start( &CreateGetRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->Run(); + data.Run(); rv = callback.WaitForResult(); EXPECT_EQ(0, rv); @@ -5725,19 +5621,19 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushWithTwoHeaderFrames) { rv = trans2->Start( &CreateGetPushRequest(), callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); - data->RunFor(3); + data.RunFor(3); MessageLoop::current()->RunAllPending(); // 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.get(), &result); + ReadResult(trans, &data, &result); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); // Verify that the received push data is same as the expected push data. EXPECT_EQ(result2.compare(expected_push_result), 0) @@ -5817,12 +5713,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyWithHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -5875,12 +5770,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyWithLateHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); @@ -5933,12 +5827,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SynReplyWithDuplicateLateHeaders) { MockRead(ASYNC, 0, 0) // EOF }; - scoped_ptr<DelayedSocketData> data( - new DelayedSocketData(1, reads, arraysize(reads), - writes, arraysize(writes))); + DelayedSocketData data(1, reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); - helper.RunToCompletion(data.get()); + helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); } @@ -6011,11 +5904,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushCrossOriginCorrectness) { }; HttpResponseInfo response; - scoped_ptr<OrderedSocketData> data(new OrderedSocketData( - reads, - arraysize(reads), - writes, - arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); HttpRequestInfo request; request.method = "GET"; @@ -6031,7 +5921,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushCrossOriginCorrectness) { BoundNetLog(), GetParam(), session_deps.release()); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -6044,11 +5934,11 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, ServerPushCrossOriginCorrectness) { // Read the response body. std::string result; - ReadResult(trans, data.get(), &result); + ReadResult(trans, &data, &result); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()); - EXPECT_TRUE(data->at_write_eof()); + EXPECT_TRUE(data.at_read_eof()); + EXPECT_TRUE(data.at_write_eof()); // Verify the SYN_REPLY. // Copy the response info, because trans goes away. @@ -6082,14 +5972,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RetryAfterRefused) { MockRead(ASYNC, 0, 6) // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); NormalSpdyTransactionHelper helper(CreateGetRequest(), BoundNetLog(), GetParam(), NULL); helper.RunPreTestSetup(); - helper.AddData(data.get()); + helper.AddData(&data); HttpNetworkTransaction* trans = helper.trans(); @@ -6102,14 +5991,14 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, RetryAfterRefused) { EXPECT_EQ(OK, rv); // Verify that we consumed all test data. - EXPECT_TRUE(data->at_read_eof()) << "Read count: " - << data->read_count() + EXPECT_TRUE(data.at_read_eof()) << "Read count: " + << data.read_count() << " Read index: " - << data->read_index(); - EXPECT_TRUE(data->at_write_eof()) << "Write count: " - << data->write_count() + << data.read_index(); + EXPECT_TRUE(data.at_write_eof()) << "Write count: " + << data.write_count() << " Write index: " - << data->write_index(); + << data.write_index(); // Verify the SYN_REPLY. HttpResponseInfo response = *trans->GetResponseInfo(); @@ -6147,14 +6036,13 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, OutOfOrderSynStream) { MockRead(ASYNC, 0, 9) // EOF }; - scoped_ptr<DeterministicSocketData> data( - new DeterministicSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + DeterministicSocketData data(reads, arraysize(reads), + 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(); @@ -6191,12 +6079,12 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, OutOfOrderSynStream) { // We now have two SYN_STREAM frames queued up which will be // dequeued only once the first write completes, which we // now allow to happen. - data->RunFor(2); + data.RunFor(2); EXPECT_EQ(OK, callback.WaitForResult()); // And now we can allow everything else to run to completion. - data->SetStop(10); - data->Run(); + data.SetStop(10); + data.Run(); EXPECT_EQ(OK, callback2.WaitForResult()); EXPECT_EQ(OK, callback3.WaitForResult()); diff --git a/net/spdy/spdy_stream_spdy2_unittest.cc b/net/spdy/spdy_stream_spdy2_unittest.cc index fa51d92..7ffe646 100644 --- a/net/spdy/spdy_stream_spdy2_unittest.cc +++ b/net/spdy/spdy_stream_spdy2_unittest.cc @@ -111,13 +111,12 @@ TEST_F(SpdyStreamSpdy2Test, SendDataAfterOpen) { reads[1].sequence_number = 3; reads[2].sequence_number = 4; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect connect_data(SYNCHRONOUS, OK); - data->set_connect_data(connect_data); + data.set_connect_data(connect_data); - session_deps.socket_factory->AddSocketDataProvider(data.get()); + session_deps.socket_factory->AddSocketDataProvider(&data); scoped_refptr<SpdySession> session(CreateSpdySession()); const char* kStreamUrl = "http://www.google.com/"; @@ -185,12 +184,11 @@ TEST_F(SpdyStreamSpdy2Test, PushedStream) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), NULL, 0); MockConnect connect_data(SYNCHRONOUS, OK); - data->set_connect_data(connect_data); + data.set_connect_data(connect_data); - session_deps.socket_factory->AddSocketDataProvider(data.get()); + session_deps.socket_factory->AddSocketDataProvider(&data); HostPortPair host_port_pair("www.google.com", 80); scoped_refptr<TransportSocketParams> transport_params( @@ -287,13 +285,12 @@ TEST_F(SpdyStreamSpdy2Test, StreamError) { CapturingBoundNetLog log; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect connect_data(SYNCHRONOUS, OK); - data->set_connect_data(connect_data); + data.set_connect_data(connect_data); - session_deps.socket_factory->AddSocketDataProvider(data.get()); + session_deps.socket_factory->AddSocketDataProvider(&data); scoped_refptr<SpdySession> session(CreateSpdySession()); const char* kStreamUrl = "http://www.google.com/"; diff --git a/net/spdy/spdy_stream_spdy3_unittest.cc b/net/spdy/spdy_stream_spdy3_unittest.cc index eb777bd..c23c6df 100644 --- a/net/spdy/spdy_stream_spdy3_unittest.cc +++ b/net/spdy/spdy_stream_spdy3_unittest.cc @@ -112,13 +112,12 @@ TEST_F(SpdyStreamSpdy3Test, SendDataAfterOpen) { reads[1].sequence_number = 3; reads[2].sequence_number = 4; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect connect_data(SYNCHRONOUS, OK); - data->set_connect_data(connect_data); + data.set_connect_data(connect_data); - session_deps.socket_factory->AddSocketDataProvider(data.get()); + session_deps.socket_factory->AddSocketDataProvider(&data); scoped_refptr<SpdySession> session(CreateSpdySession()); const char* kStreamUrl = "http://www.google.com/"; @@ -186,12 +185,11 @@ TEST_F(SpdyStreamSpdy3Test, PushedStream) { MockRead(ASYNC, 0, 0), // EOF }; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), NULL, 0)); + OrderedSocketData data(reads, arraysize(reads), NULL, 0); MockConnect connect_data(SYNCHRONOUS, OK); - data->set_connect_data(connect_data); + data.set_connect_data(connect_data); - session_deps.socket_factory->AddSocketDataProvider(data.get()); + session_deps.socket_factory->AddSocketDataProvider(&data); HostPortPair host_port_pair("www.google.com", 80); scoped_refptr<TransportSocketParams> transport_params( @@ -292,13 +290,12 @@ TEST_F(SpdyStreamSpdy3Test, StreamError) { CapturingBoundNetLog log; - scoped_ptr<OrderedSocketData> data( - new OrderedSocketData(reads, arraysize(reads), - writes, arraysize(writes))); + OrderedSocketData data(reads, arraysize(reads), + writes, arraysize(writes)); MockConnect connect_data(SYNCHRONOUS, OK); - data->set_connect_data(connect_data); + data.set_connect_data(connect_data); - session_deps.socket_factory->AddSocketDataProvider(data.get()); + session_deps.socket_factory->AddSocketDataProvider(&data); scoped_refptr<SpdySession> session(CreateSpdySession()); const char* kStreamUrl = "http://www.google.com/"; |