| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/memory/scoped_vector.h" |
| 12 #include "net/base/auth.h" | 13 #include "net/base/auth.h" |
| 13 #include "net/base/net_log_unittest.h" | 14 #include "net/base/net_log_unittest.h" |
| 14 #include "net/http/http_network_session_peer.h" | 15 #include "net/http/http_network_session_peer.h" |
| 15 #include "net/http/http_transaction_unittest.h" | 16 #include "net/http/http_transaction_unittest.h" |
| 16 #include "net/socket/client_socket_pool_base.h" | 17 #include "net/socket/client_socket_pool_base.h" |
| 17 #include "net/spdy/buffered_spdy_framer.h" | 18 #include "net/spdy/buffered_spdy_framer.h" |
| 18 #include "net/spdy/spdy_http_stream.h" | 19 #include "net/spdy/spdy_http_stream.h" |
| 19 #include "net/spdy/spdy_http_utils.h" | 20 #include "net/spdy/spdy_http_utils.h" |
| 20 #include "net/spdy/spdy_session.h" | 21 #include "net/spdy/spdy_session.h" |
| 21 #include "net/spdy/spdy_session_pool.h" | 22 #include "net/spdy/spdy_session_pool.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void RunToCompletion(StaticSocketDataProvider* data) { | 223 void RunToCompletion(StaticSocketDataProvider* data) { |
| 223 RunPreTestSetup(); | 224 RunPreTestSetup(); |
| 224 AddData(data); | 225 AddData(data); |
| 225 RunDefaultTest(); | 226 RunDefaultTest(); |
| 226 VerifyDataConsumed(); | 227 VerifyDataConsumed(); |
| 227 } | 228 } |
| 228 | 229 |
| 229 void AddData(StaticSocketDataProvider* data) { | 230 void AddData(StaticSocketDataProvider* data) { |
| 230 DCHECK(!deterministic_); | 231 DCHECK(!deterministic_); |
| 231 data_vector_.push_back(data); | 232 data_vector_.push_back(data); |
| 232 linked_ptr<SSLSocketDataProvider> ssl_( | 233 SSLSocketDataProvider* ssl_provider = |
| 233 new SSLSocketDataProvider(ASYNC, OK)); | 234 new SSLSocketDataProvider(ASYNC, OK); |
| 234 if (test_type_ == SPDYNPN) { | 235 if (test_type_ == SPDYNPN) |
| 235 ssl_->SetNextProto(kProtoSPDY2); | 236 ssl_provider->SetNextProto(kProtoSPDY2); |
| 236 } | 237 |
| 237 ssl_vector_.push_back(ssl_); | 238 ssl_vector_.push_back(ssl_provider); |
| 238 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) | 239 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) |
| 239 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get()); | 240 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_provider); |
| 241 |
| 240 session_deps_->socket_factory->AddSocketDataProvider(data); | 242 session_deps_->socket_factory->AddSocketDataProvider(data); |
| 241 if (test_type_ == SPDYNPN) { | 243 if (test_type_ == SPDYNPN) { |
| 242 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 244 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 243 linked_ptr<StaticSocketDataProvider> | 245 StaticSocketDataProvider* hanging_non_alternate_protocol_socket = |
| 244 hanging_non_alternate_protocol_socket( | 246 new StaticSocketDataProvider(NULL, 0, NULL, 0); |
| 245 new StaticSocketDataProvider(NULL, 0, NULL, 0)); | |
| 246 hanging_non_alternate_protocol_socket->set_connect_data( | 247 hanging_non_alternate_protocol_socket->set_connect_data( |
| 247 never_finishing_connect); | 248 never_finishing_connect); |
| 248 session_deps_->socket_factory->AddSocketDataProvider( | 249 session_deps_->socket_factory->AddSocketDataProvider( |
| 249 hanging_non_alternate_protocol_socket.get()); | 250 hanging_non_alternate_protocol_socket); |
| 250 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); | 251 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); |
| 251 } | 252 } |
| 252 } | 253 } |
| 253 | 254 |
| 254 void AddDeterministicData(DeterministicSocketData* data) { | 255 void AddDeterministicData(DeterministicSocketData* data) { |
| 255 DCHECK(deterministic_); | 256 DCHECK(deterministic_); |
| 256 data_vector_.push_back(data); | 257 data_vector_.push_back(data); |
| 257 linked_ptr<SSLSocketDataProvider> ssl_( | 258 SSLSocketDataProvider* ssl_provider = |
| 258 new SSLSocketDataProvider(ASYNC, OK)); | 259 new SSLSocketDataProvider(ASYNC, OK); |
| 259 if (test_type_ == SPDYNPN) { | 260 if (test_type_ == SPDYNPN) |
| 260 ssl_->SetNextProto(kProtoSPDY2); | 261 ssl_provider->SetNextProto(kProtoSPDY2); |
| 261 } | 262 |
| 262 ssl_vector_.push_back(ssl_); | 263 ssl_vector_.push_back(ssl_provider); |
| 263 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { | 264 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { |
| 264 session_deps_->deterministic_socket_factory-> | 265 session_deps_->deterministic_socket_factory-> |
| 265 AddSSLSocketDataProvider(ssl_.get()); | 266 AddSSLSocketDataProvider(ssl_provider); |
| 266 } | 267 } |
| 267 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); | 268 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); |
| 268 if (test_type_ == SPDYNPN) { | 269 if (test_type_ == SPDYNPN) { |
| 269 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 270 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 270 scoped_refptr<DeterministicSocketData> | 271 DeterministicSocketData* hanging_non_alternate_protocol_socket = |
| 271 hanging_non_alternate_protocol_socket( | 272 new DeterministicSocketData(NULL, 0, NULL, 0); |
| 272 new DeterministicSocketData(NULL, 0, NULL, 0)); | |
| 273 hanging_non_alternate_protocol_socket->set_connect_data( | 273 hanging_non_alternate_protocol_socket->set_connect_data( |
| 274 never_finishing_connect); | 274 never_finishing_connect); |
| 275 session_deps_->deterministic_socket_factory->AddSocketDataProvider( | 275 session_deps_->deterministic_socket_factory->AddSocketDataProvider( |
| 276 hanging_non_alternate_protocol_socket); | 276 hanging_non_alternate_protocol_socket); |
| 277 alternate_deterministic_vector_.push_back( | 277 alternate_deterministic_vector_.push_back( |
| 278 hanging_non_alternate_protocol_socket); | 278 hanging_non_alternate_protocol_socket); |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 // This can only be called after RunPreTestSetup. It adds a Data Provider, | 282 // This can only be called after RunPreTestSetup. It adds a Data Provider, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 303 scoped_ptr<SpdySessionDependencies>& session_deps() { | 303 scoped_ptr<SpdySessionDependencies>& session_deps() { |
| 304 return session_deps_; | 304 return session_deps_; |
| 305 } | 305 } |
| 306 int port() const { return port_; } | 306 int port() const { return port_; } |
| 307 SpdyNetworkTransactionSpdy2TestTypes test_type() const { | 307 SpdyNetworkTransactionSpdy2TestTypes test_type() const { |
| 308 return test_type_; | 308 return test_type_; |
| 309 } | 309 } |
| 310 | 310 |
| 311 private: | 311 private: |
| 312 typedef std::vector<StaticSocketDataProvider*> DataVector; | 312 typedef std::vector<StaticSocketDataProvider*> DataVector; |
| 313 typedef std::vector<linked_ptr<SSLSocketDataProvider> > SSLVector; | 313 typedef ScopedVector<SSLSocketDataProvider> SSLVector; |
| 314 typedef std::vector<linked_ptr<StaticSocketDataProvider> > AlternateVector; | 314 typedef ScopedVector<StaticSocketDataProvider> AlternateVector; |
| 315 typedef std::vector<scoped_refptr<DeterministicSocketData> > | 315 typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector; |
| 316 AlternateDeterministicVector; | |
| 317 HttpRequestInfo request_; | 316 HttpRequestInfo request_; |
| 318 scoped_ptr<SpdySessionDependencies> session_deps_; | 317 scoped_ptr<SpdySessionDependencies> session_deps_; |
| 319 scoped_refptr<HttpNetworkSession> session_; | 318 scoped_refptr<HttpNetworkSession> session_; |
| 320 TransactionHelperResult output_; | 319 TransactionHelperResult output_; |
| 321 scoped_ptr<StaticSocketDataProvider> first_transaction_; | 320 scoped_ptr<StaticSocketDataProvider> first_transaction_; |
| 322 SSLVector ssl_vector_; | 321 SSLVector ssl_vector_; |
| 323 TestCompletionCallback callback; | 322 TestCompletionCallback callback; |
| 324 scoped_ptr<HttpNetworkTransaction> trans_; | 323 scoped_ptr<HttpNetworkTransaction> trans_; |
| 325 scoped_ptr<HttpNetworkTransaction> trans_http_; | 324 scoped_ptr<HttpNetworkTransaction> trans_http_; |
| 326 DataVector data_vector_; | 325 DataVector data_vector_; |
| (...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 MockWrite(SYNCHRONOUS, 0, 0, 2), | 1765 MockWrite(SYNCHRONOUS, 0, 0, 2), |
| 1767 CreateMockWrite(*rst.get(), 3, SYNCHRONOUS), | 1766 CreateMockWrite(*rst.get(), 3, SYNCHRONOUS), |
| 1768 }; | 1767 }; |
| 1769 | 1768 |
| 1770 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1769 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 1771 MockRead reads[] = { | 1770 MockRead reads[] = { |
| 1772 CreateMockRead(*resp.get(), 1, ASYNC), | 1771 CreateMockRead(*resp.get(), 1, ASYNC), |
| 1773 MockRead(ASYNC, 0, 0, 4) // EOF | 1772 MockRead(ASYNC, 0, 0, 4) // EOF |
| 1774 }; | 1773 }; |
| 1775 | 1774 |
| 1776 scoped_refptr<DeterministicSocketData> data( | 1775 DeterministicSocketData* data = |
| 1777 new DeterministicSocketData(reads, arraysize(reads), | 1776 new DeterministicSocketData(reads, arraysize(reads), |
| 1778 writes, arraysize(writes))); | 1777 writes, arraysize(writes)); |
| 1778 |
| 1779 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 1779 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 1780 BoundNetLog(), GetParam(), NULL); | 1780 BoundNetLog(), GetParam(), NULL); |
| 1781 helper.SetDeterministic(); | 1781 helper.SetDeterministic(); |
| 1782 helper.RunPreTestSetup(); | 1782 helper.RunPreTestSetup(); |
| 1783 helper.AddDeterministicData(data.get()); | 1783 helper.AddDeterministicData(data); |
| 1784 HttpNetworkTransaction* trans = helper.trans(); | 1784 HttpNetworkTransaction* trans = helper.trans(); |
| 1785 | 1785 |
| 1786 TestCompletionCallback callback; | 1786 TestCompletionCallback callback; |
| 1787 int rv = trans->Start( | 1787 int rv = trans->Start( |
| 1788 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 1788 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 1789 EXPECT_EQ(ERR_IO_PENDING, rv); | 1789 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1790 | 1790 |
| 1791 data->SetStop(2); | 1791 data->SetStop(2); |
| 1792 data->Run(); | 1792 data->Run(); |
| 1793 helper.ResetTrans(); | 1793 helper.ResetTrans(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 CreateMockWrite(*req, 0, SYNCHRONOUS), | 1974 CreateMockWrite(*req, 0, SYNCHRONOUS), |
| 1975 CreateMockWrite(*rst, 2, SYNCHRONOUS), | 1975 CreateMockWrite(*rst, 2, SYNCHRONOUS), |
| 1976 }; | 1976 }; |
| 1977 | 1977 |
| 1978 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1978 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 1979 MockRead reads[] = { | 1979 MockRead reads[] = { |
| 1980 CreateMockRead(*resp, 1, ASYNC), | 1980 CreateMockRead(*resp, 1, ASYNC), |
| 1981 MockRead(ASYNC, 0, 0, 3) // EOF | 1981 MockRead(ASYNC, 0, 0, 3) // EOF |
| 1982 }; | 1982 }; |
| 1983 | 1983 |
| 1984 scoped_refptr<DeterministicSocketData> data( | 1984 DeterministicSocketData* data = |
| 1985 new DeterministicSocketData(reads, arraysize(reads), | 1985 new DeterministicSocketData(reads, arraysize(reads), |
| 1986 writes, arraysize(writes))); | 1986 writes, arraysize(writes)); |
| 1987 | 1987 |
| 1988 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 1988 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 1989 BoundNetLog(), | 1989 BoundNetLog(), |
| 1990 GetParam(), NULL); | 1990 GetParam(), NULL); |
| 1991 helper.SetDeterministic(); | 1991 helper.SetDeterministic(); |
| 1992 helper.RunPreTestSetup(); | 1992 helper.RunPreTestSetup(); |
| 1993 helper.AddDeterministicData(data.get()); | 1993 helper.AddDeterministicData(data); |
| 1994 HttpNetworkTransaction* trans = helper.trans(); | 1994 HttpNetworkTransaction* trans = helper.trans(); |
| 1995 | 1995 |
| 1996 TestCompletionCallback callback; | 1996 TestCompletionCallback callback; |
| 1997 | 1997 |
| 1998 int rv = trans->Start( | 1998 int rv = trans->Start( |
| 1999 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 1999 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 2000 EXPECT_EQ(ERR_IO_PENDING, rv); | 2000 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2001 | 2001 |
| 2002 data->SetStop(2); | 2002 data->SetStop(2); |
| 2003 data->Run(); | 2003 data->Run(); |
| (...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4979 CreateMockRead(*stream1_body, 3), | 4979 CreateMockRead(*stream1_body, 3), |
| 4980 CreateMockRead(*stream2_headers, 4), | 4980 CreateMockRead(*stream2_headers, 4), |
| 4981 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), | 4981 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), |
| 4982 arraysize(kPushBodyFrame), 5), | 4982 arraysize(kPushBodyFrame), 5), |
| 4983 MockRead(ASYNC, 0, 5), // EOF | 4983 MockRead(ASYNC, 0, 5), // EOF |
| 4984 }; | 4984 }; |
| 4985 | 4985 |
| 4986 HttpResponseInfo response; | 4986 HttpResponseInfo response; |
| 4987 HttpResponseInfo response2; | 4987 HttpResponseInfo response2; |
| 4988 std::string expected_push_result("pushed"); | 4988 std::string expected_push_result("pushed"); |
| 4989 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData( | 4989 DeterministicSocketData* data = |
| 4990 reads, | 4990 new DeterministicSocketData(reads, arraysize(reads), |
| 4991 arraysize(reads), | 4991 writes, arraysize(writes)); |
| 4992 writes, | |
| 4993 arraysize(writes))); | |
| 4994 | 4992 |
| 4995 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 4993 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 4996 BoundNetLog(), GetParam(), NULL); | 4994 BoundNetLog(), GetParam(), NULL); |
| 4997 helper.SetDeterministic(); | 4995 helper.SetDeterministic(); |
| 4998 helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); | 4996 helper.AddDeterministicData(data); |
| 4999 helper.RunPreTestSetup(); | 4997 helper.RunPreTestSetup(); |
| 5000 | 4998 |
| 5001 HttpNetworkTransaction* trans = helper.trans(); | 4999 HttpNetworkTransaction* trans = helper.trans(); |
| 5002 | 5000 |
| 5003 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, | 5001 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, |
| 5004 // and the body of the primary stream, but before we've received the HEADERS | 5002 // and the body of the primary stream, but before we've received the HEADERS |
| 5005 // for the pushed stream. | 5003 // for the pushed stream. |
| 5006 data->SetStop(3); | 5004 data->SetStop(3); |
| 5007 | 5005 |
| 5008 // Start the transaction. | 5006 // Start the transaction. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5019 scoped_ptr<HttpNetworkTransaction> trans2( | 5017 scoped_ptr<HttpNetworkTransaction> trans2( |
| 5020 new HttpNetworkTransaction(helper.session())); | 5018 new HttpNetworkTransaction(helper.session())); |
| 5021 rv = trans2->Start( | 5019 rv = trans2->Start( |
| 5022 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 5020 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
| 5023 EXPECT_EQ(ERR_IO_PENDING, rv); | 5021 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5024 data->RunFor(3); | 5022 data->RunFor(3); |
| 5025 MessageLoop::current()->RunAllPending(); | 5023 MessageLoop::current()->RunAllPending(); |
| 5026 | 5024 |
| 5027 // Read the server push body. | 5025 // Read the server push body. |
| 5028 std::string result2; | 5026 std::string result2; |
| 5029 ReadResult(trans2.get(), data.get(), &result2); | 5027 ReadResult(trans2.get(), data, &result2); |
| 5030 // Read the response body. | 5028 // Read the response body. |
| 5031 std::string result; | 5029 std::string result; |
| 5032 ReadResult(trans, data, &result); | 5030 ReadResult(trans, data, &result); |
| 5033 | 5031 |
| 5034 // Verify that we consumed all test data. | 5032 // Verify that we consumed all test data. |
| 5035 EXPECT_TRUE(data->at_read_eof()); | 5033 EXPECT_TRUE(data->at_read_eof()); |
| 5036 EXPECT_TRUE(data->at_write_eof()); | 5034 EXPECT_TRUE(data->at_write_eof()); |
| 5037 | 5035 |
| 5038 // Verify that the received push data is same as the expected push data. | 5036 // Verify that the received push data is same as the expected push data. |
| 5039 EXPECT_EQ(result2.compare(expected_push_result), 0) | 5037 EXPECT_EQ(result2.compare(expected_push_result), 0) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5130 CreateMockRead(*stream2_headers1, 4), | 5128 CreateMockRead(*stream2_headers1, 4), |
| 5131 CreateMockRead(*stream2_headers2, 5), | 5129 CreateMockRead(*stream2_headers2, 5), |
| 5132 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), | 5130 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), |
| 5133 arraysize(kPushBodyFrame), 6), | 5131 arraysize(kPushBodyFrame), 6), |
| 5134 MockRead(ASYNC, 0, 6), // EOF | 5132 MockRead(ASYNC, 0, 6), // EOF |
| 5135 }; | 5133 }; |
| 5136 | 5134 |
| 5137 HttpResponseInfo response; | 5135 HttpResponseInfo response; |
| 5138 HttpResponseInfo response2; | 5136 HttpResponseInfo response2; |
| 5139 std::string expected_push_result("pushed"); | 5137 std::string expected_push_result("pushed"); |
| 5140 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData( | 5138 DeterministicSocketData* data = |
| 5141 reads, | 5139 new DeterministicSocketData(reads, arraysize(reads), |
| 5142 arraysize(reads), | 5140 writes, arraysize(writes)); |
| 5143 writes, | |
| 5144 arraysize(writes))); | |
| 5145 | 5141 |
| 5146 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 5142 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 5147 BoundNetLog(), GetParam(), NULL); | 5143 BoundNetLog(), GetParam(), NULL); |
| 5148 helper.SetDeterministic(); | 5144 helper.SetDeterministic(); |
| 5149 helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); | 5145 helper.AddDeterministicData(data); |
| 5150 helper.RunPreTestSetup(); | 5146 helper.RunPreTestSetup(); |
| 5151 | 5147 |
| 5152 HttpNetworkTransaction* trans = helper.trans(); | 5148 HttpNetworkTransaction* trans = helper.trans(); |
| 5153 | 5149 |
| 5154 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, | 5150 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, |
| 5155 // the first HEADERS frame, and the body of the primary stream, but before | 5151 // the first HEADERS frame, and the body of the primary stream, but before |
| 5156 // we've received the final HEADERS for the pushed stream. | 5152 // we've received the final HEADERS for the pushed stream. |
| 5157 data->SetStop(4); | 5153 data->SetStop(4); |
| 5158 | 5154 |
| 5159 // Start the transaction. | 5155 // Start the transaction. |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5584 MockRead reads[] = { | 5580 MockRead reads[] = { |
| 5585 CreateMockRead(*resp1, 1), | 5581 CreateMockRead(*resp1, 1), |
| 5586 CreateMockRead(*body1, 2), | 5582 CreateMockRead(*body1, 2), |
| 5587 CreateMockRead(*resp2, 5), | 5583 CreateMockRead(*resp2, 5), |
| 5588 CreateMockRead(*body2, 6), | 5584 CreateMockRead(*body2, 6), |
| 5589 CreateMockRead(*resp3, 7), | 5585 CreateMockRead(*resp3, 7), |
| 5590 CreateMockRead(*body3, 8), | 5586 CreateMockRead(*body3, 8), |
| 5591 MockRead(ASYNC, 0, 9) // EOF | 5587 MockRead(ASYNC, 0, 9) // EOF |
| 5592 }; | 5588 }; |
| 5593 | 5589 |
| 5594 scoped_refptr<DeterministicSocketData> data( | 5590 DeterministicSocketData* data = |
| 5595 new DeterministicSocketData(reads, arraysize(reads), | 5591 new DeterministicSocketData(reads, arraysize(reads), |
| 5596 writes, arraysize(writes))); | 5592 writes, arraysize(writes)); |
| 5593 |
| 5597 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 5594 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
| 5598 BoundNetLog(), GetParam(), NULL); | 5595 BoundNetLog(), GetParam(), NULL); |
| 5599 helper.SetDeterministic(); | 5596 helper.SetDeterministic(); |
| 5600 helper.RunPreTestSetup(); | 5597 helper.RunPreTestSetup(); |
| 5601 helper.AddDeterministicData(data.get()); | 5598 helper.AddDeterministicData(data); |
| 5602 | 5599 |
| 5603 // Start the first transaction to set up the SpdySession | 5600 // Start the first transaction to set up the SpdySession |
| 5604 HttpNetworkTransaction* trans = helper.trans(); | 5601 HttpNetworkTransaction* trans = helper.trans(); |
| 5605 TestCompletionCallback callback; | 5602 TestCompletionCallback callback; |
| 5606 HttpRequestInfo info1 = CreateGetRequest(); | 5603 HttpRequestInfo info1 = CreateGetRequest(); |
| 5607 info1.priority = LOWEST; | 5604 info1.priority = LOWEST; |
| 5608 int rv = trans->Start(&info1, callback.callback(), BoundNetLog()); | 5605 int rv = trans->Start(&info1, callback.callback(), BoundNetLog()); |
| 5609 EXPECT_EQ(ERR_IO_PENDING, rv); | 5606 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5610 | 5607 |
| 5611 // Run the message loop, but do not allow the write to complete. | 5608 // Run the message loop, but do not allow the write to complete. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5641 // And now we can allow everything else to run to completion. | 5638 // And now we can allow everything else to run to completion. |
| 5642 data->SetStop(10); | 5639 data->SetStop(10); |
| 5643 data->Run(); | 5640 data->Run(); |
| 5644 EXPECT_EQ(OK, callback2.WaitForResult()); | 5641 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 5645 EXPECT_EQ(OK, callback3.WaitForResult()); | 5642 EXPECT_EQ(OK, callback3.WaitForResult()); |
| 5646 | 5643 |
| 5647 helper.VerifyDataConsumed(); | 5644 helper.VerifyDataConsumed(); |
| 5648 } | 5645 } |
| 5649 | 5646 |
| 5650 } // namespace net | 5647 } // namespace net |
| OLD | NEW |