Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 9425016: Change MockRead and MockWrite (et. al.) to take an IoMode enum, instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_http_stream_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 RunPreTestSetup(); 224 RunPreTestSetup();
225 AddData(data); 225 AddData(data);
226 RunDefaultTest(); 226 RunDefaultTest();
227 VerifyDataConsumed(); 227 VerifyDataConsumed();
228 } 228 }
229 229
230 void AddData(StaticSocketDataProvider* data) { 230 void AddData(StaticSocketDataProvider* data) {
231 DCHECK(!deterministic_); 231 DCHECK(!deterministic_);
232 data_vector_.push_back(data); 232 data_vector_.push_back(data);
233 linked_ptr<SSLSocketDataProvider> ssl_( 233 linked_ptr<SSLSocketDataProvider> ssl_(
234 new SSLSocketDataProvider(true, OK)); 234 new SSLSocketDataProvider(ASYNC, OK));
235 if (test_type_ == SPDYNPN) { 235 if (test_type_ == SPDYNPN) {
236 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY21); 236 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY21);
237 } 237 }
238 ssl_vector_.push_back(ssl_); 238 ssl_vector_.push_back(ssl_);
239 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) 239 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL)
240 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get()); 240 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get());
241 session_deps_->socket_factory->AddSocketDataProvider(data); 241 session_deps_->socket_factory->AddSocketDataProvider(data);
242 if (test_type_ == SPDYNPN) { 242 if (test_type_ == SPDYNPN) {
243 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); 243 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
244 linked_ptr<StaticSocketDataProvider> 244 linked_ptr<StaticSocketDataProvider>
245 hanging_non_alternate_protocol_socket( 245 hanging_non_alternate_protocol_socket(
246 new StaticSocketDataProvider(NULL, 0, NULL, 0)); 246 new StaticSocketDataProvider(NULL, 0, NULL, 0));
247 hanging_non_alternate_protocol_socket->set_connect_data( 247 hanging_non_alternate_protocol_socket->set_connect_data(
248 never_finishing_connect); 248 never_finishing_connect);
249 session_deps_->socket_factory->AddSocketDataProvider( 249 session_deps_->socket_factory->AddSocketDataProvider(
250 hanging_non_alternate_protocol_socket.get()); 250 hanging_non_alternate_protocol_socket.get());
251 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); 251 alternate_vector_.push_back(hanging_non_alternate_protocol_socket);
252 } 252 }
253 } 253 }
254 254
255 void AddDeterministicData(DeterministicSocketData* data) { 255 void AddDeterministicData(DeterministicSocketData* data) {
256 DCHECK(deterministic_); 256 DCHECK(deterministic_);
257 data_vector_.push_back(data); 257 data_vector_.push_back(data);
258 linked_ptr<SSLSocketDataProvider> ssl_( 258 linked_ptr<SSLSocketDataProvider> ssl_(
259 new SSLSocketDataProvider(true, OK)); 259 new SSLSocketDataProvider(ASYNC, OK));
260 if (test_type_ == SPDYNPN) { 260 if (test_type_ == SPDYNPN) {
261 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY21); 261 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY21);
262 } 262 }
263 ssl_vector_.push_back(ssl_); 263 ssl_vector_.push_back(ssl_);
264 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { 264 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) {
265 session_deps_->deterministic_socket_factory-> 265 session_deps_->deterministic_socket_factory->
266 AddSSLSocketDataProvider(ssl_.get()); 266 AddSSLSocketDataProvider(ssl_.get());
267 } 267 }
268 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); 268 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data);
269 if (test_type_ == SPDYNPN) { 269 if (test_type_ == SPDYNPN) {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 TEST_P(SpdyNetworkTransactionTest, Get) { 544 TEST_P(SpdyNetworkTransactionTest, Get) {
545 // Construct the request. 545 // Construct the request.
546 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 546 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
547 MockWrite writes[] = { CreateMockWrite(*req) }; 547 MockWrite writes[] = { CreateMockWrite(*req) };
548 548
549 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 549 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
550 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 550 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
551 MockRead reads[] = { 551 MockRead reads[] = {
552 CreateMockRead(*resp), 552 CreateMockRead(*resp),
553 CreateMockRead(*body), 553 CreateMockRead(*body),
554 MockRead(true, 0, 0) // EOF 554 MockRead(ASYNC, 0, 0) // EOF
555 }; 555 };
556 556
557 scoped_ptr<DelayedSocketData> data( 557 scoped_ptr<DelayedSocketData> data(
558 new DelayedSocketData(1, reads, arraysize(reads), 558 new DelayedSocketData(1, reads, arraysize(reads),
559 writes, arraysize(writes))); 559 writes, arraysize(writes)));
560 NormalSpdyTransactionHelper helper(CreateGetRequest(), 560 NormalSpdyTransactionHelper helper(CreateGetRequest(),
561 BoundNetLog(), GetParam()); 561 BoundNetLog(), GetParam());
562 helper.RunToCompletion(data.get()); 562 helper.RunToCompletion(data.get());
563 TransactionHelperResult out = helper.output(); 563 TransactionHelperResult out = helper.output();
564 EXPECT_EQ(OK, out.rv); 564 EXPECT_EQ(OK, out.rv);
(...skipping 29 matching lines...) Expand all
594 break; 594 break;
595 default: 595 default:
596 FAIL(); 596 FAIL();
597 } 597 }
598 598
599 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 599 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
600 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 600 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
601 MockRead reads[] = { 601 MockRead reads[] = {
602 CreateMockRead(*resp), 602 CreateMockRead(*resp),
603 CreateMockRead(*body), 603 CreateMockRead(*body),
604 MockRead(true, 0, 0) // EOF 604 MockRead(ASYNC, 0, 0) // EOF
605 }; 605 };
606 606
607 scoped_ptr<DelayedSocketData> data( 607 scoped_ptr<DelayedSocketData> data(
608 new DelayedSocketData(1, reads, arraysize(reads), 608 new DelayedSocketData(1, reads, arraysize(reads),
609 writes, arraysize(writes))); 609 writes, arraysize(writes)));
610 HttpRequestInfo http_req = CreateGetRequest(); 610 HttpRequestInfo http_req = CreateGetRequest();
611 http_req.priority = p; 611 http_req.priority = p;
612 612
613 NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), GetParam()); 613 NormalSpdyTransactionHelper helper(http_req, BoundNetLog(), GetParam());
614 helper.RunToCompletion(data.get()); 614 helper.RunToCompletion(data.get());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 CreateMockRead(*body), 655 CreateMockRead(*body),
656 CreateMockRead(*resp2, 4), 656 CreateMockRead(*resp2, 4),
657 CreateMockRead(*body2), 657 CreateMockRead(*body2),
658 CreateMockRead(*resp3, 7), 658 CreateMockRead(*resp3, 7),
659 CreateMockRead(*body3), 659 CreateMockRead(*body3),
660 660
661 CreateMockRead(*fbody), 661 CreateMockRead(*fbody),
662 CreateMockRead(*fbody2), 662 CreateMockRead(*fbody2),
663 CreateMockRead(*fbody3), 663 CreateMockRead(*fbody3),
664 664
665 MockRead(true, 0, 0), // EOF 665 MockRead(ASYNC, 0, 0), // EOF
666 }; 666 };
667 scoped_ptr<OrderedSocketData> data( 667 scoped_ptr<OrderedSocketData> data(
668 new OrderedSocketData(reads, arraysize(reads), 668 new OrderedSocketData(reads, arraysize(reads),
669 writes, arraysize(writes))); 669 writes, arraysize(writes)));
670 scoped_ptr<OrderedSocketData> data_placeholder( 670 scoped_ptr<OrderedSocketData> data_placeholder(
671 new OrderedSocketData(NULL, 0, NULL, 0)); 671 new OrderedSocketData(NULL, 0, NULL, 0));
672 672
673 BoundNetLog log; 673 BoundNetLog log;
674 TransactionHelperResult out; 674 TransactionHelperResult out;
675 NormalSpdyTransactionHelper helper(CreateGetRequest(), 675 NormalSpdyTransactionHelper helper(CreateGetRequest(),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 CreateMockWrite(*req), 739 CreateMockWrite(*req),
740 CreateMockWrite(*req2), 740 CreateMockWrite(*req2),
741 }; 741 };
742 MockRead reads[] = { 742 MockRead reads[] = {
743 CreateMockRead(*resp, 1), 743 CreateMockRead(*resp, 1),
744 CreateMockRead(*body), 744 CreateMockRead(*body),
745 CreateMockRead(*resp2, 4), 745 CreateMockRead(*resp2, 4),
746 CreateMockRead(*body2), 746 CreateMockRead(*body2),
747 CreateMockRead(*fbody), 747 CreateMockRead(*fbody),
748 CreateMockRead(*fbody2), 748 CreateMockRead(*fbody2),
749 MockRead(true, 0, 0), // EOF 749 MockRead(ASYNC, 0, 0), // EOF
750 }; 750 };
751 scoped_ptr<OrderedSocketData> data( 751 scoped_ptr<OrderedSocketData> data(
752 new OrderedSocketData(reads, arraysize(reads), 752 new OrderedSocketData(reads, arraysize(reads),
753 writes, arraysize(writes))); 753 writes, arraysize(writes)));
754 754
755 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); 755 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
756 756
757 scoped_ptr<OrderedSocketData> data_placeholder( 757 scoped_ptr<OrderedSocketData> data_placeholder(
758 new OrderedSocketData(NULL, 0, NULL, 0)); 758 new OrderedSocketData(NULL, 0, NULL, 0));
759 data_placeholder->set_connect_data(never_finishing_connect); 759 data_placeholder->set_connect_data(never_finishing_connect);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 CreateMockWrite(*req), 826 CreateMockWrite(*req),
827 CreateMockWrite(*req2), 827 CreateMockWrite(*req2),
828 }; 828 };
829 MockRead reads[] = { 829 MockRead reads[] = {
830 CreateMockRead(*resp, 1), 830 CreateMockRead(*resp, 1),
831 CreateMockRead(*body), 831 CreateMockRead(*body),
832 CreateMockRead(*resp2, 4), 832 CreateMockRead(*resp2, 4),
833 CreateMockRead(*body2), 833 CreateMockRead(*body2),
834 CreateMockRead(*fbody), 834 CreateMockRead(*fbody),
835 CreateMockRead(*fbody2), 835 CreateMockRead(*fbody2),
836 MockRead(true, 0, 0), // EOF 836 MockRead(ASYNC, 0, 0), // EOF
837 }; 837 };
838 scoped_ptr<OrderedSocketData> preconnect_data( 838 scoped_ptr<OrderedSocketData> preconnect_data(
839 new OrderedSocketData(reads, arraysize(reads), 839 new OrderedSocketData(reads, arraysize(reads),
840 writes, arraysize(writes))); 840 writes, arraysize(writes)));
841 841
842 MockConnect never_finishing_connect(ASYNC, ERR_IO_PENDING); 842 MockConnect never_finishing_connect(ASYNC, ERR_IO_PENDING);
843 843
844 scoped_ptr<OrderedSocketData> data_placeholder( 844 scoped_ptr<OrderedSocketData> data_placeholder(
845 new OrderedSocketData(NULL, 0, NULL, 0)); 845 new OrderedSocketData(NULL, 0, NULL, 0));
846 data_placeholder->set_connect_data(never_finishing_connect); 846 data_placeholder->set_connect_data(never_finishing_connect);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 CreateMockRead(*resp), 952 CreateMockRead(*resp),
953 CreateMockRead(*body), 953 CreateMockRead(*body),
954 CreateMockRead(*fbody), 954 CreateMockRead(*fbody),
955 CreateMockRead(*resp2, 7), 955 CreateMockRead(*resp2, 7),
956 CreateMockRead(*body2), 956 CreateMockRead(*body2),
957 CreateMockRead(*fbody2), 957 CreateMockRead(*fbody2),
958 CreateMockRead(*resp3, 12), 958 CreateMockRead(*resp3, 12),
959 CreateMockRead(*body3), 959 CreateMockRead(*body3),
960 CreateMockRead(*fbody3), 960 CreateMockRead(*fbody3),
961 961
962 MockRead(true, 0, 0), // EOF 962 MockRead(ASYNC, 0, 0), // EOF
963 }; 963 };
964 964
965 scoped_ptr<OrderedSocketData> data( 965 scoped_ptr<OrderedSocketData> data(
966 new OrderedSocketData(reads, arraysize(reads), 966 new OrderedSocketData(reads, arraysize(reads),
967 writes, arraysize(writes))); 967 writes, arraysize(writes)));
968 scoped_ptr<OrderedSocketData> data_placeholder( 968 scoped_ptr<OrderedSocketData> data_placeholder(
969 new OrderedSocketData(NULL, 0, NULL, 0)); 969 new OrderedSocketData(NULL, 0, NULL, 0));
970 970
971 BoundNetLog log; 971 BoundNetLog log;
972 TransactionHelperResult out; 972 TransactionHelperResult out;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 CreateMockRead(*fbody), 1092 CreateMockRead(*fbody),
1093 CreateMockRead(*resp2, 7), 1093 CreateMockRead(*resp2, 7),
1094 CreateMockRead(*body2), 1094 CreateMockRead(*body2),
1095 CreateMockRead(*fbody2), 1095 CreateMockRead(*fbody2),
1096 CreateMockRead(*resp4, 13), 1096 CreateMockRead(*resp4, 13),
1097 CreateMockRead(*fbody4), 1097 CreateMockRead(*fbody4),
1098 CreateMockRead(*resp3, 16), 1098 CreateMockRead(*resp3, 16),
1099 CreateMockRead(*body3), 1099 CreateMockRead(*body3),
1100 CreateMockRead(*fbody3), 1100 CreateMockRead(*fbody3),
1101 1101
1102 MockRead(true, 0, 0), // EOF 1102 MockRead(ASYNC, 0, 0), // EOF
1103 }; 1103 };
1104 1104
1105 scoped_ptr<OrderedSocketData> data( 1105 scoped_ptr<OrderedSocketData> data(
1106 new OrderedSocketData(reads, arraysize(reads), 1106 new OrderedSocketData(reads, arraysize(reads),
1107 writes, arraysize(writes))); 1107 writes, arraysize(writes)));
1108 scoped_ptr<OrderedSocketData> data_placeholder( 1108 scoped_ptr<OrderedSocketData> data_placeholder(
1109 new OrderedSocketData(NULL, 0, NULL, 0)); 1109 new OrderedSocketData(NULL, 0, NULL, 0));
1110 1110
1111 BoundNetLog log; 1111 BoundNetLog log;
1112 TransactionHelperResult out; 1112 TransactionHelperResult out;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 CreateMockWrite(*req2), 1229 CreateMockWrite(*req2),
1230 }; 1230 };
1231 MockRead reads[] = { 1231 MockRead reads[] = {
1232 CreateMockRead(*settings_frame, 1), 1232 CreateMockRead(*settings_frame, 1),
1233 CreateMockRead(*resp), 1233 CreateMockRead(*resp),
1234 CreateMockRead(*body), 1234 CreateMockRead(*body),
1235 CreateMockRead(*fbody), 1235 CreateMockRead(*fbody),
1236 CreateMockRead(*resp2, 7), 1236 CreateMockRead(*resp2, 7),
1237 CreateMockRead(*body2), 1237 CreateMockRead(*body2),
1238 CreateMockRead(*fbody2), 1238 CreateMockRead(*fbody2),
1239 MockRead(true, 0, 0), // EOF 1239 MockRead(ASYNC, 0, 0), // EOF
1240 }; 1240 };
1241 1241
1242 scoped_ptr<OrderedSocketData> data( 1242 scoped_ptr<OrderedSocketData> data(
1243 new OrderedSocketData(reads, arraysize(reads), 1243 new OrderedSocketData(reads, arraysize(reads),
1244 writes, arraysize(writes))); 1244 writes, arraysize(writes)));
1245 scoped_ptr<OrderedSocketData> data_placeholder( 1245 scoped_ptr<OrderedSocketData> data_placeholder(
1246 new OrderedSocketData(NULL, 0, NULL, 0)); 1246 new OrderedSocketData(NULL, 0, NULL, 0));
1247 1247
1248 BoundNetLog log; 1248 BoundNetLog log;
1249 TransactionHelperResult out; 1249 TransactionHelperResult out;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1359
1360 MockWrite writes[] = { CreateMockWrite(*req), 1360 MockWrite writes[] = { CreateMockWrite(*req),
1361 CreateMockWrite(*req2), 1361 CreateMockWrite(*req2),
1362 }; 1362 };
1363 MockRead reads[] = { 1363 MockRead reads[] = {
1364 CreateMockRead(*settings_frame, 1), 1364 CreateMockRead(*settings_frame, 1),
1365 CreateMockRead(*resp), 1365 CreateMockRead(*resp),
1366 CreateMockRead(*body), 1366 CreateMockRead(*body),
1367 CreateMockRead(*fin_body), 1367 CreateMockRead(*fin_body),
1368 CreateMockRead(*resp2, 7), 1368 CreateMockRead(*resp2, 7),
1369 MockRead(true, ERR_CONNECTION_RESET, 0), // Abort! 1369 MockRead(ASYNC, ERR_CONNECTION_RESET, 0), // Abort!
1370 }; 1370 };
1371 1371
1372 scoped_ptr<OrderedSocketData> data( 1372 scoped_ptr<OrderedSocketData> data(
1373 new OrderedSocketData(reads, arraysize(reads), 1373 new OrderedSocketData(reads, arraysize(reads),
1374 writes, arraysize(writes))); 1374 writes, arraysize(writes)));
1375 scoped_ptr<OrderedSocketData> data_placeholder( 1375 scoped_ptr<OrderedSocketData> data_placeholder(
1376 new OrderedSocketData(NULL, 0, NULL, 0)); 1376 new OrderedSocketData(NULL, 0, NULL, 0));
1377 1377
1378 BoundNetLog log; 1378 BoundNetLog log;
1379 TransactionHelperResult out; 1379 TransactionHelperResult out;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 static const char* const kStandardGetHeaders[] = { 1481 static const char* const kStandardGetHeaders[] = {
1482 "status", "200", 1482 "status", "200",
1483 "version", "HTTP/1.1" 1483 "version", "HTTP/1.1"
1484 "content-length", "1234" 1484 "content-length", "1234"
1485 }; 1485 };
1486 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPacket(kSynReplyHeader, 1486 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPacket(kSynReplyHeader,
1487 NULL, 0, kStandardGetHeaders, arraysize(kStandardGetHeaders) / 2)); 1487 NULL, 0, kStandardGetHeaders, arraysize(kStandardGetHeaders) / 2));
1488 MockRead reads[] = { 1488 MockRead reads[] = {
1489 CreateMockRead(*resp), 1489 CreateMockRead(*resp),
1490 CreateMockRead(*body), 1490 CreateMockRead(*body),
1491 MockRead(true, 0, 0) // EOF 1491 MockRead(ASYNC, 0, 0) // EOF
1492 }; 1492 };
1493 1493
1494 scoped_ptr<DelayedSocketData> data( 1494 scoped_ptr<DelayedSocketData> data(
1495 new DelayedSocketData(1, reads, arraysize(reads), 1495 new DelayedSocketData(1, reads, arraysize(reads),
1496 writes, arraysize(writes))); 1496 writes, arraysize(writes)));
1497 NormalSpdyTransactionHelper helper(request, 1497 NormalSpdyTransactionHelper helper(request,
1498 BoundNetLog(), GetParam()); 1498 BoundNetLog(), GetParam());
1499 helper.RunToCompletion(data.get()); 1499 helper.RunToCompletion(data.get());
1500 TransactionHelperResult out = helper.output(); 1500 TransactionHelperResult out = helper.output();
1501 1501
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 static const char* const kStandardGetHeaders[] = { 1552 static const char* const kStandardGetHeaders[] = {
1553 "status", "200", 1553 "status", "200",
1554 "version", "HTTP/1.1" 1554 "version", "HTTP/1.1"
1555 "content-length", "1234" 1555 "content-length", "1234"
1556 }; 1556 };
1557 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPacket(kSynReplyHeader, 1557 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPacket(kSynReplyHeader,
1558 NULL, 0, kStandardGetHeaders, arraysize(kStandardGetHeaders) / 2)); 1558 NULL, 0, kStandardGetHeaders, arraysize(kStandardGetHeaders) / 2));
1559 MockRead reads[] = { 1559 MockRead reads[] = {
1560 CreateMockRead(*resp), 1560 CreateMockRead(*resp),
1561 CreateMockRead(*body), 1561 CreateMockRead(*body),
1562 MockRead(true, 0, 0) // EOF 1562 MockRead(ASYNC, 0, 0) // EOF
1563 }; 1563 };
1564 1564
1565 scoped_ptr<DelayedSocketData> data( 1565 scoped_ptr<DelayedSocketData> data(
1566 new DelayedSocketData(1, reads, arraysize(reads), 1566 new DelayedSocketData(1, reads, arraysize(reads),
1567 writes, arraysize(writes))); 1567 writes, arraysize(writes)));
1568 NormalSpdyTransactionHelper helper(request, 1568 NormalSpdyTransactionHelper helper(request,
1569 BoundNetLog(), GetParam()); 1569 BoundNetLog(), GetParam());
1570 helper.RunToCompletion(data.get()); 1570 helper.RunToCompletion(data.get());
1571 TransactionHelperResult out = helper.output(); 1571 TransactionHelperResult out = helper.output();
1572 1572
1573 EXPECT_EQ(OK, out.rv); 1573 EXPECT_EQ(OK, out.rv);
1574 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); 1574 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line);
1575 } 1575 }
1576 1576
1577 // Test that a simple POST works. 1577 // Test that a simple POST works.
1578 TEST_P(SpdyNetworkTransactionTest, Post) { 1578 TEST_P(SpdyNetworkTransactionTest, Post) {
1579 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyPost(kUploadDataSize, NULL, 0)); 1579 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyPost(kUploadDataSize, NULL, 0));
1580 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 1580 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
1581 MockWrite writes[] = { 1581 MockWrite writes[] = {
1582 CreateMockWrite(*req), 1582 CreateMockWrite(*req),
1583 CreateMockWrite(*body), // POST upload frame 1583 CreateMockWrite(*body), // POST upload frame
1584 }; 1584 };
1585 1585
1586 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0)); 1586 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0));
1587 MockRead reads[] = { 1587 MockRead reads[] = {
1588 CreateMockRead(*resp), 1588 CreateMockRead(*resp),
1589 CreateMockRead(*body), 1589 CreateMockRead(*body),
1590 MockRead(true, 0, 0) // EOF 1590 MockRead(ASYNC, 0, 0) // EOF
1591 }; 1591 };
1592 1592
1593 scoped_ptr<DelayedSocketData> data( 1593 scoped_ptr<DelayedSocketData> data(
1594 new DelayedSocketData(2, reads, arraysize(reads), 1594 new DelayedSocketData(2, reads, arraysize(reads),
1595 writes, arraysize(writes))); 1595 writes, arraysize(writes)));
1596 NormalSpdyTransactionHelper helper(CreatePostRequest(), 1596 NormalSpdyTransactionHelper helper(CreatePostRequest(),
1597 BoundNetLog(), GetParam()); 1597 BoundNetLog(), GetParam());
1598 helper.RunToCompletion(data.get()); 1598 helper.RunToCompletion(data.get());
1599 TransactionHelperResult out = helper.output(); 1599 TransactionHelperResult out = helper.output();
1600 EXPECT_EQ(OK, out.rv); 1600 EXPECT_EQ(OK, out.rv);
(...skipping 11 matching lines...) Expand all
1612 CreateMockWrite(*req), 1612 CreateMockWrite(*req),
1613 CreateMockWrite(*chunk1), 1613 CreateMockWrite(*chunk1),
1614 CreateMockWrite(*chunk2), 1614 CreateMockWrite(*chunk2),
1615 }; 1615 };
1616 1616
1617 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0)); 1617 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0));
1618 MockRead reads[] = { 1618 MockRead reads[] = {
1619 CreateMockRead(*resp), 1619 CreateMockRead(*resp),
1620 CreateMockRead(*chunk1), 1620 CreateMockRead(*chunk1),
1621 CreateMockRead(*chunk2), 1621 CreateMockRead(*chunk2),
1622 MockRead(true, 0, 0) // EOF 1622 MockRead(ASYNC, 0, 0) // EOF
1623 }; 1623 };
1624 1624
1625 scoped_ptr<DelayedSocketData> data( 1625 scoped_ptr<DelayedSocketData> data(
1626 new DelayedSocketData(2, reads, arraysize(reads), 1626 new DelayedSocketData(2, reads, arraysize(reads),
1627 writes, arraysize(writes))); 1627 writes, arraysize(writes)));
1628 NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(), 1628 NormalSpdyTransactionHelper helper(CreateChunkedPostRequest(),
1629 BoundNetLog(), GetParam()); 1629 BoundNetLog(), GetParam());
1630 helper.RunToCompletion(data.get()); 1630 helper.RunToCompletion(data.get());
1631 TransactionHelperResult out = helper.output(); 1631 TransactionHelperResult out = helper.output();
1632 EXPECT_EQ(OK, out.rv); 1632 EXPECT_EQ(OK, out.rv);
(...skipping 17 matching lines...) Expand all
1650 req->set_flags(spdy::CONTROL_FLAG_FIN); 1650 req->set_flags(spdy::CONTROL_FLAG_FIN);
1651 MockWrite writes[] = { 1651 MockWrite writes[] = {
1652 CreateMockWrite(*req), 1652 CreateMockWrite(*req),
1653 }; 1653 };
1654 1654
1655 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0)); 1655 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0));
1656 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 1656 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
1657 MockRead reads[] = { 1657 MockRead reads[] = {
1658 CreateMockRead(*resp), 1658 CreateMockRead(*resp),
1659 CreateMockRead(*body), 1659 CreateMockRead(*body),
1660 MockRead(true, 0, 0) // EOF 1660 MockRead(ASYNC, 0, 0) // EOF
1661 }; 1661 };
1662 1662
1663 scoped_ptr<DelayedSocketData> data( 1663 scoped_ptr<DelayedSocketData> data(
1664 new DelayedSocketData(1, reads, arraysize(reads), 1664 new DelayedSocketData(1, reads, arraysize(reads),
1665 writes, arraysize(writes))); 1665 writes, arraysize(writes)));
1666 1666
1667 NormalSpdyTransactionHelper helper(request, 1667 NormalSpdyTransactionHelper helper(request,
1668 BoundNetLog(), GetParam()); 1668 BoundNetLog(), GetParam());
1669 helper.RunToCompletion(data.get()); 1669 helper.RunToCompletion(data.get());
1670 TransactionHelperResult out = helper.output(); 1670 TransactionHelperResult out = helper.output();
(...skipping 26 matching lines...) Expand all
1697 req->set_flags(spdy::CONTROL_FLAG_FIN); 1697 req->set_flags(spdy::CONTROL_FLAG_FIN);
1698 MockWrite writes[] = { 1698 MockWrite writes[] = {
1699 CreateMockWrite(*req), 1699 CreateMockWrite(*req),
1700 }; 1700 };
1701 1701
1702 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0)); 1702 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyPostSynReply(NULL, 0));
1703 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 1703 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
1704 MockRead reads[] = { 1704 MockRead reads[] = {
1705 CreateMockRead(*resp), 1705 CreateMockRead(*resp),
1706 CreateMockRead(*body), 1706 CreateMockRead(*body),
1707 MockRead(true, 0, 0) // EOF 1707 MockRead(ASYNC, 0, 0) // EOF
1708 }; 1708 };
1709 1709
1710 scoped_ptr<DelayedSocketData> data( 1710 scoped_ptr<DelayedSocketData> data(
1711 new DelayedSocketData(1, reads, arraysize(reads), 1711 new DelayedSocketData(1, reads, arraysize(reads),
1712 writes, arraysize(writes))); 1712 writes, arraysize(writes)));
1713 1713
1714 NormalSpdyTransactionHelper helper(request, 1714 NormalSpdyTransactionHelper helper(request,
1715 BoundNetLog(), GetParam()); 1715 BoundNetLog(), GetParam());
1716 helper.RunToCompletion(data.get()); 1716 helper.RunToCompletion(data.get());
1717 TransactionHelperResult out = helper.output(); 1717 TransactionHelperResult out = helper.output();
(...skipping 18 matching lines...) Expand all
1736 scoped_ptr<UploadDataStream> stream( 1736 scoped_ptr<UploadDataStream> stream(
1737 new UploadDataStream(request.upload_data)); 1737 new UploadDataStream(request.upload_data));
1738 ASSERT_EQ(OK, stream->Init()); 1738 ASSERT_EQ(OK, stream->Init());
1739 ASSERT_EQ(request.upload_data->GetContentLengthSync(), 1739 ASSERT_EQ(request.upload_data->GetContentLengthSync(),
1740 stream->size()); 1740 stream->size());
1741 scoped_ptr<spdy::SpdyFrame> stream_reply(ConstructSpdyPostSynReply(NULL, 0)); 1741 scoped_ptr<spdy::SpdyFrame> stream_reply(ConstructSpdyPostSynReply(NULL, 0));
1742 scoped_ptr<spdy::SpdyFrame> stream_body(ConstructSpdyBodyFrame(1, true)); 1742 scoped_ptr<spdy::SpdyFrame> stream_body(ConstructSpdyBodyFrame(1, true));
1743 MockRead reads[] = { 1743 MockRead reads[] = {
1744 CreateMockRead(*stream_reply, 2), 1744 CreateMockRead(*stream_reply, 2),
1745 CreateMockRead(*stream_body, 3), 1745 CreateMockRead(*stream_body, 3),
1746 MockRead(false, 0, 0) // EOF 1746 MockRead(SYNCHRONOUS, 0, 0) // EOF
1747 }; 1747 };
1748 1748
1749 scoped_ptr<DelayedSocketData> data( 1749 scoped_ptr<DelayedSocketData> data(
1750 new DelayedSocketData(0, reads, arraysize(reads), NULL, 0)); 1750 new DelayedSocketData(0, reads, arraysize(reads), NULL, 0));
1751 NormalSpdyTransactionHelper helper(request, 1751 NormalSpdyTransactionHelper helper(request,
1752 BoundNetLog(), GetParam()); 1752 BoundNetLog(), GetParam());
1753 helper.RunPreTestSetup(); 1753 helper.RunPreTestSetup();
1754 helper.AddData(data.get()); 1754 helper.AddData(data.get());
1755 helper.RunDefaultTest(); 1755 helper.RunDefaultTest();
1756 helper.VerifyDataConsumed(); 1756 helper.VerifyDataConsumed();
1757 1757
1758 TransactionHelperResult out = helper.output(); 1758 TransactionHelperResult out = helper.output();
1759 EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); 1759 EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv);
1760 } 1760 }
1761 1761
1762 // The client upon cancellation tries to send a RST_STREAM frame. The mock 1762 // The client upon cancellation tries to send a RST_STREAM frame. The mock
1763 // socket causes the TCP write to return zero. This test checks that the client 1763 // socket causes the TCP write to return zero. This test checks that the client
1764 // tries to queue up the RST_STREAM frame again. 1764 // tries to queue up the RST_STREAM frame again.
1765 TEST_P(SpdyNetworkTransactionTest, SocketWriteReturnsZero) { 1765 TEST_P(SpdyNetworkTransactionTest, SocketWriteReturnsZero) {
1766 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 1766 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
1767 scoped_ptr<spdy::SpdyFrame> rst( 1767 scoped_ptr<spdy::SpdyFrame> rst(
1768 ConstructSpdyRstStream(1, spdy::CANCEL)); 1768 ConstructSpdyRstStream(1, spdy::CANCEL));
1769 MockWrite writes[] = { 1769 MockWrite writes[] = {
1770 CreateMockWrite(*req.get(), 0, false), 1770 CreateMockWrite(*req.get(), 0, SYNCHRONOUS),
1771 MockWrite(false, 0, 0, 2), 1771 MockWrite(SYNCHRONOUS, 0, 0, 2),
1772 CreateMockWrite(*rst.get(), 3, false), 1772 CreateMockWrite(*rst.get(), 3, SYNCHRONOUS),
1773 }; 1773 };
1774 1774
1775 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 1775 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
1776 MockRead reads[] = { 1776 MockRead reads[] = {
1777 CreateMockRead(*resp.get(), 1, true), 1777 CreateMockRead(*resp.get(), 1, ASYNC),
1778 MockRead(true, 0, 0, 4) // EOF 1778 MockRead(ASYNC, 0, 0, 4) // EOF
1779 }; 1779 };
1780 1780
1781 scoped_refptr<DeterministicSocketData> data( 1781 scoped_refptr<DeterministicSocketData> data(
1782 new DeterministicSocketData(reads, arraysize(reads), 1782 new DeterministicSocketData(reads, arraysize(reads),
1783 writes, arraysize(writes))); 1783 writes, arraysize(writes)));
1784 NormalSpdyTransactionHelper helper(CreateGetRequest(), 1784 NormalSpdyTransactionHelper helper(CreateGetRequest(),
1785 BoundNetLog(), GetParam()); 1785 BoundNetLog(), GetParam());
1786 helper.SetDeterministic(); 1786 helper.SetDeterministic();
1787 helper.RunPreTestSetup(); 1787 helper.RunPreTestSetup();
1788 helper.AddDeterministicData(data.get()); 1788 helper.AddDeterministicData(data.get());
(...skipping 11 matching lines...) Expand all
1800 data->Run(); 1800 data->Run();
1801 1801
1802 helper.VerifyDataConsumed(); 1802 helper.VerifyDataConsumed();
1803 } 1803 }
1804 1804
1805 // Test that the transaction doesn't crash when we don't have a reply. 1805 // Test that the transaction doesn't crash when we don't have a reply.
1806 TEST_P(SpdyNetworkTransactionTest, ResponseWithoutSynReply) { 1806 TEST_P(SpdyNetworkTransactionTest, ResponseWithoutSynReply) {
1807 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 1807 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
1808 MockRead reads[] = { 1808 MockRead reads[] = {
1809 CreateMockRead(*body), 1809 CreateMockRead(*body),
1810 MockRead(true, 0, 0) // EOF 1810 MockRead(ASYNC, 0, 0) // EOF
1811 }; 1811 };
1812 1812
1813 scoped_ptr<DelayedSocketData> data( 1813 scoped_ptr<DelayedSocketData> data(
1814 new DelayedSocketData(1, reads, arraysize(reads), NULL, 0)); 1814 new DelayedSocketData(1, reads, arraysize(reads), NULL, 0));
1815 NormalSpdyTransactionHelper helper(CreateGetRequest(), 1815 NormalSpdyTransactionHelper helper(CreateGetRequest(),
1816 BoundNetLog(), GetParam()); 1816 BoundNetLog(), GetParam());
1817 helper.RunToCompletion(data.get()); 1817 helper.RunToCompletion(data.get());
1818 TransactionHelperResult out = helper.output(); 1818 TransactionHelperResult out = helper.output();
1819 EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv); 1819 EXPECT_EQ(ERR_SYN_REPLY_NOT_RECEIVED, out.rv);
1820 } 1820 }
1821 1821
1822 // Test that the transaction doesn't crash when we get two replies on the same 1822 // Test that the transaction doesn't crash when we get two replies on the same
1823 // stream ID. See http://crbug.com/45639. 1823 // stream ID. See http://crbug.com/45639.
1824 TEST_P(SpdyNetworkTransactionTest, ResponseWithTwoSynReplies) { 1824 TEST_P(SpdyNetworkTransactionTest, ResponseWithTwoSynReplies) {
1825 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 1825 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
1826 MockWrite writes[] = { CreateMockWrite(*req) }; 1826 MockWrite writes[] = { CreateMockWrite(*req) };
1827 1827
1828 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 1828 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
1829 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 1829 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
1830 MockRead reads[] = { 1830 MockRead reads[] = {
1831 CreateMockRead(*resp), 1831 CreateMockRead(*resp),
1832 CreateMockRead(*resp), 1832 CreateMockRead(*resp),
1833 CreateMockRead(*body), 1833 CreateMockRead(*body),
1834 MockRead(true, 0, 0) // EOF 1834 MockRead(ASYNC, 0, 0) // EOF
1835 }; 1835 };
1836 1836
1837 scoped_ptr<DelayedSocketData> data( 1837 scoped_ptr<DelayedSocketData> data(
1838 new DelayedSocketData(1, reads, arraysize(reads), 1838 new DelayedSocketData(1, reads, arraysize(reads),
1839 writes, arraysize(writes))); 1839 writes, arraysize(writes)));
1840 1840
1841 NormalSpdyTransactionHelper helper(CreateGetRequest(), 1841 NormalSpdyTransactionHelper helper(CreateGetRequest(),
1842 BoundNetLog(), GetParam()); 1842 BoundNetLog(), GetParam());
1843 helper.RunPreTestSetup(); 1843 helper.RunPreTestSetup();
1844 helper.AddData(data.get()); 1844 helper.AddData(data.get());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 MockRead reads[] = { 1912 MockRead reads[] = {
1913 CreateMockRead(*window_update_dummy), 1913 CreateMockRead(*window_update_dummy),
1914 CreateMockRead(*window_update_dummy), 1914 CreateMockRead(*window_update_dummy),
1915 CreateMockRead(*window_update_dummy), 1915 CreateMockRead(*window_update_dummy),
1916 CreateMockRead(*window_update), // Four updates, therefore window 1916 CreateMockRead(*window_update), // Four updates, therefore window
1917 CreateMockRead(*window_update), // size should increase by 1917 CreateMockRead(*window_update), // size should increase by
1918 CreateMockRead(*window_update), // kDeltaWindowSize * 4 1918 CreateMockRead(*window_update), // kDeltaWindowSize * 4
1919 CreateMockRead(*window_update), 1919 CreateMockRead(*window_update),
1920 CreateMockRead(*resp), 1920 CreateMockRead(*resp),
1921 CreateMockRead(*body_end), 1921 CreateMockRead(*body_end),
1922 MockRead(true, 0, 0) // EOF 1922 MockRead(ASYNC, 0, 0) // EOF
1923 }; 1923 };
1924 1924
1925 scoped_ptr<DelayedSocketData> data( 1925 scoped_ptr<DelayedSocketData> data(
1926 new DelayedSocketData(0, reads, arraysize(reads), 1926 new DelayedSocketData(0, reads, arraysize(reads),
1927 writes, arraysize(writes))); 1927 writes, arraysize(writes)));
1928 1928
1929 // Setup the request 1929 // Setup the request
1930 HttpRequestInfo request; 1930 HttpRequestInfo request;
1931 request.method = "POST"; 1931 request.method = "POST";
1932 request.url = GURL(kDefaultURL); 1932 request.url = GURL(kDefaultURL);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 1975
1976 scoped_ptr<spdy::SpdyFrame> resp( 1976 scoped_ptr<spdy::SpdyFrame> resp(
1977 ConstructSpdyGetSynReply(NULL, 0, 1)); 1977 ConstructSpdyGetSynReply(NULL, 0, 1));
1978 scoped_ptr<spdy::SpdyFrame> body_no_fin( 1978 scoped_ptr<spdy::SpdyFrame> body_no_fin(
1979 ConstructSpdyBodyFrame(1, false)); 1979 ConstructSpdyBodyFrame(1, false));
1980 scoped_ptr<spdy::SpdyFrame> body_fin( 1980 scoped_ptr<spdy::SpdyFrame> body_fin(
1981 ConstructSpdyBodyFrame(1, NULL, 0, true)); 1981 ConstructSpdyBodyFrame(1, NULL, 0, true));
1982 MockRead reads[] = { 1982 MockRead reads[] = {
1983 CreateMockRead(*resp), 1983 CreateMockRead(*resp),
1984 CreateMockRead(*body_no_fin), 1984 CreateMockRead(*body_no_fin),
1985 MockRead(true, ERR_IO_PENDING, 0), // Force a pause 1985 MockRead(ASYNC, ERR_IO_PENDING, 0), // Force a pause
1986 CreateMockRead(*body_fin), 1986 CreateMockRead(*body_fin),
1987 MockRead(true, ERR_IO_PENDING, 0), // Force a pause 1987 MockRead(ASYNC, ERR_IO_PENDING, 0), // Force a pause
1988 MockRead(true, 0, 0) // EOF 1988 MockRead(ASYNC, 0, 0) // EOF
1989 }; 1989 };
1990 1990
1991 scoped_ptr<DelayedSocketData> data( 1991 scoped_ptr<DelayedSocketData> data(
1992 new DelayedSocketData(1, reads, arraysize(reads), 1992 new DelayedSocketData(1, reads, arraysize(reads),
1993 writes, arraysize(writes))); 1993 writes, arraysize(writes)));
1994 1994
1995 NormalSpdyTransactionHelper helper(CreateGetRequest(), 1995 NormalSpdyTransactionHelper helper(CreateGetRequest(),
1996 BoundNetLog(), GetParam()); 1996 BoundNetLog(), GetParam());
1997 helper.AddData(data.get()); 1997 helper.AddData(data.get());
1998 helper.RunPreTestSetup(); 1998 helper.RunPreTestSetup();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 scoped_ptr<spdy::SpdyFrame> window_update2( 2075 scoped_ptr<spdy::SpdyFrame> window_update2(
2076 ConstructSpdyWindowUpdate(2, kDeltaWindowSize)); 2076 ConstructSpdyWindowUpdate(2, kDeltaWindowSize));
2077 scoped_ptr<spdy::SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); 2077 scoped_ptr<spdy::SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0));
2078 2078
2079 MockRead reads[] = { 2079 MockRead reads[] = {
2080 CreateMockRead(*window_update2), 2080 CreateMockRead(*window_update2),
2081 CreateMockRead(*window_update2), 2081 CreateMockRead(*window_update2),
2082 CreateMockRead(*window_update), 2082 CreateMockRead(*window_update),
2083 CreateMockRead(*window_update), 2083 CreateMockRead(*window_update),
2084 CreateMockRead(*window_update), 2084 CreateMockRead(*window_update),
2085 MockRead(true, ERR_IO_PENDING, 0), // Wait for the RST to be written. 2085 MockRead(ASYNC, ERR_IO_PENDING, 0), // Wait for the RST to be written.
2086 MockRead(true, 0, 0) // EOF 2086 MockRead(ASYNC, 0, 0) // EOF
2087 }; 2087 };
2088 2088
2089 scoped_ptr<DelayedSocketData> data( 2089 scoped_ptr<DelayedSocketData> data(
2090 new DelayedSocketData(0, reads, arraysize(reads), 2090 new DelayedSocketData(0, reads, arraysize(reads),
2091 writes, arraysize(writes))); 2091 writes, arraysize(writes)));
2092 2092
2093 // Setup the request 2093 // Setup the request
2094 HttpRequestInfo request; 2094 HttpRequestInfo request;
2095 request.method = "POST"; 2095 request.method = "POST";
2096 request.url = GURL("http://www.google.com/"); 2096 request.url = GURL("http://www.google.com/");
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 // data. 2182 // data.
2183 scoped_ptr<spdy::SpdyFrame> window_update( 2183 scoped_ptr<spdy::SpdyFrame> window_update(
2184 ConstructSpdyWindowUpdate(1, kUploadDataSize)); 2184 ConstructSpdyWindowUpdate(1, kUploadDataSize));
2185 scoped_ptr<spdy::SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); 2185 scoped_ptr<spdy::SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0));
2186 MockRead reads[] = { 2186 MockRead reads[] = {
2187 CreateMockRead(*window_update), 2187 CreateMockRead(*window_update),
2188 CreateMockRead(*window_update), 2188 CreateMockRead(*window_update),
2189 CreateMockRead(*reply), 2189 CreateMockRead(*reply),
2190 CreateMockRead(*body2), 2190 CreateMockRead(*body2),
2191 CreateMockRead(*body3), 2191 CreateMockRead(*body3),
2192 MockRead(true, 0, 0) // EOF 2192 MockRead(ASYNC, 0, 0) // EOF
2193 }; 2193 };
2194 2194
2195 // Force all writes to happen before any read, last write will not 2195 // Force all writes to happen before any read, last write will not
2196 // actually queue a frame, due to window size being 0. 2196 // actually queue a frame, due to window size being 0.
2197 scoped_ptr<DelayedSocketData> data( 2197 scoped_ptr<DelayedSocketData> data(
2198 new DelayedSocketData(nwrites, reads, arraysize(reads), 2198 new DelayedSocketData(nwrites, reads, arraysize(reads),
2199 writes.get(), nwrites)); 2199 writes.get(), nwrites));
2200 2200
2201 HttpRequestInfo request; 2201 HttpRequestInfo request;
2202 request.method = "POST"; 2202 request.method = "POST";
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 CreateMockWrite(*req), 2244 CreateMockWrite(*req),
2245 }; 2245 };
2246 2246
2247 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 2247 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
2248 MockRead reads[] = { 2248 MockRead reads[] = {
2249 CreateMockRead(*resp), 2249 CreateMockRead(*resp),
2250 // This following read isn't used by the test, except during the 2250 // This following read isn't used by the test, except during the
2251 // RunAllPending() call at the end since the SpdySession survives the 2251 // RunAllPending() call at the end since the SpdySession survives the
2252 // HttpNetworkTransaction and still tries to continue Read()'ing. Any 2252 // HttpNetworkTransaction and still tries to continue Read()'ing. Any
2253 // MockRead will do here. 2253 // MockRead will do here.
2254 MockRead(true, 0, 0) // EOF 2254 MockRead(ASYNC, 0, 0) // EOF
2255 }; 2255 };
2256 2256
2257 StaticSocketDataProvider data(reads, arraysize(reads), 2257 StaticSocketDataProvider data(reads, arraysize(reads),
2258 writes, arraysize(writes)); 2258 writes, arraysize(writes));
2259 2259
2260 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2260 NormalSpdyTransactionHelper helper(CreateGetRequest(),
2261 BoundNetLog(), GetParam()); 2261 BoundNetLog(), GetParam());
2262 helper.RunPreTestSetup(); 2262 helper.RunPreTestSetup();
2263 helper.AddData(&data); 2263 helper.AddData(&data);
2264 HttpNetworkTransaction* trans = helper.trans(); 2264 HttpNetworkTransaction* trans = helper.trans();
2265 2265
2266 TestCompletionCallback callback; 2266 TestCompletionCallback callback;
2267 int rv = trans->Start( 2267 int rv = trans->Start(
2268 &CreateGetRequest(), callback.callback(), BoundNetLog()); 2268 &CreateGetRequest(), callback.callback(), BoundNetLog());
2269 EXPECT_EQ(ERR_IO_PENDING, rv); 2269 EXPECT_EQ(ERR_IO_PENDING, rv);
2270 helper.ResetTrans(); // Cancel the transaction. 2270 helper.ResetTrans(); // Cancel the transaction.
2271 2271
2272 // Flush the MessageLoop while the SpdySessionDependencies (in particular, the 2272 // Flush the MessageLoop while the SpdySessionDependencies (in particular, the
2273 // MockClientSocketFactory) are still alive. 2273 // MockClientSocketFactory) are still alive.
2274 MessageLoop::current()->RunAllPending(); 2274 MessageLoop::current()->RunAllPending();
2275 helper.VerifyDataNotConsumed(); 2275 helper.VerifyDataNotConsumed();
2276 } 2276 }
2277 2277
2278 // Verify that the client sends a Rst Frame upon cancelling the stream. 2278 // Verify that the client sends a Rst Frame upon cancelling the stream.
2279 TEST_P(SpdyNetworkTransactionTest, CancelledTransactionSendRst) { 2279 TEST_P(SpdyNetworkTransactionTest, CancelledTransactionSendRst) {
2280 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 2280 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
2281 scoped_ptr<spdy::SpdyFrame> rst( 2281 scoped_ptr<spdy::SpdyFrame> rst(
2282 ConstructSpdyRstStream(1, spdy::CANCEL)); 2282 ConstructSpdyRstStream(1, spdy::CANCEL));
2283 MockWrite writes[] = { 2283 MockWrite writes[] = {
2284 CreateMockWrite(*req, 0, false), 2284 CreateMockWrite(*req, 0, SYNCHRONOUS),
2285 CreateMockWrite(*rst, 2, false), 2285 CreateMockWrite(*rst, 2, SYNCHRONOUS),
2286 }; 2286 };
2287 2287
2288 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 2288 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
2289 MockRead reads[] = { 2289 MockRead reads[] = {
2290 CreateMockRead(*resp, 1, true), 2290 CreateMockRead(*resp, 1, ASYNC),
2291 MockRead(true, 0, 0, 3) // EOF 2291 MockRead(ASYNC, 0, 0, 3) // EOF
2292 }; 2292 };
2293 2293
2294 scoped_refptr<DeterministicSocketData> data( 2294 scoped_refptr<DeterministicSocketData> data(
2295 new DeterministicSocketData(reads, arraysize(reads), 2295 new DeterministicSocketData(reads, arraysize(reads),
2296 writes, arraysize(writes))); 2296 writes, arraysize(writes)));
2297 2297
2298 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2298 NormalSpdyTransactionHelper helper(CreateGetRequest(),
2299 BoundNetLog(), 2299 BoundNetLog(),
2300 GetParam()); 2300 GetParam());
2301 helper.SetDeterministic(); 2301 helper.SetDeterministic();
(...skipping 29 matching lines...) Expand all
2331 // session, and calls the read callback with the incomplete data. 2331 // session, and calls the read callback with the incomplete data.
2332 const uint8 kGetBodyFrame2[] = { 2332 const uint8 kGetBodyFrame2[] = {
2333 0x00, 0x00, 0x00, 0x01, 2333 0x00, 0x00, 0x00, 0x01,
2334 0x01, 0x00, 0x00, 0x07, 2334 0x01, 0x00, 0x00, 0x07,
2335 'h', 'e', 'l', 'l', 'o', '!', 2335 'h', 'e', 'l', 'l', 'o', '!',
2336 }; 2336 };
2337 2337
2338 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 2338 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
2339 MockRead reads[] = { 2339 MockRead reads[] = {
2340 CreateMockRead(*resp, 2), 2340 CreateMockRead(*resp, 2),
2341 MockRead(true, ERR_IO_PENDING, 3), // Force a pause 2341 MockRead(ASYNC, ERR_IO_PENDING, 3), // Force a pause
2342 MockRead(true, reinterpret_cast<const char*>(kGetBodyFrame2), 2342 MockRead(ASYNC, reinterpret_cast<const char*>(kGetBodyFrame2),
2343 arraysize(kGetBodyFrame2), 4), 2343 arraysize(kGetBodyFrame2), 4),
2344 MockRead(true, ERR_IO_PENDING, 5), // Force a pause 2344 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause
2345 MockRead(true, 0, 0, 6), // EOF 2345 MockRead(ASYNC, 0, 0, 6), // EOF
2346 }; 2346 };
2347 MockRead reads2[] = { 2347 MockRead reads2[] = {
2348 CreateMockRead(*resp, 2), 2348 CreateMockRead(*resp, 2),
2349 MockRead(true, 0, 0, 3), // EOF 2349 MockRead(ASYNC, 0, 0, 3), // EOF
2350 }; 2350 };
2351 2351
2352 scoped_ptr<OrderedSocketData> data( 2352 scoped_ptr<OrderedSocketData> data(
2353 new OrderedSocketData(reads, arraysize(reads), 2353 new OrderedSocketData(reads, arraysize(reads),
2354 writes, arraysize(writes))); 2354 writes, arraysize(writes)));
2355 scoped_ptr<DelayedSocketData> data2( 2355 scoped_ptr<DelayedSocketData> data2(
2356 new DelayedSocketData(1, reads2, arraysize(reads2), 2356 new DelayedSocketData(1, reads2, arraysize(reads2),
2357 writes2, arraysize(writes2))); 2357 writes2, arraysize(writes2)));
2358 2358
2359 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2359 NormalSpdyTransactionHelper helper(CreateGetRequest(),
(...skipping 26 matching lines...) Expand all
2386 // transaction. Failures will usually be valgrind errors. See 2386 // transaction. Failures will usually be valgrind errors. See
2387 // http://crbug.com/46925 2387 // http://crbug.com/46925
2388 TEST_P(SpdyNetworkTransactionTest, DeleteSessionOnReadCallback) { 2388 TEST_P(SpdyNetworkTransactionTest, DeleteSessionOnReadCallback) {
2389 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 2389 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
2390 MockWrite writes[] = { CreateMockWrite(*req) }; 2390 MockWrite writes[] = { CreateMockWrite(*req) };
2391 2391
2392 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 2392 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
2393 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 2393 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
2394 MockRead reads[] = { 2394 MockRead reads[] = {
2395 CreateMockRead(*resp.get(), 2), 2395 CreateMockRead(*resp.get(), 2),
2396 MockRead(true, ERR_IO_PENDING, 3), // Force a pause 2396 MockRead(ASYNC, ERR_IO_PENDING, 3), // Force a pause
2397 CreateMockRead(*body.get(), 4), 2397 CreateMockRead(*body.get(), 4),
2398 MockRead(true, 0, 0, 5), // EOF 2398 MockRead(ASYNC, 0, 0, 5), // EOF
2399 }; 2399 };
2400 2400
2401 scoped_ptr<OrderedSocketData> data( 2401 scoped_ptr<OrderedSocketData> data(
2402 new OrderedSocketData(reads, arraysize(reads), 2402 new OrderedSocketData(reads, arraysize(reads),
2403 writes, arraysize(writes))); 2403 writes, arraysize(writes)));
2404 2404
2405 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2405 NormalSpdyTransactionHelper helper(CreateGetRequest(),
2406 BoundNetLog(), GetParam()); 2406 BoundNetLog(), GetParam());
2407 helper.RunPreTestSetup(); 2407 helper.RunPreTestSetup();
2408 helper.AddData(data.get()); 2408 helper.AddData(data.get());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 kStandardGetHeaders, arraysize(kStandardGetHeaders) / 2)); 2473 kStandardGetHeaders, arraysize(kStandardGetHeaders) / 2));
2474 scoped_ptr<spdy::SpdyFrame> req2(ConstructSpdyPacket( 2474 scoped_ptr<spdy::SpdyFrame> req2(ConstructSpdyPacket(
2475 kSynStartHeader, kExtraHeaders, arraysize(kExtraHeaders) / 2, 2475 kSynStartHeader, kExtraHeaders, arraysize(kExtraHeaders) / 2,
2476 kStandardGetHeaders2, arraysize(kStandardGetHeaders2) / 2)); 2476 kStandardGetHeaders2, arraysize(kStandardGetHeaders2) / 2));
2477 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReplyRedirect(1)); 2477 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReplyRedirect(1));
2478 MockWrite writes[] = { 2478 MockWrite writes[] = {
2479 CreateMockWrite(*req, 1), 2479 CreateMockWrite(*req, 1),
2480 }; 2480 };
2481 MockRead reads[] = { 2481 MockRead reads[] = {
2482 CreateMockRead(*resp, 2), 2482 CreateMockRead(*resp, 2),
2483 MockRead(true, 0, 0, 3) // EOF 2483 MockRead(ASYNC, 0, 0, 3) // EOF
2484 }; 2484 };
2485 2485
2486 // Setup writes/reads to www.foo.com 2486 // Setup writes/reads to www.foo.com
2487 scoped_ptr<spdy::SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 1)); 2487 scoped_ptr<spdy::SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 1));
2488 scoped_ptr<spdy::SpdyFrame> body2(ConstructSpdyBodyFrame(1, true)); 2488 scoped_ptr<spdy::SpdyFrame> body2(ConstructSpdyBodyFrame(1, true));
2489 MockWrite writes2[] = { 2489 MockWrite writes2[] = {
2490 CreateMockWrite(*req2, 1), 2490 CreateMockWrite(*req2, 1),
2491 }; 2491 };
2492 MockRead reads2[] = { 2492 MockRead reads2[] = {
2493 CreateMockRead(*resp2, 2), 2493 CreateMockRead(*resp2, 2),
2494 CreateMockRead(*body2, 3), 2494 CreateMockRead(*body2, 3),
2495 MockRead(true, 0, 0, 4) // EOF 2495 MockRead(ASYNC, 0, 0, 4) // EOF
2496 }; 2496 };
2497 scoped_ptr<OrderedSocketData> data( 2497 scoped_ptr<OrderedSocketData> data(
2498 new OrderedSocketData(reads, arraysize(reads), 2498 new OrderedSocketData(reads, arraysize(reads),
2499 writes, arraysize(writes))); 2499 writes, arraysize(writes)));
2500 scoped_ptr<OrderedSocketData> data2( 2500 scoped_ptr<OrderedSocketData> data2(
2501 new OrderedSocketData(reads2, arraysize(reads2), 2501 new OrderedSocketData(reads2, arraysize(reads2),
2502 writes2, arraysize(writes2))); 2502 writes2, arraysize(writes2)));
2503 2503
2504 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2504 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2505 HttpStreamFactory::set_force_spdy_over_ssl(false); 2505 HttpStreamFactory::set_force_spdy_over_ssl(false);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 MockWrite writes[] = { 2544 MockWrite writes[] = {
2545 CreateMockWrite(*syn, 0), 2545 CreateMockWrite(*syn, 0),
2546 CreateMockWrite(*rst, 2), 2546 CreateMockWrite(*rst, 2),
2547 }; 2547 };
2548 2548
2549 const char* const kExtraHeaders[] = {"X-UpperCase", "yes"}; 2549 const char* const kExtraHeaders[] = {"X-UpperCase", "yes"};
2550 scoped_ptr<spdy::SpdyFrame> 2550 scoped_ptr<spdy::SpdyFrame>
2551 reply(ConstructSpdyGetSynReply(kExtraHeaders, 1, 1)); 2551 reply(ConstructSpdyGetSynReply(kExtraHeaders, 1, 1));
2552 MockRead reads[] = { 2552 MockRead reads[] = {
2553 CreateMockRead(*reply, 1), 2553 CreateMockRead(*reply, 1),
2554 MockRead(true, ERR_IO_PENDING, 3), // Force a pause 2554 MockRead(ASYNC, ERR_IO_PENDING, 3), // Force a pause
2555 }; 2555 };
2556 2556
2557 HttpResponseInfo response; 2557 HttpResponseInfo response;
2558 HttpResponseInfo response2; 2558 HttpResponseInfo response2;
2559 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 2559 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
2560 reads, 2560 reads,
2561 arraysize(reads), 2561 arraysize(reads),
2562 writes, 2562 writes,
2563 arraysize(writes))); 2563 arraysize(writes)));
2564 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2564 NormalSpdyTransactionHelper helper(CreateGetRequest(),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 spdy::HEADERS, 2607 spdy::HEADERS,
2608 spdy::CONTROL_FLAG_NONE, 2608 spdy::CONTROL_FLAG_NONE,
2609 NULL, 2609 NULL,
2610 0, 2610 0,
2611 0)); 2611 0));
2612 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); 2612 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true));
2613 MockRead reads[] = { 2613 MockRead reads[] = {
2614 CreateMockRead(*stream1_reply), 2614 CreateMockRead(*stream1_reply),
2615 CreateMockRead(*stream1_headers), 2615 CreateMockRead(*stream1_headers),
2616 CreateMockRead(*stream1_body), 2616 CreateMockRead(*stream1_body),
2617 MockRead(true, 0, 0) // EOF 2617 MockRead(ASYNC, 0, 0) // EOF
2618 }; 2618 };
2619 2619
2620 scoped_ptr<DelayedSocketData> data( 2620 scoped_ptr<DelayedSocketData> data(
2621 new DelayedSocketData(1, reads, arraysize(reads), 2621 new DelayedSocketData(1, reads, arraysize(reads),
2622 writes, arraysize(writes))); 2622 writes, arraysize(writes)));
2623 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2623 NormalSpdyTransactionHelper helper(CreateGetRequest(),
2624 BoundNetLog(), GetParam()); 2624 BoundNetLog(), GetParam());
2625 helper.RunToCompletion(data.get()); 2625 helper.RunToCompletion(data.get());
2626 TransactionHelperResult out = helper.output(); 2626 TransactionHelperResult out = helper.output();
2627 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); 2627 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv);
(...skipping 13 matching lines...) Expand all
2641 scoped_ptr<spdy::SpdyFrame> 2641 scoped_ptr<spdy::SpdyFrame>
2642 reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 2642 reply(ConstructSpdyGetSynReply(NULL, 0, 1));
2643 const char* const extra_headers[] = {"X-UpperCase", "yes"}; 2643 const char* const extra_headers[] = {"X-UpperCase", "yes"};
2644 scoped_ptr<spdy::SpdyFrame> 2644 scoped_ptr<spdy::SpdyFrame>
2645 push(ConstructSpdyPush(extra_headers, 1, 2, 1)); 2645 push(ConstructSpdyPush(extra_headers, 1, 2, 1));
2646 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 2646 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
2647 MockRead reads[] = { 2647 MockRead reads[] = {
2648 CreateMockRead(*reply, 1), 2648 CreateMockRead(*reply, 1),
2649 CreateMockRead(*push, 1), 2649 CreateMockRead(*push, 1),
2650 CreateMockRead(*body, 1), 2650 CreateMockRead(*body, 1),
2651 MockRead(true, ERR_IO_PENDING, 3), // Force a pause 2651 MockRead(ASYNC, ERR_IO_PENDING, 3), // Force a pause
2652 }; 2652 };
2653 2653
2654 HttpResponseInfo response; 2654 HttpResponseInfo response;
2655 HttpResponseInfo response2; 2655 HttpResponseInfo response2;
2656 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 2656 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
2657 reads, 2657 reads,
2658 arraysize(reads), 2658 arraysize(reads),
2659 writes, 2659 writes,
2660 arraysize(writes))); 2660 arraysize(writes)));
2661 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2661 NormalSpdyTransactionHelper helper(CreateGetRequest(),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 2708 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
2709 scoped_ptr<spdy::SpdyFrame> rst(ConstructSpdyRstStream(2, spdy::CANCEL)); 2709 scoped_ptr<spdy::SpdyFrame> rst(ConstructSpdyRstStream(2, spdy::CANCEL));
2710 MockWrite writes[] = { 2710 MockWrite writes[] = {
2711 CreateMockWrite(*req, 1), 2711 CreateMockWrite(*req, 1),
2712 CreateMockWrite(*rst, 6), 2712 CreateMockWrite(*rst, 6),
2713 }; 2713 };
2714 MockRead reads[] = { 2714 MockRead reads[] = {
2715 CreateMockRead(*resp, 2), 2715 CreateMockRead(*resp, 2),
2716 CreateMockRead(*rep, 3), 2716 CreateMockRead(*rep, 3),
2717 CreateMockRead(*body, 4), 2717 CreateMockRead(*body, 4),
2718 MockRead(true, ERR_IO_PENDING, 5), // Force a pause 2718 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause
2719 MockRead(true, 0, 0, 7) // EOF 2719 MockRead(ASYNC, 0, 0, 7) // EOF
2720 }; 2720 };
2721 2721
2722 // Setup writes/reads to www.foo.com 2722 // Setup writes/reads to www.foo.com
2723 const char* const kStandardGetHeaders2[] = { 2723 const char* const kStandardGetHeaders2[] = {
2724 "host", 2724 "host",
2725 "www.foo.com", 2725 "www.foo.com",
2726 "method", 2726 "method",
2727 "GET", 2727 "GET",
2728 "scheme", 2728 "scheme",
2729 "http", 2729 "http",
(...skipping 11 matching lines...) Expand all
2741 kStandardGetHeaders2, 2741 kStandardGetHeaders2,
2742 arraysize(kStandardGetHeaders2) / 2)); 2742 arraysize(kStandardGetHeaders2) / 2));
2743 scoped_ptr<spdy::SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 1)); 2743 scoped_ptr<spdy::SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 1));
2744 scoped_ptr<spdy::SpdyFrame> body2(ConstructSpdyBodyFrame(1, true)); 2744 scoped_ptr<spdy::SpdyFrame> body2(ConstructSpdyBodyFrame(1, true));
2745 MockWrite writes2[] = { 2745 MockWrite writes2[] = {
2746 CreateMockWrite(*req2, 1), 2746 CreateMockWrite(*req2, 1),
2747 }; 2747 };
2748 MockRead reads2[] = { 2748 MockRead reads2[] = {
2749 CreateMockRead(*resp2, 2), 2749 CreateMockRead(*resp2, 2),
2750 CreateMockRead(*body2, 3), 2750 CreateMockRead(*body2, 3),
2751 MockRead(true, 0, 0, 5) // EOF 2751 MockRead(ASYNC, 0, 0, 5) // EOF
2752 }; 2752 };
2753 scoped_ptr<OrderedSocketData> data( 2753 scoped_ptr<OrderedSocketData> data(
2754 new OrderedSocketData(reads, arraysize(reads), 2754 new OrderedSocketData(reads, arraysize(reads),
2755 writes, arraysize(writes))); 2755 writes, arraysize(writes)));
2756 scoped_ptr<OrderedSocketData> data2( 2756 scoped_ptr<OrderedSocketData> data2(
2757 new OrderedSocketData(reads2, arraysize(reads2), 2757 new OrderedSocketData(reads2, arraysize(reads2),
2758 writes2, arraysize(writes2))); 2758 writes2, arraysize(writes2)));
2759 2759
2760 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2760 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2761 HttpStreamFactory::set_force_spdy_over_ssl(false); 2761 HttpStreamFactory::set_force_spdy_over_ssl(false);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 2821 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
2822 scoped_ptr<spdy::SpdyFrame> 2822 scoped_ptr<spdy::SpdyFrame>
2823 stream2_syn(ConstructSpdyPush(NULL, 2823 stream2_syn(ConstructSpdyPush(NULL,
2824 0, 2824 0,
2825 2, 2825 2,
2826 1, 2826 1,
2827 "http://www.google.com/foo.dat")); 2827 "http://www.google.com/foo.dat"));
2828 MockRead reads[] = { 2828 MockRead reads[] = {
2829 CreateMockRead(*stream1_reply, 2), 2829 CreateMockRead(*stream1_reply, 2),
2830 CreateMockRead(*stream2_syn, 3), 2830 CreateMockRead(*stream2_syn, 3),
2831 CreateMockRead(*stream1_body, 4, false), 2831 CreateMockRead(*stream1_body, 4, SYNCHRONOUS),
2832 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 2832 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
2833 arraysize(kPushBodyFrame), 5), 2833 arraysize(kPushBodyFrame), 5),
2834 MockRead(true, ERR_IO_PENDING, 6), // Force a pause 2834 MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause
2835 }; 2835 };
2836 2836
2837 HttpResponseInfo response; 2837 HttpResponseInfo response;
2838 HttpResponseInfo response2; 2838 HttpResponseInfo response2;
2839 std::string expected_push_result("pushed"); 2839 std::string expected_push_result("pushed");
2840 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 2840 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
2841 reads, 2841 reads,
2842 arraysize(reads), 2842 arraysize(reads),
2843 writes, 2843 writes,
2844 arraysize(writes))); 2844 arraysize(writes)));
(...skipping 29 matching lines...) Expand all
2874 stream2_syn(ConstructSpdyPush(NULL, 2874 stream2_syn(ConstructSpdyPush(NULL,
2875 0, 2875 0,
2876 2, 2876 2,
2877 1, 2877 1,
2878 "http://www.google.com/foo.dat")); 2878 "http://www.google.com/foo.dat"));
2879 scoped_ptr<spdy::SpdyFrame> 2879 scoped_ptr<spdy::SpdyFrame>
2880 stream1_body(ConstructSpdyBodyFrame(1, true)); 2880 stream1_body(ConstructSpdyBodyFrame(1, true));
2881 MockRead reads[] = { 2881 MockRead reads[] = {
2882 CreateMockRead(*stream1_reply, 2), 2882 CreateMockRead(*stream1_reply, 2),
2883 CreateMockRead(*stream2_syn, 3), 2883 CreateMockRead(*stream2_syn, 3),
2884 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 2884 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
2885 arraysize(kPushBodyFrame), 5), 2885 arraysize(kPushBodyFrame), 5),
2886 CreateMockRead(*stream1_body, 4, false), 2886 CreateMockRead(*stream1_body, 4, SYNCHRONOUS),
2887 MockRead(true, ERR_IO_PENDING, 6), // Force a pause 2887 MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause
2888 }; 2888 };
2889 2889
2890 HttpResponseInfo response; 2890 HttpResponseInfo response;
2891 HttpResponseInfo response2; 2891 HttpResponseInfo response2;
2892 std::string expected_push_result("pushed"); 2892 std::string expected_push_result("pushed");
2893 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 2893 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
2894 reads, 2894 reads,
2895 arraysize(reads), 2895 arraysize(reads),
2896 writes, 2896 writes,
2897 arraysize(writes))); 2897 arraysize(writes)));
(...skipping 27 matching lines...) Expand all
2925 0, 2925 0,
2926 2, 2926 2,
2927 1, 2927 1,
2928 "http://www.google.com/foo.dat")); 2928 "http://www.google.com/foo.dat"));
2929 scoped_ptr<spdy::SpdyFrame> 2929 scoped_ptr<spdy::SpdyFrame>
2930 stream2_rst(ConstructSpdyRstStream(2, spdy::PROTOCOL_ERROR)); 2930 stream2_rst(ConstructSpdyRstStream(2, spdy::PROTOCOL_ERROR));
2931 MockRead reads[] = { 2931 MockRead reads[] = {
2932 CreateMockRead(*stream1_reply, 2), 2932 CreateMockRead(*stream1_reply, 2),
2933 CreateMockRead(*stream2_syn, 3), 2933 CreateMockRead(*stream2_syn, 3),
2934 CreateMockRead(*stream2_rst, 4), 2934 CreateMockRead(*stream2_rst, 4),
2935 CreateMockRead(*stream1_body, 5, false), 2935 CreateMockRead(*stream1_body, 5, SYNCHRONOUS),
2936 MockRead(true, ERR_IO_PENDING, 6), // Force a pause 2936 MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause
2937 }; 2937 };
2938 2938
2939 scoped_ptr<OrderedSocketData> data( 2939 scoped_ptr<OrderedSocketData> data(
2940 new OrderedSocketData(reads, arraysize(reads), 2940 new OrderedSocketData(reads, arraysize(reads),
2941 writes, arraysize(writes))); 2941 writes, arraysize(writes)));
2942 NormalSpdyTransactionHelper helper(CreateGetRequest(), 2942 NormalSpdyTransactionHelper helper(CreateGetRequest(),
2943 BoundNetLog(), GetParam()); 2943 BoundNetLog(), GetParam());
2944 2944
2945 helper.RunPreTestSetup(); 2945 helper.RunPreTestSetup();
2946 helper.AddData(data.get()); 2946 helper.AddData(data.get());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 scoped_ptr<spdy::SpdyFrame> 3002 scoped_ptr<spdy::SpdyFrame>
3003 stream3_syn(ConstructSpdyPush(NULL, 3003 stream3_syn(ConstructSpdyPush(NULL,
3004 0, 3004 0,
3005 4, 3005 4,
3006 1, 3006 1,
3007 "http://www.google.com/foo.dat")); 3007 "http://www.google.com/foo.dat"));
3008 MockRead reads[] = { 3008 MockRead reads[] = {
3009 CreateMockRead(*stream1_reply, 2), 3009 CreateMockRead(*stream1_reply, 2),
3010 CreateMockRead(*stream2_syn, 3), 3010 CreateMockRead(*stream2_syn, 3),
3011 CreateMockRead(*stream3_syn, 4), 3011 CreateMockRead(*stream3_syn, 4),
3012 CreateMockRead(*stream1_body, 6, false), 3012 CreateMockRead(*stream1_body, 6, SYNCHRONOUS),
3013 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 3013 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
3014 arraysize(kPushBodyFrame), 7), 3014 arraysize(kPushBodyFrame), 7),
3015 MockRead(true, ERR_IO_PENDING, 8), // Force a pause 3015 MockRead(ASYNC, ERR_IO_PENDING, 8), // Force a pause
3016 }; 3016 };
3017 3017
3018 HttpResponseInfo response; 3018 HttpResponseInfo response;
3019 HttpResponseInfo response2; 3019 HttpResponseInfo response2;
3020 std::string expected_push_result("pushed"); 3020 std::string expected_push_result("pushed");
3021 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 3021 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
3022 reads, 3022 reads,
3023 arraysize(reads), 3023 arraysize(reads),
3024 writes, 3024 writes,
3025 arraysize(writes))); 3025 arraysize(writes)));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 3059 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
3060 scoped_ptr<spdy::SpdyFrame> 3060 scoped_ptr<spdy::SpdyFrame>
3061 stream2_syn(ConstructSpdyPush(NULL, 3061 stream2_syn(ConstructSpdyPush(NULL,
3062 0, 3062 0,
3063 2, 3063 2,
3064 1, 3064 1,
3065 "http://www.google.com/foo.dat")); 3065 "http://www.google.com/foo.dat"));
3066 MockRead reads[] = { 3066 MockRead reads[] = {
3067 CreateMockRead(*stream1_reply, 2), 3067 CreateMockRead(*stream1_reply, 2),
3068 CreateMockRead(*stream2_syn, 3), 3068 CreateMockRead(*stream2_syn, 3),
3069 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame1), 3069 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame1),
3070 arraysize(kPushBodyFrame1), 4), 3070 arraysize(kPushBodyFrame1), 4),
3071 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame2), 3071 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame2),
3072 arraysize(kPushBodyFrame2) - 1, 5), 3072 arraysize(kPushBodyFrame2) - 1, 5),
3073 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame3), 3073 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame3),
3074 arraysize(kPushBodyFrame3) - 1, 6), 3074 arraysize(kPushBodyFrame3) - 1, 6),
3075 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame4), 3075 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame4),
3076 arraysize(kPushBodyFrame4) - 1, 7), 3076 arraysize(kPushBodyFrame4) - 1, 7),
3077 CreateMockRead(*stream1_body, 8, false), 3077 CreateMockRead(*stream1_body, 8, SYNCHRONOUS),
3078 MockRead(true, ERR_IO_PENDING, 9), // Force a pause 3078 MockRead(ASYNC, ERR_IO_PENDING, 9), // Force a pause
3079 }; 3079 };
3080 3080
3081 HttpResponseInfo response; 3081 HttpResponseInfo response;
3082 HttpResponseInfo response2; 3082 HttpResponseInfo response2;
3083 std::string expected_push_result("pushed my darling hello my baby"); 3083 std::string expected_push_result("pushed my darling hello my baby");
3084 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 3084 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
3085 reads, 3085 reads,
3086 arraysize(reads), 3086 arraysize(reads),
3087 writes, 3087 writes,
3088 arraysize(writes))); 3088 arraysize(writes)));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 3124 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
3125 scoped_ptr<spdy::SpdyFrame> 3125 scoped_ptr<spdy::SpdyFrame>
3126 stream2_syn(ConstructSpdyPush(NULL, 3126 stream2_syn(ConstructSpdyPush(NULL,
3127 0, 3127 0,
3128 2, 3128 2,
3129 1, 3129 1,
3130 "http://www.google.com/foo.dat")); 3130 "http://www.google.com/foo.dat"));
3131 MockRead reads[] = { 3131 MockRead reads[] = {
3132 CreateMockRead(*stream1_reply, 2), 3132 CreateMockRead(*stream1_reply, 2),
3133 CreateMockRead(*stream2_syn, 3), 3133 CreateMockRead(*stream2_syn, 3),
3134 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame1), 3134 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame1),
3135 arraysize(kPushBodyFrame1), 4), 3135 arraysize(kPushBodyFrame1), 4),
3136 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame2), 3136 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame2),
3137 arraysize(kPushBodyFrame2) - 1, 5), 3137 arraysize(kPushBodyFrame2) - 1, 5),
3138 MockRead(true, ERR_IO_PENDING, 6), // Force a pause 3138 MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause
3139 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame3), 3139 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame3),
3140 arraysize(kPushBodyFrame3) - 1, 7), 3140 arraysize(kPushBodyFrame3) - 1, 7),
3141 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame4), 3141 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame4),
3142 arraysize(kPushBodyFrame4) - 1, 8), 3142 arraysize(kPushBodyFrame4) - 1, 8),
3143 CreateMockRead(*stream1_body.get(), 9, false), 3143 CreateMockRead(*stream1_body.get(), 9, SYNCHRONOUS),
3144 MockRead(true, ERR_IO_PENDING, 10) // Force a pause. 3144 MockRead(ASYNC, ERR_IO_PENDING, 10) // Force a pause.
3145 }; 3145 };
3146 3146
3147 HttpResponseInfo response; 3147 HttpResponseInfo response;
3148 HttpResponseInfo response2; 3148 HttpResponseInfo response2;
3149 std::string expected_push_result("pushed my darling hello my baby"); 3149 std::string expected_push_result("pushed my darling hello my baby");
3150 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 3150 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
3151 reads, 3151 reads,
3152 arraysize(reads), 3152 arraysize(reads),
3153 writes, 3153 writes,
3154 arraysize(writes))); 3154 arraysize(writes)));
(...skipping 30 matching lines...) Expand all
3185 scoped_ptr<spdy::SpdyFrame> 3185 scoped_ptr<spdy::SpdyFrame>
3186 stream2_syn(ConstructSpdyPush(NULL, 3186 stream2_syn(ConstructSpdyPush(NULL,
3187 0, 3187 0,
3188 2, 3188 2,
3189 0, 3189 0,
3190 "http://www.google.com/foo.dat")); 3190 "http://www.google.com/foo.dat"));
3191 MockRead reads[] = { 3191 MockRead reads[] = {
3192 CreateMockRead(*stream1_reply, 2), 3192 CreateMockRead(*stream1_reply, 2),
3193 CreateMockRead(*stream2_syn, 3), 3193 CreateMockRead(*stream2_syn, 3),
3194 CreateMockRead(*stream1_body, 4), 3194 CreateMockRead(*stream1_body, 4),
3195 MockRead(true, ERR_IO_PENDING, 5) // Force a pause 3195 MockRead(ASYNC, ERR_IO_PENDING, 5) // Force a pause
3196 }; 3196 };
3197 3197
3198 scoped_ptr<OrderedSocketData> data( 3198 scoped_ptr<OrderedSocketData> data(
3199 new OrderedSocketData(reads, arraysize(reads), 3199 new OrderedSocketData(reads, arraysize(reads),
3200 writes, arraysize(writes))); 3200 writes, arraysize(writes)));
3201 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3201 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3202 BoundNetLog(), GetParam()); 3202 BoundNetLog(), GetParam());
3203 3203
3204 helper.RunPreTestSetup(); 3204 helper.RunPreTestSetup();
3205 helper.AddData(data.get()); 3205 helper.AddData(data.get());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 scoped_ptr<spdy::SpdyFrame> 3247 scoped_ptr<spdy::SpdyFrame>
3248 stream2_syn(ConstructSpdyPush(NULL, 3248 stream2_syn(ConstructSpdyPush(NULL,
3249 0, 3249 0,
3250 2, 3250 2,
3251 9, 3251 9,
3252 "http://www.google.com/foo.dat")); 3252 "http://www.google.com/foo.dat"));
3253 MockRead reads[] = { 3253 MockRead reads[] = {
3254 CreateMockRead(*stream1_reply, 2), 3254 CreateMockRead(*stream1_reply, 2),
3255 CreateMockRead(*stream2_syn, 3), 3255 CreateMockRead(*stream2_syn, 3),
3256 CreateMockRead(*stream1_body, 4), 3256 CreateMockRead(*stream1_body, 4),
3257 MockRead(true, ERR_IO_PENDING, 5), // Force a pause 3257 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause
3258 }; 3258 };
3259 3259
3260 scoped_ptr<OrderedSocketData> data( 3260 scoped_ptr<OrderedSocketData> data(
3261 new OrderedSocketData(reads, arraysize(reads), 3261 new OrderedSocketData(reads, arraysize(reads),
3262 writes, arraysize(writes))); 3262 writes, arraysize(writes)));
3263 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3263 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3264 BoundNetLog(), GetParam()); 3264 BoundNetLog(), GetParam());
3265 3265
3266 helper.RunPreTestSetup(); 3266 helper.RunPreTestSetup();
3267 helper.AddData(data.get()); 3267 helper.AddData(data.get());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 }; 3305 };
3306 3306
3307 scoped_ptr<spdy::SpdyFrame> 3307 scoped_ptr<spdy::SpdyFrame>
3308 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 3308 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
3309 scoped_ptr<spdy::SpdyFrame> 3309 scoped_ptr<spdy::SpdyFrame>
3310 stream2_syn(ConstructSpdyPush(NULL, 0, 2, 1)); 3310 stream2_syn(ConstructSpdyPush(NULL, 0, 2, 1));
3311 MockRead reads[] = { 3311 MockRead reads[] = {
3312 CreateMockRead(*stream1_reply, 2), 3312 CreateMockRead(*stream1_reply, 2),
3313 CreateMockRead(*stream2_syn, 3), 3313 CreateMockRead(*stream2_syn, 3),
3314 CreateMockRead(*stream1_body, 4), 3314 CreateMockRead(*stream1_body, 4),
3315 MockRead(true, ERR_IO_PENDING, 5) // Force a pause 3315 MockRead(ASYNC, ERR_IO_PENDING, 5) // Force a pause
3316 }; 3316 };
3317 3317
3318 scoped_ptr<OrderedSocketData> data( 3318 scoped_ptr<OrderedSocketData> data(
3319 new OrderedSocketData(reads, arraysize(reads), 3319 new OrderedSocketData(reads, arraysize(reads),
3320 writes, arraysize(writes))); 3320 writes, arraysize(writes)));
3321 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3321 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3322 BoundNetLog(), GetParam()); 3322 BoundNetLog(), GetParam());
3323 3323
3324 helper.RunPreTestSetup(); 3324 helper.RunPreTestSetup();
3325 helper.AddData(data.get()); 3325 helper.AddData(data.get());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3394 MockWrite writes[] = { CreateMockWrite(*req) }; 3394 MockWrite writes[] = { CreateMockWrite(*req) };
3395 3395
3396 scoped_ptr<spdy::SpdyFrame> resp( 3396 scoped_ptr<spdy::SpdyFrame> resp(
3397 ConstructSpdyGetSynReply(test_cases[i].extra_headers, 3397 ConstructSpdyGetSynReply(test_cases[i].extra_headers,
3398 test_cases[i].num_headers, 3398 test_cases[i].num_headers,
3399 1)); 3399 1));
3400 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 3400 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
3401 MockRead reads[] = { 3401 MockRead reads[] = {
3402 CreateMockRead(*resp), 3402 CreateMockRead(*resp),
3403 CreateMockRead(*body), 3403 CreateMockRead(*body),
3404 MockRead(true, 0, 0) // EOF 3404 MockRead(ASYNC, 0, 0) // EOF
3405 }; 3405 };
3406 3406
3407 scoped_ptr<DelayedSocketData> data( 3407 scoped_ptr<DelayedSocketData> data(
3408 new DelayedSocketData(1, reads, arraysize(reads), 3408 new DelayedSocketData(1, reads, arraysize(reads),
3409 writes, arraysize(writes))); 3409 writes, arraysize(writes)));
3410 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3410 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3411 BoundNetLog(), GetParam()); 3411 BoundNetLog(), GetParam());
3412 helper.RunToCompletion(data.get()); 3412 helper.RunToCompletion(data.get());
3413 TransactionHelperResult out = helper.output(); 3413 TransactionHelperResult out = helper.output();
3414 3414
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 ConstructSpdyPacket(*test_cases[i].syn_reply, 3533 ConstructSpdyPacket(*test_cases[i].syn_reply,
3534 test_cases[i].extra_headers[1], 3534 test_cases[i].extra_headers[1],
3535 test_cases[i].num_headers[1], 3535 test_cases[i].num_headers[1],
3536 NULL, 3536 NULL,
3537 0)); 3537 0));
3538 3538
3539 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 3539 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
3540 MockRead reads[] = { 3540 MockRead reads[] = {
3541 CreateMockRead(*frame_reply), 3541 CreateMockRead(*frame_reply),
3542 CreateMockRead(*body), 3542 CreateMockRead(*body),
3543 MockRead(true, 0, 0) // EOF 3543 MockRead(ASYNC, 0, 0) // EOF
3544 }; 3544 };
3545 3545
3546 // Attach the headers to the request. 3546 // Attach the headers to the request.
3547 int header_count = test_cases[i].num_headers[0]; 3547 int header_count = test_cases[i].num_headers[0];
3548 3548
3549 HttpRequestInfo request = CreateGetRequest(); 3549 HttpRequestInfo request = CreateGetRequest();
3550 for (int ct = 0; ct < header_count; ct++) { 3550 for (int ct = 0; ct < header_count; ct++) {
3551 const char* header_key = test_cases[i].extra_headers[0][ct * 2]; 3551 const char* header_key = test_cases[i].extra_headers[0][ct * 2];
3552 const char* header_value = test_cases[i].extra_headers[0][ct * 2 + 1]; 3552 const char* header_value = test_cases[i].extra_headers[0][ct * 2 + 1];
3553 request.extra_headers.SetHeader(header_key, header_value); 3553 request.extra_headers.SetHeader(header_key, header_value);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3649 3649
3650 scoped_ptr<spdy::SpdyFrame> resp( 3650 scoped_ptr<spdy::SpdyFrame> resp(
3651 ConstructSpdyPacket(kSynStartHeader, 3651 ConstructSpdyPacket(kSynStartHeader,
3652 NULL, 0, 3652 NULL, 0,
3653 test_cases[i].headers, 3653 test_cases[i].headers,
3654 test_cases[i].num_headers)); 3654 test_cases[i].num_headers));
3655 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 3655 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
3656 MockRead reads[] = { 3656 MockRead reads[] = {
3657 CreateMockRead(*resp), 3657 CreateMockRead(*resp),
3658 CreateMockRead(*body), 3658 CreateMockRead(*body),
3659 MockRead(true, 0, 0) // EOF 3659 MockRead(ASYNC, 0, 0) // EOF
3660 }; 3660 };
3661 3661
3662 scoped_ptr<DelayedSocketData> data( 3662 scoped_ptr<DelayedSocketData> data(
3663 new DelayedSocketData(1, reads, arraysize(reads), 3663 new DelayedSocketData(1, reads, arraysize(reads),
3664 writes, arraysize(writes))); 3664 writes, arraysize(writes)));
3665 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3665 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3666 BoundNetLog(), GetParam()); 3666 BoundNetLog(), GetParam());
3667 helper.RunToCompletion(data.get()); 3667 helper.RunToCompletion(data.get());
3668 TransactionHelperResult out = helper.output(); 3668 TransactionHelperResult out = helper.output();
3669 EXPECT_EQ(ERR_INCOMPLETE_SPDY_HEADERS, out.rv); 3669 EXPECT_EQ(ERR_INCOMPLETE_SPDY_HEADERS, out.rv);
(...skipping 11 matching lines...) Expand all
3681 const spdy::SpdyFrame* syn_reply; 3681 const spdy::SpdyFrame* syn_reply;
3682 } test_cases[] = { 3682 } test_cases[] = {
3683 { syn_reply_wrong_length.get(), }, 3683 { syn_reply_wrong_length.get(), },
3684 }; 3684 };
3685 3685
3686 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 3686 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
3687 scoped_ptr<spdy::SpdyFrame> req( 3687 scoped_ptr<spdy::SpdyFrame> req(
3688 ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 3688 ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
3689 MockWrite writes[] = { 3689 MockWrite writes[] = {
3690 CreateMockWrite(*req), 3690 CreateMockWrite(*req),
3691 MockWrite(true, 0, 0) // EOF 3691 MockWrite(ASYNC, 0, 0) // EOF
3692 }; 3692 };
3693 3693
3694 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 3694 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
3695 MockRead reads[] = { 3695 MockRead reads[] = {
3696 CreateMockRead(*test_cases[i].syn_reply), 3696 CreateMockRead(*test_cases[i].syn_reply),
3697 CreateMockRead(*body), 3697 CreateMockRead(*body),
3698 MockRead(true, 0, 0) // EOF 3698 MockRead(ASYNC, 0, 0) // EOF
3699 }; 3699 };
3700 3700
3701 scoped_ptr<DelayedSocketData> data( 3701 scoped_ptr<DelayedSocketData> data(
3702 new DelayedSocketData(1, reads, arraysize(reads), 3702 new DelayedSocketData(1, reads, arraysize(reads),
3703 writes, arraysize(writes))); 3703 writes, arraysize(writes)));
3704 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3704 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3705 BoundNetLog(), GetParam()); 3705 BoundNetLog(), GetParam());
3706 helper.RunToCompletion(data.get()); 3706 helper.RunToCompletion(data.get());
3707 TransactionHelperResult out = helper.output(); 3707 TransactionHelperResult out = helper.output();
3708 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); 3708 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv);
3709 } 3709 }
3710 } 3710 }
3711 3711
3712 // Test that we shutdown correctly on write errors. 3712 // Test that we shutdown correctly on write errors.
3713 TEST_P(SpdyNetworkTransactionTest, WriteError) { 3713 TEST_P(SpdyNetworkTransactionTest, WriteError) {
3714 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 3714 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
3715 MockWrite writes[] = { 3715 MockWrite writes[] = {
3716 // We'll write 10 bytes successfully 3716 // We'll write 10 bytes successfully
3717 MockWrite(true, req->data(), 10), 3717 MockWrite(ASYNC, req->data(), 10),
3718 // Followed by ERROR! 3718 // Followed by ERROR!
3719 MockWrite(true, ERR_FAILED), 3719 MockWrite(ASYNC, ERR_FAILED),
3720 }; 3720 };
3721 3721
3722 scoped_ptr<DelayedSocketData> data( 3722 scoped_ptr<DelayedSocketData> data(
3723 new DelayedSocketData(2, NULL, 0, 3723 new DelayedSocketData(2, NULL, 0,
3724 writes, arraysize(writes))); 3724 writes, arraysize(writes)));
3725 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3725 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3726 BoundNetLog(), GetParam()); 3726 BoundNetLog(), GetParam());
3727 helper.RunToCompletion(data.get()); 3727 helper.RunToCompletion(data.get());
3728 TransactionHelperResult out = helper.output(); 3728 TransactionHelperResult out = helper.output();
3729 EXPECT_EQ(ERR_FAILED, out.rv); 3729 EXPECT_EQ(ERR_FAILED, out.rv);
3730 data->Reset(); 3730 data->Reset();
3731 } 3731 }
3732 3732
3733 // Test that partial writes work. 3733 // Test that partial writes work.
3734 TEST_P(SpdyNetworkTransactionTest, PartialWrite) { 3734 TEST_P(SpdyNetworkTransactionTest, PartialWrite) {
3735 // Chop the SYN_STREAM frame into 5 chunks. 3735 // Chop the SYN_STREAM frame into 5 chunks.
3736 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 3736 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
3737 const int kChunks = 5; 3737 const int kChunks = 5;
3738 scoped_array<MockWrite> writes(ChopWriteFrame(*req.get(), kChunks)); 3738 scoped_array<MockWrite> writes(ChopWriteFrame(*req.get(), kChunks));
3739 3739
3740 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 3740 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
3741 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 3741 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
3742 MockRead reads[] = { 3742 MockRead reads[] = {
3743 CreateMockRead(*resp), 3743 CreateMockRead(*resp),
3744 CreateMockRead(*body), 3744 CreateMockRead(*body),
3745 MockRead(true, 0, 0) // EOF 3745 MockRead(ASYNC, 0, 0) // EOF
3746 }; 3746 };
3747 3747
3748 scoped_ptr<DelayedSocketData> data( 3748 scoped_ptr<DelayedSocketData> data(
3749 new DelayedSocketData(kChunks, reads, arraysize(reads), 3749 new DelayedSocketData(kChunks, reads, arraysize(reads),
3750 writes.get(), kChunks)); 3750 writes.get(), kChunks));
3751 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3751 NormalSpdyTransactionHelper helper(CreateGetRequest(),
3752 BoundNetLog(), GetParam()); 3752 BoundNetLog(), GetParam());
3753 helper.RunToCompletion(data.get()); 3753 helper.RunToCompletion(data.get());
3754 TransactionHelperResult out = helper.output(); 3754 TransactionHelperResult out = helper.output();
3755 EXPECT_EQ(OK, out.rv); 3755 EXPECT_EQ(OK, out.rv);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3797 }; 3797 };
3798 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(kExtraHeaders, 1, false, 1, 3798 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(kExtraHeaders, 1, false, 1,
3799 LOWEST)); 3799 LOWEST));
3800 MockWrite writes[] = { CreateMockWrite(*req) }; 3800 MockWrite writes[] = { CreateMockWrite(*req) };
3801 3801
3802 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 3802 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
3803 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 3803 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
3804 MockRead reads[] = { 3804 MockRead reads[] = {
3805 CreateMockRead(*resp), 3805 CreateMockRead(*resp),
3806 CreateMockRead(*body), 3806 CreateMockRead(*body),
3807 MockRead(true, 0, 0) // EOF 3807 MockRead(ASYNC, 0, 0) // EOF
3808 }; 3808 };
3809 3809
3810 net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded); 3810 net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
3811 3811
3812 scoped_ptr<DelayedSocketData> data( 3812 scoped_ptr<DelayedSocketData> data(
3813 new DelayedSocketData(1, reads, arraysize(reads), 3813 new DelayedSocketData(1, reads, arraysize(reads),
3814 writes, arraysize(writes))); 3814 writes, arraysize(writes)));
3815 NormalSpdyTransactionHelper helper(CreateGetRequestWithUserAgent(), 3815 NormalSpdyTransactionHelper helper(CreateGetRequestWithUserAgent(),
3816 log.bound(), GetParam()); 3816 log.bound(), GetParam());
3817 helper.RunToCompletion(data.get()); 3817 helper.RunToCompletion(data.get());
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
3899 char combined_data_frames[100]; 3899 char combined_data_frames[100];
3900 int combined_data_frames_len = 3900 int combined_data_frames_len =
3901 CombineFrames(data_frames, arraysize(data_frames), 3901 CombineFrames(data_frames, arraysize(data_frames),
3902 combined_data_frames, arraysize(combined_data_frames)); 3902 combined_data_frames, arraysize(combined_data_frames));
3903 scoped_ptr<spdy::SpdyFrame> last_frame( 3903 scoped_ptr<spdy::SpdyFrame> last_frame(
3904 framer.CreateDataFrame(1, "d", 1, spdy::DATA_FLAG_FIN)); 3904 framer.CreateDataFrame(1, "d", 1, spdy::DATA_FLAG_FIN));
3905 3905
3906 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 3906 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
3907 MockRead reads[] = { 3907 MockRead reads[] = {
3908 CreateMockRead(*resp), 3908 CreateMockRead(*resp),
3909 MockRead(true, ERR_IO_PENDING), // Force a pause 3909 MockRead(ASYNC, ERR_IO_PENDING), // Force a pause
3910 MockRead(true, combined_data_frames, combined_data_frames_len), 3910 MockRead(ASYNC, combined_data_frames, combined_data_frames_len),
3911 MockRead(true, ERR_IO_PENDING), // Force a pause 3911 MockRead(ASYNC, ERR_IO_PENDING), // Force a pause
3912 CreateMockRead(*last_frame), 3912 CreateMockRead(*last_frame),
3913 MockRead(true, 0, 0) // EOF 3913 MockRead(ASYNC, 0, 0) // EOF
3914 }; 3914 };
3915 3915
3916 scoped_ptr<DelayedSocketData> data( 3916 scoped_ptr<DelayedSocketData> data(
3917 new DelayedSocketData(1, reads, arraysize(reads), 3917 new DelayedSocketData(1, reads, arraysize(reads),
3918 writes, arraysize(writes))); 3918 writes, arraysize(writes)));
3919 3919
3920 3920
3921 TestCompletionCallback callback; 3921 TestCompletionCallback callback;
3922 3922
3923 NormalSpdyTransactionHelper helper(CreateGetRequest(), 3923 NormalSpdyTransactionHelper helper(CreateGetRequest(),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 data_frame_fin.get() 3998 data_frame_fin.get()
3999 }; 3999 };
4000 char combined_data_frames[100]; 4000 char combined_data_frames[100];
4001 int combined_data_frames_len = 4001 int combined_data_frames_len =
4002 CombineFrames(data_frames, arraysize(data_frames), 4002 CombineFrames(data_frames, arraysize(data_frames),
4003 combined_data_frames, arraysize(combined_data_frames)); 4003 combined_data_frames, arraysize(combined_data_frames));
4004 4004
4005 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4005 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4006 MockRead reads[] = { 4006 MockRead reads[] = {
4007 CreateMockRead(*resp), 4007 CreateMockRead(*resp),
4008 MockRead(true, ERR_IO_PENDING), // Force a pause 4008 MockRead(ASYNC, ERR_IO_PENDING), // Force a pause
4009 MockRead(true, combined_data_frames, combined_data_frames_len), 4009 MockRead(ASYNC, combined_data_frames, combined_data_frames_len),
4010 MockRead(true, 0, 0) // EOF 4010 MockRead(ASYNC, 0, 0) // EOF
4011 }; 4011 };
4012 4012
4013 scoped_ptr<DelayedSocketData> data( 4013 scoped_ptr<DelayedSocketData> data(
4014 new DelayedSocketData(1, reads, arraysize(reads), 4014 new DelayedSocketData(1, reads, arraysize(reads),
4015 writes, arraysize(writes))); 4015 writes, arraysize(writes)));
4016 4016
4017 NormalSpdyTransactionHelper helper(CreateGetRequest(), 4017 NormalSpdyTransactionHelper helper(CreateGetRequest(),
4018 BoundNetLog(), GetParam()); 4018 BoundNetLog(), GetParam());
4019 helper.RunPreTestSetup(); 4019 helper.RunPreTestSetup();
4020 helper.AddData(data.get()); 4020 helper.AddData(data.get());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4097 data_frame.get(), 4097 data_frame.get(),
4098 data_frame.get(), 4098 data_frame.get(),
4099 data_frame_fin.get() 4099 data_frame_fin.get()
4100 }; 4100 };
4101 char combined_frames[200]; 4101 char combined_frames[200];
4102 int combined_frames_len = 4102 int combined_frames_len =
4103 CombineFrames(frames, arraysize(frames), 4103 CombineFrames(frames, arraysize(frames),
4104 combined_frames, arraysize(combined_frames)); 4104 combined_frames, arraysize(combined_frames));
4105 4105
4106 MockRead reads[] = { 4106 MockRead reads[] = {
4107 MockRead(true, combined_frames, combined_frames_len), 4107 MockRead(ASYNC, combined_frames, combined_frames_len),
4108 MockRead(true, 0, 0) // EOF 4108 MockRead(ASYNC, 0, 0) // EOF
4109 }; 4109 };
4110 4110
4111 scoped_ptr<DelayedSocketData> data( 4111 scoped_ptr<DelayedSocketData> data(
4112 new DelayedSocketData(1, reads, arraysize(reads), 4112 new DelayedSocketData(1, reads, arraysize(reads),
4113 writes, arraysize(writes))); 4113 writes, arraysize(writes)));
4114 4114
4115 NormalSpdyTransactionHelper helper(CreateGetRequest(), 4115 NormalSpdyTransactionHelper helper(CreateGetRequest(),
4116 BoundNetLog(), GetParam()); 4116 BoundNetLog(), GetParam());
4117 helper.RunPreTestSetup(); 4117 helper.RunPreTestSetup();
4118 helper.AddData(data.get()); 4118 helper.AddData(data.get());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4185 data_frame.get(), 4185 data_frame.get(),
4186 data_frame.get() 4186 data_frame.get()
4187 }; 4187 };
4188 char combined_data_frames[100]; 4188 char combined_data_frames[100];
4189 int combined_data_frames_len = 4189 int combined_data_frames_len =
4190 CombineFrames(data_frames, arraysize(data_frames), 4190 CombineFrames(data_frames, arraysize(data_frames),
4191 combined_data_frames, arraysize(combined_data_frames)); 4191 combined_data_frames, arraysize(combined_data_frames));
4192 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4192 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4193 MockRead reads[] = { 4193 MockRead reads[] = {
4194 CreateMockRead(*resp), 4194 CreateMockRead(*resp),
4195 MockRead(true, ERR_IO_PENDING), // Force a wait 4195 MockRead(ASYNC, ERR_IO_PENDING), // Force a wait
4196 MockRead(true, combined_data_frames, combined_data_frames_len), 4196 MockRead(ASYNC, combined_data_frames, combined_data_frames_len),
4197 MockRead(true, 0, 0) // EOF 4197 MockRead(ASYNC, 0, 0) // EOF
4198 }; 4198 };
4199 4199
4200 scoped_ptr<DelayedSocketData> data( 4200 scoped_ptr<DelayedSocketData> data(
4201 new DelayedSocketData(1, reads, arraysize(reads), 4201 new DelayedSocketData(1, reads, arraysize(reads),
4202 writes, arraysize(writes))); 4202 writes, arraysize(writes)));
4203 4203
4204 NormalSpdyTransactionHelper helper(CreateGetRequest(), 4204 NormalSpdyTransactionHelper helper(CreateGetRequest(),
4205 BoundNetLog(), GetParam()); 4205 BoundNetLog(), GetParam());
4206 helper.RunPreTestSetup(); 4206 helper.RunPreTestSetup();
4207 helper.AddData(data.get()); 4207 helper.AddData(data.get());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4266 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 4266 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
4267 MockWrite writes[] = { CreateMockWrite(*req) }; 4267 MockWrite writes[] = { CreateMockWrite(*req) };
4268 4268
4269 // NOTE: We don't FIN the stream. 4269 // NOTE: We don't FIN the stream.
4270 scoped_ptr<spdy::SpdyFrame> data_frame( 4270 scoped_ptr<spdy::SpdyFrame> data_frame(
4271 framer.CreateDataFrame(1, "message", 7, spdy::DATA_FLAG_NONE)); 4271 framer.CreateDataFrame(1, "message", 7, spdy::DATA_FLAG_NONE));
4272 4272
4273 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4273 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4274 MockRead reads[] = { 4274 MockRead reads[] = {
4275 CreateMockRead(*resp), 4275 CreateMockRead(*resp),
4276 MockRead(true, ERR_IO_PENDING), // Force a wait 4276 MockRead(ASYNC, ERR_IO_PENDING), // Force a wait
4277 CreateMockRead(*data_frame), 4277 CreateMockRead(*data_frame),
4278 MockRead(true, 0, 0) // EOF 4278 MockRead(ASYNC, 0, 0) // EOF
4279 }; 4279 };
4280 4280
4281 scoped_ptr<DelayedSocketData> data( 4281 scoped_ptr<DelayedSocketData> data(
4282 new DelayedSocketData(1, reads, arraysize(reads), 4282 new DelayedSocketData(1, reads, arraysize(reads),
4283 writes, arraysize(writes))); 4283 writes, arraysize(writes)));
4284 4284
4285 NormalSpdyTransactionHelper helper(CreateGetRequest(), 4285 NormalSpdyTransactionHelper helper(CreateGetRequest(),
4286 BoundNetLog(), GetParam()); 4286 BoundNetLog(), GetParam());
4287 helper.RunPreTestSetup(); 4287 helper.RunPreTestSetup();
4288 helper.AddData(data.get()); 4288 helper.AddData(data.get());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4397 setting.set_id(kSampleId3); 4397 setting.set_id(kSampleId3);
4398 settings.push_back(std::make_pair(setting, kSampleValue3)); 4398 settings.push_back(std::make_pair(setting, kSampleValue3));
4399 settings_frame.reset(ConstructSpdySettings(settings)); 4399 settings_frame.reset(ConstructSpdySettings(settings));
4400 } 4400 }
4401 4401
4402 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 4402 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
4403 MockRead reads[] = { 4403 MockRead reads[] = {
4404 CreateMockRead(*reply), 4404 CreateMockRead(*reply),
4405 CreateMockRead(*body), 4405 CreateMockRead(*body),
4406 CreateMockRead(*settings_frame), 4406 CreateMockRead(*settings_frame),
4407 MockRead(true, 0, 0) // EOF 4407 MockRead(ASYNC, 0, 0) // EOF
4408 }; 4408 };
4409 4409
4410 scoped_ptr<DelayedSocketData> data( 4410 scoped_ptr<DelayedSocketData> data(
4411 new DelayedSocketData(1, reads, arraysize(reads), 4411 new DelayedSocketData(1, reads, arraysize(reads),
4412 writes, arraysize(writes))); 4412 writes, arraysize(writes)));
4413 helper.AddData(data.get()); 4413 helper.AddData(data.get());
4414 helper.RunDefaultTest(); 4414 helper.RunDefaultTest();
4415 helper.VerifyDataConsumed(); 4415 helper.VerifyDataConsumed();
4416 TransactionHelperResult out = helper.output(); 4416 TransactionHelperResult out = helper.output();
4417 EXPECT_EQ(OK, out.rv); 4417 EXPECT_EQ(OK, out.rv);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 ConstructSpdyPacket(kSynReplyInfo, 4515 ConstructSpdyPacket(kSynReplyInfo,
4516 kExtraHeaders, 4516 kExtraHeaders,
4517 arraysize(kExtraHeaders) / 2, 4517 arraysize(kExtraHeaders) / 2,
4518 NULL, 4518 NULL,
4519 0)); 4519 0));
4520 4520
4521 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 4521 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
4522 MockRead reads[] = { 4522 MockRead reads[] = {
4523 CreateMockRead(*reply), 4523 CreateMockRead(*reply),
4524 CreateMockRead(*body), 4524 CreateMockRead(*body),
4525 MockRead(true, 0, 0) // EOF 4525 MockRead(ASYNC, 0, 0) // EOF
4526 }; 4526 };
4527 4527
4528 scoped_ptr<DelayedSocketData> data( 4528 scoped_ptr<DelayedSocketData> data(
4529 new DelayedSocketData(2, reads, arraysize(reads), 4529 new DelayedSocketData(2, reads, arraysize(reads),
4530 writes, arraysize(writes))); 4530 writes, arraysize(writes)));
4531 helper.AddData(data.get()); 4531 helper.AddData(data.get());
4532 helper.RunDefaultTest(); 4532 helper.RunDefaultTest();
4533 helper.VerifyDataConsumed(); 4533 helper.VerifyDataConsumed();
4534 TransactionHelperResult out = helper.output(); 4534 TransactionHelperResult out = helper.output();
4535 EXPECT_EQ(OK, out.rv); 4535 EXPECT_EQ(OK, out.rv);
(...skipping 23 matching lines...) Expand all
4559 } 4559 }
4560 } 4560 }
4561 4561
4562 TEST_P(SpdyNetworkTransactionTest, GoAwayWithActiveStream) { 4562 TEST_P(SpdyNetworkTransactionTest, GoAwayWithActiveStream) {
4563 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 4563 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
4564 MockWrite writes[] = { CreateMockWrite(*req) }; 4564 MockWrite writes[] = { CreateMockWrite(*req) };
4565 4565
4566 scoped_ptr<spdy::SpdyFrame> go_away(ConstructSpdyGoAway()); 4566 scoped_ptr<spdy::SpdyFrame> go_away(ConstructSpdyGoAway());
4567 MockRead reads[] = { 4567 MockRead reads[] = {
4568 CreateMockRead(*go_away), 4568 CreateMockRead(*go_away),
4569 MockRead(true, 0, 0), // EOF 4569 MockRead(ASYNC, 0, 0), // EOF
4570 }; 4570 };
4571 4571
4572 scoped_ptr<DelayedSocketData> data( 4572 scoped_ptr<DelayedSocketData> data(
4573 new DelayedSocketData(1, reads, arraysize(reads), 4573 new DelayedSocketData(1, reads, arraysize(reads),
4574 writes, arraysize(writes))); 4574 writes, arraysize(writes)));
4575 NormalSpdyTransactionHelper helper(CreateGetRequest(), 4575 NormalSpdyTransactionHelper helper(CreateGetRequest(),
4576 BoundNetLog(), GetParam()); 4576 BoundNetLog(), GetParam());
4577 helper.AddData(data.get()); 4577 helper.AddData(data.get());
4578 helper.RunToCompletion(data.get()); 4578 helper.RunToCompletion(data.get());
4579 TransactionHelperResult out = helper.output(); 4579 TransactionHelperResult out = helper.output();
4580 EXPECT_EQ(ERR_ABORTED, out.rv); 4580 EXPECT_EQ(ERR_ABORTED, out.rv);
4581 } 4581 }
4582 4582
4583 TEST_P(SpdyNetworkTransactionTest, CloseWithActiveStream) { 4583 TEST_P(SpdyNetworkTransactionTest, CloseWithActiveStream) {
4584 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 4584 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
4585 MockWrite writes[] = { CreateMockWrite(*req) }; 4585 MockWrite writes[] = { CreateMockWrite(*req) };
4586 4586
4587 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4587 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4588 MockRead reads[] = { 4588 MockRead reads[] = {
4589 CreateMockRead(*resp), 4589 CreateMockRead(*resp),
4590 MockRead(false, 0, 0) // EOF 4590 MockRead(SYNCHRONOUS, 0, 0) // EOF
4591 }; 4591 };
4592 4592
4593 scoped_ptr<DelayedSocketData> data( 4593 scoped_ptr<DelayedSocketData> data(
4594 new DelayedSocketData(1, reads, arraysize(reads), 4594 new DelayedSocketData(1, reads, arraysize(reads),
4595 writes, arraysize(writes))); 4595 writes, arraysize(writes)));
4596 BoundNetLog log; 4596 BoundNetLog log;
4597 NormalSpdyTransactionHelper helper(CreateGetRequest(), 4597 NormalSpdyTransactionHelper helper(CreateGetRequest(),
4598 log, GetParam()); 4598 log, GetParam());
4599 helper.RunPreTestSetup(); 4599 helper.RunPreTestSetup();
4600 helper.AddData(data.get()); 4600 helper.AddData(data.get());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4634 "Proxy-Connection: keep-alive\r\n\r\n"}; 4634 "Proxy-Connection: keep-alive\r\n\r\n"};
4635 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n" 4635 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n"
4636 "Host: www.google.com\r\n" 4636 "Host: www.google.com\r\n"
4637 "Proxy-Connection: keep-alive\r\n\r\n"}; 4637 "Proxy-Connection: keep-alive\r\n\r\n"};
4638 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; 4638 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"};
4639 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 4639 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
4640 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4640 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4641 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 4641 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
4642 4642
4643 MockWrite writes_SPDYNPN[] = { 4643 MockWrite writes_SPDYNPN[] = {
4644 MockWrite(false, kConnect443, arraysize(kConnect443) - 1, 0), 4644 MockWrite(SYNCHRONOUS, kConnect443, arraysize(kConnect443) - 1, 0),
4645 CreateMockWrite(*req, 2), 4645 CreateMockWrite(*req, 2),
4646 }; 4646 };
4647 MockRead reads_SPDYNPN[] = { 4647 MockRead reads_SPDYNPN[] = {
4648 MockRead(false, kHTTP200, arraysize(kHTTP200) - 1, 1), 4648 MockRead(SYNCHRONOUS, kHTTP200, arraysize(kHTTP200) - 1, 1),
4649 CreateMockRead(*resp, 3), 4649 CreateMockRead(*resp, 3),
4650 CreateMockRead(*body.get(), 4), 4650 CreateMockRead(*body.get(), 4),
4651 MockRead(true, 0, 0, 5), 4651 MockRead(ASYNC, 0, 0, 5),
4652 }; 4652 };
4653 4653
4654 MockWrite writes_SPDYSSL[] = { 4654 MockWrite writes_SPDYSSL[] = {
4655 MockWrite(false, kConnect80, arraysize(kConnect80) - 1, 0), 4655 MockWrite(SYNCHRONOUS, kConnect80, arraysize(kConnect80) - 1, 0),
4656 CreateMockWrite(*req, 2), 4656 CreateMockWrite(*req, 2),
4657 }; 4657 };
4658 MockRead reads_SPDYSSL[] = { 4658 MockRead reads_SPDYSSL[] = {
4659 MockRead(false, kHTTP200, arraysize(kHTTP200) - 1, 1), 4659 MockRead(SYNCHRONOUS, kHTTP200, arraysize(kHTTP200) - 1, 1),
4660 CreateMockRead(*resp, 3), 4660 CreateMockRead(*resp, 3),
4661 CreateMockRead(*body.get(), 4), 4661 CreateMockRead(*body.get(), 4),
4662 MockRead(true, 0, 0, 5), 4662 MockRead(ASYNC, 0, 0, 5),
4663 }; 4663 };
4664 4664
4665 MockWrite writes_SPDYNOSSL[] = { 4665 MockWrite writes_SPDYNOSSL[] = {
4666 CreateMockWrite(*req, 0), 4666 CreateMockWrite(*req, 0),
4667 }; 4667 };
4668 4668
4669 MockRead reads_SPDYNOSSL[] = { 4669 MockRead reads_SPDYNOSSL[] = {
4670 CreateMockRead(*resp, 1), 4670 CreateMockRead(*resp, 1),
4671 CreateMockRead(*body.get(), 2), 4671 CreateMockRead(*body.get(), 2),
4672 MockRead(true, 0, 0, 3), 4672 MockRead(ASYNC, 0, 0, 3),
4673 }; 4673 };
4674 4674
4675 scoped_ptr<OrderedSocketData> data; 4675 scoped_ptr<OrderedSocketData> data;
4676 switch(GetParam()) { 4676 switch(GetParam()) {
4677 case SPDYNOSSL: 4677 case SPDYNOSSL:
4678 data.reset(new OrderedSocketData(reads_SPDYNOSSL, 4678 data.reset(new OrderedSocketData(reads_SPDYNOSSL,
4679 arraysize(reads_SPDYNOSSL), 4679 arraysize(reads_SPDYNOSSL),
4680 writes_SPDYNOSSL, 4680 writes_SPDYNOSSL,
4681 arraysize(writes_SPDYNOSSL))); 4681 arraysize(writes_SPDYNOSSL)));
4682 break; 4682 break;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 4742 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
4743 MockWrite writes[] = { 4743 MockWrite writes[] = {
4744 CreateMockWrite(*req, 1), 4744 CreateMockWrite(*req, 1),
4745 }; 4745 };
4746 4746
4747 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4747 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4748 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 4748 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
4749 MockRead reads[] = { 4749 MockRead reads[] = {
4750 CreateMockRead(*resp, 2), 4750 CreateMockRead(*resp, 2),
4751 CreateMockRead(*body, 3), 4751 CreateMockRead(*body, 3),
4752 MockRead(true, ERR_IO_PENDING, 4), // Force a pause 4752 MockRead(ASYNC, ERR_IO_PENDING, 4), // Force a pause
4753 MockRead(true, 0, 5) // EOF 4753 MockRead(ASYNC, 0, 5) // EOF
4754 }; 4754 };
4755 scoped_ptr<OrderedSocketData> data( 4755 scoped_ptr<OrderedSocketData> data(
4756 new OrderedSocketData(reads, arraysize(reads), 4756 new OrderedSocketData(reads, arraysize(reads),
4757 writes, arraysize(writes))); 4757 writes, arraysize(writes)));
4758 helper.AddData(data.get()); 4758 helper.AddData(data.get());
4759 HttpNetworkTransaction* trans = helper.trans(); 4759 HttpNetworkTransaction* trans = helper.trans();
4760 4760
4761 TestCompletionCallback callback; 4761 TestCompletionCallback callback;
4762 TransactionHelperResult out; 4762 TransactionHelperResult out;
4763 out.rv = trans->Start( 4763 out.rv = trans->Start(
(...skipping 29 matching lines...) Expand all
4793 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n" 4793 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n"
4794 "Host: www.google.com\r\n" 4794 "Host: www.google.com\r\n"
4795 "Proxy-Connection: keep-alive\r\n\r\n"}; 4795 "Proxy-Connection: keep-alive\r\n\r\n"};
4796 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; 4796 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"};
4797 scoped_ptr<spdy::SpdyFrame> req2(ConstructSpdyGet( 4797 scoped_ptr<spdy::SpdyFrame> req2(ConstructSpdyGet(
4798 "http://www.google.com/foo.dat", false, 1, LOWEST)); 4798 "http://www.google.com/foo.dat", false, 1, LOWEST));
4799 scoped_ptr<spdy::SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 1)); 4799 scoped_ptr<spdy::SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 1));
4800 scoped_ptr<spdy::SpdyFrame> body2(ConstructSpdyBodyFrame(1, true)); 4800 scoped_ptr<spdy::SpdyFrame> body2(ConstructSpdyBodyFrame(1, true));
4801 4801
4802 MockWrite writes_SPDYNPN[] = { 4802 MockWrite writes_SPDYNPN[] = {
4803 MockWrite(false, kConnect443, arraysize(kConnect443) - 1, 0), 4803 MockWrite(SYNCHRONOUS, kConnect443, arraysize(kConnect443) - 1, 0),
4804 CreateMockWrite(*req2, 2), 4804 CreateMockWrite(*req2, 2),
4805 }; 4805 };
4806 MockRead reads_SPDYNPN[] = { 4806 MockRead reads_SPDYNPN[] = {
4807 MockRead(false, kHTTP200, arraysize(kHTTP200) - 1, 1), 4807 MockRead(SYNCHRONOUS, kHTTP200, arraysize(kHTTP200) - 1, 1),
4808 CreateMockRead(*resp2, 3), 4808 CreateMockRead(*resp2, 3),
4809 CreateMockRead(*body2, 4), 4809 CreateMockRead(*body2, 4),
4810 MockRead(true, 0, 5) // EOF 4810 MockRead(ASYNC, 0, 5) // EOF
4811 }; 4811 };
4812 4812
4813 MockWrite writes_SPDYNOSSL[] = { 4813 MockWrite writes_SPDYNOSSL[] = {
4814 CreateMockWrite(*req2, 0), 4814 CreateMockWrite(*req2, 0),
4815 }; 4815 };
4816 MockRead reads_SPDYNOSSL[] = { 4816 MockRead reads_SPDYNOSSL[] = {
4817 CreateMockRead(*resp2, 1), 4817 CreateMockRead(*resp2, 1),
4818 CreateMockRead(*body2, 2), 4818 CreateMockRead(*body2, 2),
4819 MockRead(true, 0, 3) // EOF 4819 MockRead(ASYNC, 0, 3) // EOF
4820 }; 4820 };
4821 4821
4822 MockWrite writes_SPDYSSL[] = { 4822 MockWrite writes_SPDYSSL[] = {
4823 MockWrite(false, kConnect80, arraysize(kConnect80) - 1, 0), 4823 MockWrite(SYNCHRONOUS, kConnect80, arraysize(kConnect80) - 1, 0),
4824 CreateMockWrite(*req2, 2), 4824 CreateMockWrite(*req2, 2),
4825 }; 4825 };
4826 MockRead reads_SPDYSSL[] = { 4826 MockRead reads_SPDYSSL[] = {
4827 MockRead(false, kHTTP200, arraysize(kHTTP200) - 1, 1), 4827 MockRead(SYNCHRONOUS, kHTTP200, arraysize(kHTTP200) - 1, 1),
4828 CreateMockRead(*resp2, 3), 4828 CreateMockRead(*resp2, 3),
4829 CreateMockRead(*body2, 4), 4829 CreateMockRead(*body2, 4),
4830 MockRead(true, 0, 0, 5), 4830 MockRead(ASYNC, 0, 0, 5),
4831 }; 4831 };
4832 4832
4833 scoped_ptr<OrderedSocketData> data_proxy; 4833 scoped_ptr<OrderedSocketData> data_proxy;
4834 switch(GetParam()) { 4834 switch(GetParam()) {
4835 case SPDYNPN: 4835 case SPDYNPN:
4836 data_proxy.reset(new OrderedSocketData(reads_SPDYNPN, 4836 data_proxy.reset(new OrderedSocketData(reads_SPDYNPN,
4837 arraysize(reads_SPDYNPN), 4837 arraysize(reads_SPDYNPN),
4838 writes_SPDYNPN, 4838 writes_SPDYNPN,
4839 arraysize(writes_SPDYNPN))); 4839 arraysize(writes_SPDYNPN)));
4840 break; 4840 break;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4897 // When we get a TCP-level RST, we need to retry a HttpNetworkTransaction 4897 // When we get a TCP-level RST, we need to retry a HttpNetworkTransaction
4898 // on a new connection, if the connection was previously known to be good. 4898 // on a new connection, if the connection was previously known to be good.
4899 // This can happen when a server reboots without saying goodbye, or when 4899 // This can happen when a server reboots without saying goodbye, or when
4900 // we're behind a NAT that masked the RST. 4900 // we're behind a NAT that masked the RST.
4901 TEST_P(SpdyNetworkTransactionTest, VerifyRetryOnConnectionReset) { 4901 TEST_P(SpdyNetworkTransactionTest, VerifyRetryOnConnectionReset) {
4902 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4902 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4903 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 4903 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
4904 MockRead reads[] = { 4904 MockRead reads[] = {
4905 CreateMockRead(*resp), 4905 CreateMockRead(*resp),
4906 CreateMockRead(*body), 4906 CreateMockRead(*body),
4907 MockRead(true, ERR_IO_PENDING), 4907 MockRead(ASYNC, ERR_IO_PENDING),
4908 MockRead(true, ERR_CONNECTION_RESET), 4908 MockRead(ASYNC, ERR_CONNECTION_RESET),
4909 }; 4909 };
4910 4910
4911 MockRead reads2[] = { 4911 MockRead reads2[] = {
4912 CreateMockRead(*resp), 4912 CreateMockRead(*resp),
4913 CreateMockRead(*body), 4913 CreateMockRead(*body),
4914 MockRead(true, 0, 0) // EOF 4914 MockRead(ASYNC, 0, 0) // EOF
4915 }; 4915 };
4916 4916
4917 // This test has a couple of variants. 4917 // This test has a couple of variants.
4918 enum { 4918 enum {
4919 // Induce the RST while waiting for our transaction to send. 4919 // Induce the RST while waiting for our transaction to send.
4920 VARIANT_RST_DURING_SEND_COMPLETION, 4920 VARIANT_RST_DURING_SEND_COMPLETION,
4921 // Induce the RST while waiting for our transaction to read. 4921 // Induce the RST while waiting for our transaction to read.
4922 // In this case, the send completed - everything copied into the SNDBUF. 4922 // In this case, the send completed - everything copied into the SNDBUF.
4923 VARIANT_RST_DURING_READ_COMPLETION 4923 VARIANT_RST_DURING_READ_COMPLETION
4924 }; 4924 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4983 TEST_P(SpdyNetworkTransactionTest, SpdyOnOffToggle) { 4983 TEST_P(SpdyNetworkTransactionTest, SpdyOnOffToggle) {
4984 net::HttpStreamFactory::set_spdy_enabled(true); 4984 net::HttpStreamFactory::set_spdy_enabled(true);
4985 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 4985 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
4986 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; 4986 MockWrite spdy_writes[] = { CreateMockWrite(*req) };
4987 4987
4988 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); 4988 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
4989 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); 4989 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
4990 MockRead spdy_reads[] = { 4990 MockRead spdy_reads[] = {
4991 CreateMockRead(*resp), 4991 CreateMockRead(*resp),
4992 CreateMockRead(*body), 4992 CreateMockRead(*body),
4993 MockRead(true, 0, 0) // EOF 4993 MockRead(ASYNC, 0, 0) // EOF
4994 }; 4994 };
4995 4995
4996 scoped_ptr<DelayedSocketData> data( 4996 scoped_ptr<DelayedSocketData> data(
4997 new DelayedSocketData(1, 4997 new DelayedSocketData(1,
4998 spdy_reads, arraysize(spdy_reads), 4998 spdy_reads, arraysize(spdy_reads),
4999 spdy_writes, arraysize(spdy_writes))); 4999 spdy_writes, arraysize(spdy_writes)));
5000 NormalSpdyTransactionHelper helper(CreateGetRequest(), 5000 NormalSpdyTransactionHelper helper(CreateGetRequest(),
5001 BoundNetLog(), GetParam()); 5001 BoundNetLog(), GetParam());
5002 helper.RunToCompletion(data.get()); 5002 helper.RunToCompletion(data.get());
5003 TransactionHelperResult out = helper.output(); 5003 TransactionHelperResult out = helper.output();
5004 EXPECT_EQ(OK, out.rv); 5004 EXPECT_EQ(OK, out.rv);
5005 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); 5005 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line);
5006 EXPECT_EQ("hello!", out.response_data); 5006 EXPECT_EQ("hello!", out.response_data);
5007 5007
5008 net::HttpStreamFactory::set_spdy_enabled(false); 5008 net::HttpStreamFactory::set_spdy_enabled(false);
5009 MockRead http_reads[] = { 5009 MockRead http_reads[] = {
5010 MockRead("HTTP/1.1 200 OK\r\n\r\n"), 5010 MockRead("HTTP/1.1 200 OK\r\n\r\n"),
5011 MockRead("hello from http"), 5011 MockRead("hello from http"),
5012 MockRead(false, OK), 5012 MockRead(SYNCHRONOUS, OK),
5013 }; 5013 };
5014 scoped_ptr<DelayedSocketData> data2( 5014 scoped_ptr<DelayedSocketData> data2(
5015 new DelayedSocketData(1, http_reads, arraysize(http_reads), 5015 new DelayedSocketData(1, http_reads, arraysize(http_reads),
5016 NULL, 0)); 5016 NULL, 0));
5017 NormalSpdyTransactionHelper helper2(CreateGetRequest(), 5017 NormalSpdyTransactionHelper helper2(CreateGetRequest(),
5018 BoundNetLog(), GetParam()); 5018 BoundNetLog(), GetParam());
5019 helper2.SetSpdyDisabled(); 5019 helper2.SetSpdyDisabled();
5020 helper2.RunToCompletion(data2.get()); 5020 helper2.RunToCompletion(data2.get());
5021 TransactionHelperResult out2 = helper2.output(); 5021 TransactionHelperResult out2 = helper2.output();
5022 EXPECT_EQ(OK, out2.rv); 5022 EXPECT_EQ(OK, out2.rv);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5063 1)); 5063 1));
5064 scoped_ptr<spdy::SpdyFrame> body_authentication( 5064 scoped_ptr<spdy::SpdyFrame> body_authentication(
5065 ConstructSpdyBodyFrame(1, true)); 5065 ConstructSpdyBodyFrame(1, true));
5066 scoped_ptr<spdy::SpdyFrame> resp_data(ConstructSpdyGetSynReply(NULL, 0, 3)); 5066 scoped_ptr<spdy::SpdyFrame> resp_data(ConstructSpdyGetSynReply(NULL, 0, 3));
5067 scoped_ptr<spdy::SpdyFrame> body_data(ConstructSpdyBodyFrame(3, true)); 5067 scoped_ptr<spdy::SpdyFrame> body_data(ConstructSpdyBodyFrame(3, true));
5068 MockRead spdy_reads[] = { 5068 MockRead spdy_reads[] = {
5069 CreateMockRead(*resp_authentication, 2), 5069 CreateMockRead(*resp_authentication, 2),
5070 CreateMockRead(*body_authentication, 3), 5070 CreateMockRead(*body_authentication, 3),
5071 CreateMockRead(*resp_data, 5), 5071 CreateMockRead(*resp_data, 5),
5072 CreateMockRead(*body_data, 6), 5072 CreateMockRead(*body_data, 6),
5073 MockRead(true, 0, 7), 5073 MockRead(ASYNC, 0, 7),
5074 }; 5074 };
5075 5075
5076 scoped_ptr<OrderedSocketData> data( 5076 scoped_ptr<OrderedSocketData> data(
5077 new OrderedSocketData(spdy_reads, arraysize(spdy_reads), 5077 new OrderedSocketData(spdy_reads, arraysize(spdy_reads),
5078 spdy_writes, arraysize(spdy_writes))); 5078 spdy_writes, arraysize(spdy_writes)));
5079 HttpRequestInfo request(CreateGetRequest()); 5079 HttpRequestInfo request(CreateGetRequest());
5080 BoundNetLog net_log; 5080 BoundNetLog net_log;
5081 NormalSpdyTransactionHelper helper(request, net_log, GetParam()); 5081 NormalSpdyTransactionHelper helper(request, net_log, GetParam());
5082 5082
5083 helper.RunPreTestSetup(); 5083 helper.RunPreTestSetup();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
5166 NULL, 5166 NULL,
5167 0, 5167 0,
5168 0)); 5168 0));
5169 5169
5170 scoped_ptr<spdy::SpdyFrame> 5170 scoped_ptr<spdy::SpdyFrame>
5171 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 5171 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
5172 MockRead reads[] = { 5172 MockRead reads[] = {
5173 CreateMockRead(*stream1_reply, 2), 5173 CreateMockRead(*stream1_reply, 2),
5174 CreateMockRead(*stream2_syn, 3), 5174 CreateMockRead(*stream2_syn, 3),
5175 CreateMockRead(*stream2_headers, 4), 5175 CreateMockRead(*stream2_headers, 4),
5176 CreateMockRead(*stream1_body, 5, false), 5176 CreateMockRead(*stream1_body, 5, SYNCHRONOUS),
5177 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 5177 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
5178 arraysize(kPushBodyFrame), 6), 5178 arraysize(kPushBodyFrame), 6),
5179 MockRead(true, ERR_IO_PENDING, 7), // Force a pause 5179 MockRead(ASYNC, ERR_IO_PENDING, 7), // Force a pause
5180 }; 5180 };
5181 5181
5182 HttpResponseInfo response; 5182 HttpResponseInfo response;
5183 HttpResponseInfo response2; 5183 HttpResponseInfo response2;
5184 std::string expected_push_result("pushed"); 5184 std::string expected_push_result("pushed");
5185 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 5185 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
5186 reads, 5186 reads,
5187 arraysize(reads), 5187 arraysize(reads),
5188 writes, 5188 writes,
5189 arraysize(writes))); 5189 arraysize(writes)));
(...skipping 16 matching lines...) Expand all
5206 static const unsigned char kPushBodyFrame[] = { 5206 static const unsigned char kPushBodyFrame[] = {
5207 0x00, 0x00, 0x00, 0x02, // header, ID 5207 0x00, 0x00, 0x00, 0x02, // header, ID
5208 0x01, 0x00, 0x00, 0x06, // FIN, length 5208 0x01, 0x00, 0x00, 0x06, // FIN, length
5209 'p', 'u', 's', 'h', 'e', 'd' // "pushed" 5209 'p', 'u', 's', 'h', 'e', 'd' // "pushed"
5210 }; 5210 };
5211 scoped_ptr<spdy::SpdyFrame> 5211 scoped_ptr<spdy::SpdyFrame>
5212 stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 5212 stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
5213 scoped_ptr<spdy::SpdyFrame> 5213 scoped_ptr<spdy::SpdyFrame>
5214 stream1_body(ConstructSpdyBodyFrame(1, true)); 5214 stream1_body(ConstructSpdyBodyFrame(1, true));
5215 MockWrite writes[] = { 5215 MockWrite writes[] = {
5216 CreateMockWrite(*stream1_syn, 0, false), 5216 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS),
5217 }; 5217 };
5218 5218
5219 static const char* const kInitialHeaders[] = { 5219 static const char* const kInitialHeaders[] = {
5220 "url", 5220 "url",
5221 "http://www.google.com/foo.dat", 5221 "http://www.google.com/foo.dat",
5222 }; 5222 };
5223 static const char* const kLateHeaders[] = { 5223 static const char* const kLateHeaders[] = {
5224 "hello", 5224 "hello",
5225 "bye", 5225 "bye",
5226 "status", 5226 "status",
(...skipping 24 matching lines...) Expand all
5251 0, 5251 0,
5252 0)); 5252 0));
5253 5253
5254 scoped_ptr<spdy::SpdyFrame> 5254 scoped_ptr<spdy::SpdyFrame>
5255 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 5255 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
5256 MockRead reads[] = { 5256 MockRead reads[] = {
5257 CreateMockRead(*stream1_reply, 1), 5257 CreateMockRead(*stream1_reply, 1),
5258 CreateMockRead(*stream2_syn, 2), 5258 CreateMockRead(*stream2_syn, 2),
5259 CreateMockRead(*stream1_body, 3), 5259 CreateMockRead(*stream1_body, 3),
5260 CreateMockRead(*stream2_headers, 4), 5260 CreateMockRead(*stream2_headers, 4),
5261 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 5261 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
5262 arraysize(kPushBodyFrame), 5), 5262 arraysize(kPushBodyFrame), 5),
5263 MockRead(true, 0, 5), // EOF 5263 MockRead(ASYNC, 0, 5), // EOF
5264 }; 5264 };
5265 5265
5266 HttpResponseInfo response; 5266 HttpResponseInfo response;
5267 HttpResponseInfo response2; 5267 HttpResponseInfo response2;
5268 std::string expected_push_result("pushed"); 5268 std::string expected_push_result("pushed");
5269 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData( 5269 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData(
5270 reads, 5270 reads,
5271 arraysize(reads), 5271 arraysize(reads),
5272 writes, 5272 writes,
5273 arraysize(writes))); 5273 arraysize(writes)));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5343 static const unsigned char kPushBodyFrame[] = { 5343 static const unsigned char kPushBodyFrame[] = {
5344 0x00, 0x00, 0x00, 0x02, // header, ID 5344 0x00, 0x00, 0x00, 0x02, // header, ID
5345 0x01, 0x00, 0x00, 0x06, // FIN, length 5345 0x01, 0x00, 0x00, 0x06, // FIN, length
5346 'p', 'u', 's', 'h', 'e', 'd' // "pushed" 5346 'p', 'u', 's', 'h', 'e', 'd' // "pushed"
5347 }; 5347 };
5348 scoped_ptr<spdy::SpdyFrame> 5348 scoped_ptr<spdy::SpdyFrame>
5349 stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); 5349 stream1_syn(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
5350 scoped_ptr<spdy::SpdyFrame> 5350 scoped_ptr<spdy::SpdyFrame>
5351 stream1_body(ConstructSpdyBodyFrame(1, true)); 5351 stream1_body(ConstructSpdyBodyFrame(1, true));
5352 MockWrite writes[] = { 5352 MockWrite writes[] = {
5353 CreateMockWrite(*stream1_syn, 0, false), 5353 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS),
5354 }; 5354 };
5355 5355
5356 static const char* const kInitialHeaders[] = { 5356 static const char* const kInitialHeaders[] = {
5357 "url", 5357 "url",
5358 "http://www.google.com/foo.dat", 5358 "http://www.google.com/foo.dat",
5359 }; 5359 };
5360 static const char* const kMiddleHeaders[] = { 5360 static const char* const kMiddleHeaders[] = {
5361 "hello", 5361 "hello",
5362 "bye", 5362 "bye",
5363 }; 5363 };
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5402 0)); 5402 0));
5403 5403
5404 scoped_ptr<spdy::SpdyFrame> 5404 scoped_ptr<spdy::SpdyFrame>
5405 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1)); 5405 stream1_reply(ConstructSpdyGetSynReply(NULL, 0, 1));
5406 MockRead reads[] = { 5406 MockRead reads[] = {
5407 CreateMockRead(*stream1_reply, 1), 5407 CreateMockRead(*stream1_reply, 1),
5408 CreateMockRead(*stream2_syn, 2), 5408 CreateMockRead(*stream2_syn, 2),
5409 CreateMockRead(*stream1_body, 3), 5409 CreateMockRead(*stream1_body, 3),
5410 CreateMockRead(*stream2_headers1, 4), 5410 CreateMockRead(*stream2_headers1, 4),
5411 CreateMockRead(*stream2_headers2, 5), 5411 CreateMockRead(*stream2_headers2, 5),
5412 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 5412 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
5413 arraysize(kPushBodyFrame), 6), 5413 arraysize(kPushBodyFrame), 6),
5414 MockRead(true, 0, 6), // EOF 5414 MockRead(ASYNC, 0, 6), // EOF
5415 }; 5415 };
5416 5416
5417 HttpResponseInfo response; 5417 HttpResponseInfo response;
5418 HttpResponseInfo response2; 5418 HttpResponseInfo response2;
5419 std::string expected_push_result("pushed"); 5419 std::string expected_push_result("pushed");
5420 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData( 5420 scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData(
5421 reads, 5421 reads,
5422 arraysize(reads), 5422 arraysize(reads),
5423 writes, 5423 writes,
5424 arraysize(writes))); 5424 arraysize(writes)));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5531 spdy::HEADERS, 5531 spdy::HEADERS,
5532 spdy::CONTROL_FLAG_NONE, 5532 spdy::CONTROL_FLAG_NONE,
5533 NULL, 5533 NULL,
5534 0, 5534 0,
5535 0)); 5535 0));
5536 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true)); 5536 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, true));
5537 MockRead reads[] = { 5537 MockRead reads[] = {
5538 CreateMockRead(*stream1_reply), 5538 CreateMockRead(*stream1_reply),
5539 CreateMockRead(*stream1_headers), 5539 CreateMockRead(*stream1_headers),
5540 CreateMockRead(*stream1_body), 5540 CreateMockRead(*stream1_body),
5541 MockRead(true, 0, 0) // EOF 5541 MockRead(ASYNC, 0, 0) // EOF
5542 }; 5542 };
5543 5543
5544 scoped_ptr<DelayedSocketData> data( 5544 scoped_ptr<DelayedSocketData> data(
5545 new DelayedSocketData(1, reads, arraysize(reads), 5545 new DelayedSocketData(1, reads, arraysize(reads),
5546 writes, arraysize(writes))); 5546 writes, arraysize(writes)));
5547 NormalSpdyTransactionHelper helper(CreateGetRequest(), 5547 NormalSpdyTransactionHelper helper(CreateGetRequest(),
5548 BoundNetLog(), GetParam()); 5548 BoundNetLog(), GetParam());
5549 helper.RunToCompletion(data.get()); 5549 helper.RunToCompletion(data.get());
5550 TransactionHelperResult out = helper.output(); 5550 TransactionHelperResult out = helper.output();
5551 EXPECT_EQ(OK, out.rv); 5551 EXPECT_EQ(OK, out.rv);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5589 NULL, 5589 NULL,
5590 0, 5590 0,
5591 0)); 5591 0));
5592 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, false)); 5592 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, false));
5593 scoped_ptr<spdy::SpdyFrame> stream1_body2(ConstructSpdyBodyFrame(1, true)); 5593 scoped_ptr<spdy::SpdyFrame> stream1_body2(ConstructSpdyBodyFrame(1, true));
5594 MockRead reads[] = { 5594 MockRead reads[] = {
5595 CreateMockRead(*stream1_reply), 5595 CreateMockRead(*stream1_reply),
5596 CreateMockRead(*stream1_body), 5596 CreateMockRead(*stream1_body),
5597 CreateMockRead(*stream1_headers), 5597 CreateMockRead(*stream1_headers),
5598 CreateMockRead(*stream1_body2), 5598 CreateMockRead(*stream1_body2),
5599 MockRead(true, 0, 0) // EOF 5599 MockRead(ASYNC, 0, 0) // EOF
5600 }; 5600 };
5601 5601
5602 scoped_ptr<DelayedSocketData> data( 5602 scoped_ptr<DelayedSocketData> data(
5603 new DelayedSocketData(1, reads, arraysize(reads), 5603 new DelayedSocketData(1, reads, arraysize(reads),
5604 writes, arraysize(writes))); 5604 writes, arraysize(writes)));
5605 NormalSpdyTransactionHelper helper(CreateGetRequest(), 5605 NormalSpdyTransactionHelper helper(CreateGetRequest(),
5606 BoundNetLog(), GetParam()); 5606 BoundNetLog(), GetParam());
5607 helper.RunToCompletion(data.get()); 5607 helper.RunToCompletion(data.get());
5608 TransactionHelperResult out = helper.output(); 5608 TransactionHelperResult out = helper.output();
5609 EXPECT_EQ(OK, out.rv); 5609 EXPECT_EQ(OK, out.rv);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5647 NULL, 5647 NULL,
5648 0, 5648 0,
5649 0)); 5649 0));
5650 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, false)); 5650 scoped_ptr<spdy::SpdyFrame> stream1_body(ConstructSpdyBodyFrame(1, false));
5651 scoped_ptr<spdy::SpdyFrame> stream1_body2(ConstructSpdyBodyFrame(1, true)); 5651 scoped_ptr<spdy::SpdyFrame> stream1_body2(ConstructSpdyBodyFrame(1, true));
5652 MockRead reads[] = { 5652 MockRead reads[] = {
5653 CreateMockRead(*stream1_reply), 5653 CreateMockRead(*stream1_reply),
5654 CreateMockRead(*stream1_body), 5654 CreateMockRead(*stream1_body),
5655 CreateMockRead(*stream1_headers), 5655 CreateMockRead(*stream1_headers),
5656 CreateMockRead(*stream1_body2), 5656 CreateMockRead(*stream1_body2),
5657 MockRead(true, 0, 0) // EOF 5657 MockRead(ASYNC, 0, 0) // EOF
5658 }; 5658 };
5659 5659
5660 scoped_ptr<DelayedSocketData> data( 5660 scoped_ptr<DelayedSocketData> data(
5661 new DelayedSocketData(1, reads, arraysize(reads), 5661 new DelayedSocketData(1, reads, arraysize(reads),
5662 writes, arraysize(writes))); 5662 writes, arraysize(writes)));
5663 NormalSpdyTransactionHelper helper(CreateGetRequest(), 5663 NormalSpdyTransactionHelper helper(CreateGetRequest(),
5664 BoundNetLog(), GetParam()); 5664 BoundNetLog(), GetParam());
5665 helper.RunToCompletion(data.get()); 5665 helper.RunToCompletion(data.get());
5666 TransactionHelperResult out = helper.output(); 5666 TransactionHelperResult out = helper.output();
5667 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); 5667 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5721 0, 5721 0,
5722 2, 5722 2,
5723 1, 5723 1,
5724 url_to_push)); 5724 url_to_push));
5725 scoped_ptr<spdy::SpdyFrame> rst( 5725 scoped_ptr<spdy::SpdyFrame> rst(
5726 ConstructSpdyRstStream(2, spdy::CANCEL)); 5726 ConstructSpdyRstStream(2, spdy::CANCEL));
5727 5727
5728 MockRead reads[] = { 5728 MockRead reads[] = {
5729 CreateMockRead(*stream1_reply, 2), 5729 CreateMockRead(*stream1_reply, 2),
5730 CreateMockRead(*stream2_syn, 3), 5730 CreateMockRead(*stream2_syn, 3),
5731 CreateMockRead(*stream1_body, 5, false), 5731 CreateMockRead(*stream1_body, 5, SYNCHRONOUS),
5732 MockRead(true, reinterpret_cast<const char*>(kPushBodyFrame), 5732 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame),
5733 arraysize(kPushBodyFrame), 6), 5733 arraysize(kPushBodyFrame), 6),
5734 MockRead(true, ERR_IO_PENDING, 7), // Force a pause 5734 MockRead(ASYNC, ERR_IO_PENDING, 7), // Force a pause
5735 }; 5735 };
5736 5736
5737 HttpResponseInfo response; 5737 HttpResponseInfo response;
5738 scoped_ptr<OrderedSocketData> data(new OrderedSocketData( 5738 scoped_ptr<OrderedSocketData> data(new OrderedSocketData(
5739 reads, 5739 reads,
5740 arraysize(reads), 5740 arraysize(reads),
5741 writes, 5741 writes,
5742 arraysize(writes))); 5742 arraysize(writes)));
5743 5743
5744 HttpRequestInfo request; 5744 HttpRequestInfo request;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
5789 }; 5789 };
5790 5790
5791 scoped_ptr<spdy::SpdyFrame> refused( 5791 scoped_ptr<spdy::SpdyFrame> refused(
5792 ConstructSpdyRstStream(1, spdy::REFUSED_STREAM)); 5792 ConstructSpdyRstStream(1, spdy::REFUSED_STREAM));
5793 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 3)); 5793 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 3));
5794 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(3, true)); 5794 scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(3, true));
5795 MockRead reads[] = { 5795 MockRead reads[] = {
5796 CreateMockRead(*refused, 2), 5796 CreateMockRead(*refused, 2),
5797 CreateMockRead(*resp, 4), 5797 CreateMockRead(*resp, 4),
5798 CreateMockRead(*body, 5), 5798 CreateMockRead(*body, 5),
5799 MockRead(true, 0, 6) // EOF 5799 MockRead(ASYNC, 0, 6) // EOF
5800 }; 5800 };
5801 5801
5802 scoped_ptr<OrderedSocketData> data( 5802 scoped_ptr<OrderedSocketData> data(
5803 new OrderedSocketData(reads, arraysize(reads), 5803 new OrderedSocketData(reads, arraysize(reads),
5804 writes, arraysize(writes))); 5804 writes, arraysize(writes)));
5805 NormalSpdyTransactionHelper helper(CreateGetRequest(), 5805 NormalSpdyTransactionHelper helper(CreateGetRequest(),
5806 BoundNetLog(), GetParam()); 5806 BoundNetLog(), GetParam());
5807 5807
5808 helper.RunPreTestSetup(); 5808 helper.RunPreTestSetup();
5809 helper.AddData(data.get()); 5809 helper.AddData(data.get());
(...skipping 18 matching lines...) Expand all
5828 << " Write index: " 5828 << " Write index: "
5829 << data->write_index(); 5829 << data->write_index();
5830 5830
5831 // Verify the SYN_REPLY. 5831 // Verify the SYN_REPLY.
5832 HttpResponseInfo response = *trans->GetResponseInfo(); 5832 HttpResponseInfo response = *trans->GetResponseInfo();
5833 EXPECT_TRUE(response.headers != NULL); 5833 EXPECT_TRUE(response.headers != NULL);
5834 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); 5834 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine());
5835 } 5835 }
5836 5836
5837 } // namespace net 5837 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698