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" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void RunToCompletion(StaticSocketDataProvider* data) { | 225 void RunToCompletion(StaticSocketDataProvider* data) { |
226 RunPreTestSetup(); | 226 RunPreTestSetup(); |
227 AddData(data); | 227 AddData(data); |
228 RunDefaultTest(); | 228 RunDefaultTest(); |
229 VerifyDataConsumed(); | 229 VerifyDataConsumed(); |
230 } | 230 } |
231 | 231 |
232 void AddData(StaticSocketDataProvider* data) { | 232 void AddData(StaticSocketDataProvider* data) { |
233 DCHECK(!deterministic_); | 233 DCHECK(!deterministic_); |
234 data_vector_.push_back(data); | 234 data_vector_.push_back(data); |
235 linked_ptr<SSLSocketDataProvider> ssl_( | 235 SSLSocketDataProvider* ssl_provider = |
236 new SSLSocketDataProvider(ASYNC, OK)); | 236 new SSLSocketDataProvider(ASYNC, OK); |
237 if (test_type_ == SPDYNPN) { | 237 if (test_type_ == SPDYNPN) |
238 ssl_->SetNextProto(kProtoSPDY3); | 238 ssl_provider->SetNextProto(kProtoSPDY3); |
239 } | 239 |
240 ssl_vector_.push_back(ssl_); | 240 ssl_vector_.push_back(ssl_provider); |
241 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) | 241 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) |
242 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get()); | 242 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_provider); |
| 243 |
243 session_deps_->socket_factory->AddSocketDataProvider(data); | 244 session_deps_->socket_factory->AddSocketDataProvider(data); |
244 if (test_type_ == SPDYNPN) { | 245 if (test_type_ == SPDYNPN) { |
245 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 246 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
246 linked_ptr<StaticSocketDataProvider> | 247 StaticSocketDataProvider* hanging_non_alternate_protocol_socket = |
247 hanging_non_alternate_protocol_socket( | 248 new StaticSocketDataProvider(NULL, 0, NULL, 0); |
248 new StaticSocketDataProvider(NULL, 0, NULL, 0)); | |
249 hanging_non_alternate_protocol_socket->set_connect_data( | 249 hanging_non_alternate_protocol_socket->set_connect_data( |
250 never_finishing_connect); | 250 never_finishing_connect); |
251 session_deps_->socket_factory->AddSocketDataProvider( | 251 session_deps_->socket_factory->AddSocketDataProvider( |
252 hanging_non_alternate_protocol_socket.get()); | 252 hanging_non_alternate_protocol_socket); |
253 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); | 253 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 void AddDeterministicData(DeterministicSocketData* data) { | 257 void AddDeterministicData(DeterministicSocketData* data) { |
258 DCHECK(deterministic_); | 258 DCHECK(deterministic_); |
259 data_vector_.push_back(data); | 259 data_vector_.push_back(data); |
260 linked_ptr<SSLSocketDataProvider> ssl_( | 260 SSLSocketDataProvider* ssl_provider = |
261 new SSLSocketDataProvider(ASYNC, OK)); | 261 new SSLSocketDataProvider(ASYNC, OK); |
262 if (test_type_ == SPDYNPN) { | 262 if (test_type_ == SPDYNPN) |
263 ssl_->SetNextProto(kProtoSPDY3); | 263 ssl_provider->SetNextProto(kProtoSPDY3); |
264 } | 264 |
265 ssl_vector_.push_back(ssl_); | 265 ssl_vector_.push_back(ssl_provider); |
266 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { | 266 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { |
267 session_deps_->deterministic_socket_factory-> | 267 session_deps_->deterministic_socket_factory-> |
268 AddSSLSocketDataProvider(ssl_.get()); | 268 AddSSLSocketDataProvider(ssl_provider); |
269 } | 269 } |
270 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); | 270 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); |
271 if (test_type_ == SPDYNPN) { | 271 if (test_type_ == SPDYNPN) { |
272 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 272 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
273 scoped_refptr<DeterministicSocketData> | 273 DeterministicSocketData* hanging_non_alternate_protocol_socket = |
274 hanging_non_alternate_protocol_socket( | 274 new DeterministicSocketData(NULL, 0, NULL, 0); |
275 new DeterministicSocketData(NULL, 0, NULL, 0)); | |
276 hanging_non_alternate_protocol_socket->set_connect_data( | 275 hanging_non_alternate_protocol_socket->set_connect_data( |
277 never_finishing_connect); | 276 never_finishing_connect); |
278 session_deps_->deterministic_socket_factory->AddSocketDataProvider( | 277 session_deps_->deterministic_socket_factory->AddSocketDataProvider( |
279 hanging_non_alternate_protocol_socket); | 278 hanging_non_alternate_protocol_socket); |
280 alternate_deterministic_vector_.push_back( | 279 alternate_deterministic_vector_.push_back( |
281 hanging_non_alternate_protocol_socket); | 280 hanging_non_alternate_protocol_socket); |
282 } | 281 } |
283 } | 282 } |
284 | 283 |
285 // This can only be called after RunPreTestSetup. It adds a Data Provider, | |
286 // but not a corresponding SSL data provider | |
287 void AddDataNoSSL(StaticSocketDataProvider* data) { | |
288 DCHECK(!deterministic_); | |
289 session_deps_->socket_factory->AddSocketDataProvider(data); | |
290 } | |
291 void AddDataNoSSL(DeterministicSocketData* data) { | |
292 DCHECK(deterministic_); | |
293 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); | |
294 } | |
295 | |
296 void SetSession(const scoped_refptr<HttpNetworkSession>& session) { | 284 void SetSession(const scoped_refptr<HttpNetworkSession>& session) { |
297 session_ = session; | 285 session_ = session; |
298 } | 286 } |
299 HttpNetworkTransaction* trans() { return trans_.get(); } | 287 HttpNetworkTransaction* trans() { return trans_.get(); } |
300 void ResetTrans() { trans_.reset(); } | 288 void ResetTrans() { trans_.reset(); } |
301 TransactionHelperResult& output() { return output_; } | 289 TransactionHelperResult& output() { return output_; } |
302 const HttpRequestInfo& request() const { return request_; } | 290 const HttpRequestInfo& request() const { return request_; } |
303 const scoped_refptr<HttpNetworkSession>& session() const { | 291 const scoped_refptr<HttpNetworkSession>& session() const { |
304 return session_; | 292 return session_; |
305 } | 293 } |
306 scoped_ptr<SpdySessionDependencies>& session_deps() { | 294 scoped_ptr<SpdySessionDependencies>& session_deps() { |
307 return session_deps_; | 295 return session_deps_; |
308 } | 296 } |
309 int port() const { return port_; } | 297 int port() const { return port_; } |
310 SpdyNetworkTransactionSpdy3TestTypes test_type() const { | 298 SpdyNetworkTransactionSpdy3TestTypes test_type() const { |
311 return test_type_; | 299 return test_type_; |
312 } | 300 } |
313 | 301 |
314 private: | 302 private: |
315 typedef std::vector<StaticSocketDataProvider*> DataVector; | 303 typedef std::vector<StaticSocketDataProvider*> DataVector; |
316 typedef std::vector<linked_ptr<SSLSocketDataProvider> > SSLVector; | 304 typedef ScopedVector<SSLSocketDataProvider> SSLVector; |
317 typedef std::vector<linked_ptr<StaticSocketDataProvider> > AlternateVector; | 305 typedef ScopedVector<StaticSocketDataProvider> AlternateVector; |
318 typedef std::vector<scoped_refptr<DeterministicSocketData> > | 306 typedef ScopedVector<DeterministicSocketData> AlternateDeterministicVector; |
319 AlternateDeterministicVector; | |
320 HttpRequestInfo request_; | 307 HttpRequestInfo request_; |
321 scoped_ptr<SpdySessionDependencies> session_deps_; | 308 scoped_ptr<SpdySessionDependencies> session_deps_; |
322 scoped_refptr<HttpNetworkSession> session_; | 309 scoped_refptr<HttpNetworkSession> session_; |
323 TransactionHelperResult output_; | 310 TransactionHelperResult output_; |
324 scoped_ptr<StaticSocketDataProvider> first_transaction_; | 311 scoped_ptr<StaticSocketDataProvider> first_transaction_; |
325 SSLVector ssl_vector_; | 312 SSLVector ssl_vector_; |
326 TestCompletionCallback callback; | 313 TestCompletionCallback callback; |
327 scoped_ptr<HttpNetworkTransaction> trans_; | 314 scoped_ptr<HttpNetworkTransaction> trans_; |
328 scoped_ptr<HttpNetworkTransaction> trans_http_; | 315 scoped_ptr<HttpNetworkTransaction> trans_http_; |
329 DataVector data_vector_; | 316 DataVector data_vector_; |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 MockWrite(SYNCHRONOUS, 0, 0, 2), | 1762 MockWrite(SYNCHRONOUS, 0, 0, 2), |
1776 CreateMockWrite(*rst.get(), 3, SYNCHRONOUS), | 1763 CreateMockWrite(*rst.get(), 3, SYNCHRONOUS), |
1777 }; | 1764 }; |
1778 | 1765 |
1779 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1766 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
1780 MockRead reads[] = { | 1767 MockRead reads[] = { |
1781 CreateMockRead(*resp.get(), 1, ASYNC), | 1768 CreateMockRead(*resp.get(), 1, ASYNC), |
1782 MockRead(ASYNC, 0, 0, 4) // EOF | 1769 MockRead(ASYNC, 0, 0, 4) // EOF |
1783 }; | 1770 }; |
1784 | 1771 |
1785 scoped_refptr<DeterministicSocketData> data( | 1772 scoped_ptr<DeterministicSocketData> data( |
1786 new DeterministicSocketData(reads, arraysize(reads), | 1773 new DeterministicSocketData(reads, arraysize(reads), |
1787 writes, arraysize(writes))); | 1774 writes, arraysize(writes))); |
1788 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 1775 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
1789 BoundNetLog(), GetParam(), NULL); | 1776 BoundNetLog(), GetParam(), NULL); |
1790 helper.SetDeterministic(); | 1777 helper.SetDeterministic(); |
1791 helper.RunPreTestSetup(); | 1778 helper.RunPreTestSetup(); |
1792 helper.AddDeterministicData(data.get()); | 1779 helper.AddDeterministicData(data.get()); |
1793 HttpNetworkTransaction* trans = helper.trans(); | 1780 HttpNetworkTransaction* trans = helper.trans(); |
1794 | 1781 |
1795 TestCompletionCallback callback; | 1782 TestCompletionCallback callback; |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 CreateMockWrite(*req, 0, SYNCHRONOUS), | 2532 CreateMockWrite(*req, 0, SYNCHRONOUS), |
2546 CreateMockWrite(*rst, 2, SYNCHRONOUS), | 2533 CreateMockWrite(*rst, 2, SYNCHRONOUS), |
2547 }; | 2534 }; |
2548 | 2535 |
2549 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 2536 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
2550 MockRead reads[] = { | 2537 MockRead reads[] = { |
2551 CreateMockRead(*resp, 1, ASYNC), | 2538 CreateMockRead(*resp, 1, ASYNC), |
2552 MockRead(ASYNC, 0, 0, 3) // EOF | 2539 MockRead(ASYNC, 0, 0, 3) // EOF |
2553 }; | 2540 }; |
2554 | 2541 |
2555 scoped_refptr<DeterministicSocketData> data( | 2542 scoped_ptr<DeterministicSocketData> data( |
2556 new DeterministicSocketData(reads, arraysize(reads), | 2543 new DeterministicSocketData(reads, arraysize(reads), |
2557 writes, arraysize(writes))); | 2544 writes, arraysize(writes))); |
2558 | 2545 |
2559 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 2546 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
2560 BoundNetLog(), | 2547 BoundNetLog(), |
2561 GetParam(), NULL); | 2548 GetParam(), NULL); |
2562 helper.SetDeterministic(); | 2549 helper.SetDeterministic(); |
2563 helper.RunPreTestSetup(); | 2550 helper.RunPreTestSetup(); |
2564 helper.AddDeterministicData(data.get()); | 2551 helper.AddDeterministicData(data.get()); |
2565 HttpNetworkTransaction* trans = helper.trans(); | 2552 HttpNetworkTransaction* trans = helper.trans(); |
(...skipping 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5558 CreateMockRead(*stream1_body, 3), | 5545 CreateMockRead(*stream1_body, 3), |
5559 CreateMockRead(*stream2_headers, 4), | 5546 CreateMockRead(*stream2_headers, 4), |
5560 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), | 5547 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), |
5561 arraysize(kPushBodyFrame), 5), | 5548 arraysize(kPushBodyFrame), 5), |
5562 MockRead(ASYNC, 0, 5), // EOF | 5549 MockRead(ASYNC, 0, 5), // EOF |
5563 }; | 5550 }; |
5564 | 5551 |
5565 HttpResponseInfo response; | 5552 HttpResponseInfo response; |
5566 HttpResponseInfo response2; | 5553 HttpResponseInfo response2; |
5567 std::string expected_push_result("pushed"); | 5554 std::string expected_push_result("pushed"); |
5568 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData( | 5555 scoped_ptr<DeterministicSocketData> data( |
5569 reads, | 5556 new DeterministicSocketData(reads, arraysize(reads), |
5570 arraysize(reads), | 5557 writes, arraysize(writes))); |
5571 writes, | |
5572 arraysize(writes))); | |
5573 | 5558 |
5574 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 5559 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
5575 BoundNetLog(), GetParam(), NULL); | 5560 BoundNetLog(), GetParam(), NULL); |
5576 helper.SetDeterministic(); | 5561 helper.SetDeterministic(); |
5577 helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); | 5562 helper.AddDeterministicData(data.get()); |
5578 helper.RunPreTestSetup(); | 5563 helper.RunPreTestSetup(); |
5579 | 5564 |
5580 HttpNetworkTransaction* trans = helper.trans(); | 5565 HttpNetworkTransaction* trans = helper.trans(); |
5581 | 5566 |
5582 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, | 5567 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, |
5583 // and the body of the primary stream, but before we've received the HEADERS | 5568 // and the body of the primary stream, but before we've received the HEADERS |
5584 // for the pushed stream. | 5569 // for the pushed stream. |
5585 data->SetStop(3); | 5570 data->SetStop(3); |
5586 | 5571 |
5587 // Start the transaction. | 5572 // Start the transaction. |
(...skipping 13 matching lines...) Expand all Loading... |
5601 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 5586 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
5602 EXPECT_EQ(ERR_IO_PENDING, rv); | 5587 EXPECT_EQ(ERR_IO_PENDING, rv); |
5603 data->RunFor(3); | 5588 data->RunFor(3); |
5604 MessageLoop::current()->RunAllPending(); | 5589 MessageLoop::current()->RunAllPending(); |
5605 | 5590 |
5606 // Read the server push body. | 5591 // Read the server push body. |
5607 std::string result2; | 5592 std::string result2; |
5608 ReadResult(trans2.get(), data.get(), &result2); | 5593 ReadResult(trans2.get(), data.get(), &result2); |
5609 // Read the response body. | 5594 // Read the response body. |
5610 std::string result; | 5595 std::string result; |
5611 ReadResult(trans, data, &result); | 5596 ReadResult(trans, data.get(), &result); |
5612 | 5597 |
5613 // Verify that we consumed all test data. | 5598 // Verify that we consumed all test data. |
5614 EXPECT_TRUE(data->at_read_eof()); | 5599 EXPECT_TRUE(data->at_read_eof()); |
5615 EXPECT_TRUE(data->at_write_eof()); | 5600 EXPECT_TRUE(data->at_write_eof()); |
5616 | 5601 |
5617 // Verify that the received push data is same as the expected push data. | 5602 // Verify that the received push data is same as the expected push data. |
5618 EXPECT_EQ(result2.compare(expected_push_result), 0) | 5603 EXPECT_EQ(result2.compare(expected_push_result), 0) |
5619 << "Received data: " | 5604 << "Received data: " |
5620 << result2 | 5605 << result2 |
5621 << "||||| Expected data: " | 5606 << "||||| Expected data: " |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5710 CreateMockRead(*stream2_headers1, 4), | 5695 CreateMockRead(*stream2_headers1, 4), |
5711 CreateMockRead(*stream2_headers2, 5), | 5696 CreateMockRead(*stream2_headers2, 5), |
5712 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), | 5697 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), |
5713 arraysize(kPushBodyFrame), 6), | 5698 arraysize(kPushBodyFrame), 6), |
5714 MockRead(ASYNC, 0, 6), // EOF | 5699 MockRead(ASYNC, 0, 6), // EOF |
5715 }; | 5700 }; |
5716 | 5701 |
5717 HttpResponseInfo response; | 5702 HttpResponseInfo response; |
5718 HttpResponseInfo response2; | 5703 HttpResponseInfo response2; |
5719 std::string expected_push_result("pushed"); | 5704 std::string expected_push_result("pushed"); |
5720 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData( | 5705 scoped_ptr<DeterministicSocketData> data( |
5721 reads, | 5706 new DeterministicSocketData(reads, arraysize(reads), |
5722 arraysize(reads), | 5707 writes, arraysize(writes))); |
5723 writes, | |
5724 arraysize(writes))); | |
5725 | 5708 |
5726 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 5709 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
5727 BoundNetLog(), GetParam(), NULL); | 5710 BoundNetLog(), GetParam(), NULL); |
5728 helper.SetDeterministic(); | 5711 helper.SetDeterministic(); |
5729 helper.AddDeterministicData(static_cast<DeterministicSocketData*>(data)); | 5712 helper.AddDeterministicData(data.get()); |
5730 helper.RunPreTestSetup(); | 5713 helper.RunPreTestSetup(); |
5731 | 5714 |
5732 HttpNetworkTransaction* trans = helper.trans(); | 5715 HttpNetworkTransaction* trans = helper.trans(); |
5733 | 5716 |
5734 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, | 5717 // Run until we've received the primary SYN_STREAM, the pushed SYN_STREAM, |
5735 // the first HEADERS frame, and the body of the primary stream, but before | 5718 // the first HEADERS frame, and the body of the primary stream, but before |
5736 // we've received the final HEADERS for the pushed stream. | 5719 // we've received the final HEADERS for the pushed stream. |
5737 data->SetStop(4); | 5720 data->SetStop(4); |
5738 | 5721 |
5739 // Start the transaction. | 5722 // Start the transaction. |
(...skipping 10 matching lines...) Expand all Loading... |
5750 scoped_ptr<HttpNetworkTransaction> trans2( | 5733 scoped_ptr<HttpNetworkTransaction> trans2( |
5751 new HttpNetworkTransaction(helper.session())); | 5734 new HttpNetworkTransaction(helper.session())); |
5752 rv = trans2->Start( | 5735 rv = trans2->Start( |
5753 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); | 5736 &CreateGetPushRequest(), callback.callback(), BoundNetLog()); |
5754 EXPECT_EQ(ERR_IO_PENDING, rv); | 5737 EXPECT_EQ(ERR_IO_PENDING, rv); |
5755 data->RunFor(3); | 5738 data->RunFor(3); |
5756 MessageLoop::current()->RunAllPending(); | 5739 MessageLoop::current()->RunAllPending(); |
5757 | 5740 |
5758 // Read the server push body. | 5741 // Read the server push body. |
5759 std::string result2; | 5742 std::string result2; |
5760 ReadResult(trans2.get(), data, &result2); | 5743 ReadResult(trans2.get(), data.get(), &result2); |
5761 // Read the response body. | 5744 // Read the response body. |
5762 std::string result; | 5745 std::string result; |
5763 ReadResult(trans, data, &result); | 5746 ReadResult(trans, data.get(), &result); |
5764 | 5747 |
5765 // Verify that we consumed all test data. | 5748 // Verify that we consumed all test data. |
5766 EXPECT_TRUE(data->at_read_eof()); | 5749 EXPECT_TRUE(data->at_read_eof()); |
5767 EXPECT_TRUE(data->at_write_eof()); | 5750 EXPECT_TRUE(data->at_write_eof()); |
5768 | 5751 |
5769 // Verify that the received push data is same as the expected push data. | 5752 // Verify that the received push data is same as the expected push data. |
5770 EXPECT_EQ(result2.compare(expected_push_result), 0) | 5753 EXPECT_EQ(result2.compare(expected_push_result), 0) |
5771 << "Received data: " | 5754 << "Received data: " |
5772 << result2 | 5755 << result2 |
5773 << "||||| Expected data: " | 5756 << "||||| Expected data: " |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6167 MockRead reads[] = { | 6150 MockRead reads[] = { |
6168 CreateMockRead(*resp1, 1), | 6151 CreateMockRead(*resp1, 1), |
6169 CreateMockRead(*body1, 2), | 6152 CreateMockRead(*body1, 2), |
6170 CreateMockRead(*resp2, 5), | 6153 CreateMockRead(*resp2, 5), |
6171 CreateMockRead(*body2, 6), | 6154 CreateMockRead(*body2, 6), |
6172 CreateMockRead(*resp3, 7), | 6155 CreateMockRead(*resp3, 7), |
6173 CreateMockRead(*body3, 8), | 6156 CreateMockRead(*body3, 8), |
6174 MockRead(ASYNC, 0, 9) // EOF | 6157 MockRead(ASYNC, 0, 9) // EOF |
6175 }; | 6158 }; |
6176 | 6159 |
6177 scoped_refptr<DeterministicSocketData> data( | 6160 scoped_ptr<DeterministicSocketData> data( |
6178 new DeterministicSocketData(reads, arraysize(reads), | 6161 new DeterministicSocketData(reads, arraysize(reads), |
6179 writes, arraysize(writes))); | 6162 writes, arraysize(writes))); |
6180 NormalSpdyTransactionHelper helper(CreateGetRequest(), | 6163 NormalSpdyTransactionHelper helper(CreateGetRequest(), |
6181 BoundNetLog(), GetParam(), NULL); | 6164 BoundNetLog(), GetParam(), NULL); |
6182 helper.SetDeterministic(); | 6165 helper.SetDeterministic(); |
6183 helper.RunPreTestSetup(); | 6166 helper.RunPreTestSetup(); |
6184 helper.AddDeterministicData(data.get()); | 6167 helper.AddDeterministicData(data.get()); |
6185 | 6168 |
6186 // Start the first transaction to set up the SpdySession | 6169 // Start the first transaction to set up the SpdySession |
6187 HttpNetworkTransaction* trans = helper.trans(); | 6170 HttpNetworkTransaction* trans = helper.trans(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6224 // And now we can allow everything else to run to completion. | 6207 // And now we can allow everything else to run to completion. |
6225 data->SetStop(10); | 6208 data->SetStop(10); |
6226 data->Run(); | 6209 data->Run(); |
6227 EXPECT_EQ(OK, callback2.WaitForResult()); | 6210 EXPECT_EQ(OK, callback2.WaitForResult()); |
6228 EXPECT_EQ(OK, callback3.WaitForResult()); | 6211 EXPECT_EQ(OK, callback3.WaitForResult()); |
6229 | 6212 |
6230 helper.VerifyDataConsumed(); | 6213 helper.VerifyDataConsumed(); |
6231 } | 6214 } |
6232 | 6215 |
6233 } // namespace net | 6216 } // namespace net |
OLD | NEW |