| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <cmath> | 5 #include <cmath> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 void FinishDefaultTest() { | 239 void FinishDefaultTest() { |
| 240 output_.rv = callback_.WaitForResult(); | 240 output_.rv = callback_.WaitForResult(); |
| 241 if (output_.rv != OK) { | 241 if (output_.rv != OK) { |
| 242 session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); | 242 session_->spdy_session_pool()->CloseCurrentSessions(ERR_ABORTED); |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Verify responses. | 246 // Verify responses. |
| 247 const HttpResponseInfo* response = trans_->GetResponseInfo(); | 247 const HttpResponseInfo* response = trans_->GetResponseInfo(); |
| 248 ASSERT_TRUE(response != NULL); | 248 ASSERT_TRUE(response); |
| 249 ASSERT_TRUE(response->headers.get() != NULL); | 249 ASSERT_TRUE(response->headers); |
| 250 if (HttpStreamFactory::spdy_enabled()) { | 250 if (HttpStreamFactory::spdy_enabled()) { |
| 251 EXPECT_EQ( | 251 EXPECT_EQ( |
| 252 HttpResponseInfo::ConnectionInfoFromNextProto( | 252 HttpResponseInfo::ConnectionInfoFromNextProto( |
| 253 test_params_.protocol), | 253 test_params_.protocol), |
| 254 response->connection_info); | 254 response->connection_info); |
| 255 } else { | 255 } else { |
| 256 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, | 256 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, |
| 257 response->connection_info); | 257 response->connection_info); |
| 258 } | 258 } |
| 259 if (spdy_enabled_) { | 259 if (spdy_enabled_) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // session. Once we have the session, we verify that the streams are | 557 // session. Once we have the session, we verify that the streams are |
| 558 // all closed and not leaked at this point. | 558 // all closed and not leaked at this point. |
| 559 const GURL& url = helper.request().url; | 559 const GURL& url = helper.request().url; |
| 560 HostPortPair host_port_pair(url.host(), 443); | 560 HostPortPair host_port_pair(url.host(), 443); |
| 561 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 561 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 562 PRIVACY_MODE_DISABLED); | 562 PRIVACY_MODE_DISABLED); |
| 563 BoundNetLog log; | 563 BoundNetLog log; |
| 564 HttpNetworkSession* session = helper.session(); | 564 HttpNetworkSession* session = helper.session(); |
| 565 base::WeakPtr<SpdySession> spdy_session = | 565 base::WeakPtr<SpdySession> spdy_session = |
| 566 session->spdy_session_pool()->FindAvailableSession(key, url, log); | 566 session->spdy_session_pool()->FindAvailableSession(key, url, log); |
| 567 ASSERT_TRUE(spdy_session != NULL); | 567 ASSERT_TRUE(spdy_session); |
| 568 EXPECT_EQ(0u, spdy_session->num_active_streams()); | 568 EXPECT_EQ(0u, spdy_session->num_active_streams()); |
| 569 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); | 569 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void RunServerPushTest(SequencedSocketData* data, | 572 void RunServerPushTest(SequencedSocketData* data, |
| 573 HttpResponseInfo* response, | 573 HttpResponseInfo* response, |
| 574 HttpResponseInfo* push_response, | 574 HttpResponseInfo* push_response, |
| 575 const std::string& expected) { | 575 const std::string& expected) { |
| 576 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 576 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 577 BoundNetLog(), GetParam(), NULL); | 577 BoundNetLog(), GetParam(), NULL); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 906 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 907 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); | 907 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); |
| 908 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 908 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 909 | 909 |
| 910 out.rv = callback1.WaitForResult(); | 910 out.rv = callback1.WaitForResult(); |
| 911 ASSERT_EQ(OK, out.rv); | 911 ASSERT_EQ(OK, out.rv); |
| 912 out.rv = callback3.WaitForResult(); | 912 out.rv = callback3.WaitForResult(); |
| 913 ASSERT_EQ(OK, out.rv); | 913 ASSERT_EQ(OK, out.rv); |
| 914 | 914 |
| 915 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); | 915 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); |
| 916 EXPECT_TRUE(response1->headers.get() != NULL); | 916 EXPECT_TRUE(response1->headers); |
| 917 EXPECT_TRUE(response1->was_fetched_via_spdy); | 917 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 918 out.status_line = response1->headers->GetStatusLine(); | 918 out.status_line = response1->headers->GetStatusLine(); |
| 919 out.response_info = *response1; | 919 out.response_info = *response1; |
| 920 | 920 |
| 921 trans2->GetResponseInfo(); | 921 trans2->GetResponseInfo(); |
| 922 | 922 |
| 923 out.rv = ReadTransaction(trans1.get(), &out.response_data); | 923 out.rv = ReadTransaction(trans1.get(), &out.response_data); |
| 924 helper.VerifyDataConsumed(); | 924 helper.VerifyDataConsumed(); |
| 925 EXPECT_EQ(OK, out.rv); | 925 EXPECT_EQ(OK, out.rv); |
| 926 | 926 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 991 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 992 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); | 992 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); |
| 993 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 993 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 994 | 994 |
| 995 out.rv = callback1.WaitForResult(); | 995 out.rv = callback1.WaitForResult(); |
| 996 ASSERT_EQ(OK, out.rv); | 996 ASSERT_EQ(OK, out.rv); |
| 997 out.rv = callback2.WaitForResult(); | 997 out.rv = callback2.WaitForResult(); |
| 998 ASSERT_EQ(OK, out.rv); | 998 ASSERT_EQ(OK, out.rv); |
| 999 | 999 |
| 1000 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); | 1000 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); |
| 1001 EXPECT_TRUE(response1->headers.get() != NULL); | 1001 EXPECT_TRUE(response1->headers); |
| 1002 EXPECT_TRUE(response1->was_fetched_via_spdy); | 1002 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 1003 out.status_line = response1->headers->GetStatusLine(); | 1003 out.status_line = response1->headers->GetStatusLine(); |
| 1004 out.response_info = *response1; | 1004 out.response_info = *response1; |
| 1005 out.rv = ReadTransaction(trans1.get(), &out.response_data); | 1005 out.rv = ReadTransaction(trans1.get(), &out.response_data); |
| 1006 EXPECT_EQ(OK, out.rv); | 1006 EXPECT_EQ(OK, out.rv); |
| 1007 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1007 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1008 EXPECT_EQ("hello!hello!", out.response_data); | 1008 EXPECT_EQ("hello!hello!", out.response_data); |
| 1009 | 1009 |
| 1010 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); | 1010 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); |
| 1011 EXPECT_TRUE(response2->headers.get() != NULL); | 1011 EXPECT_TRUE(response2->headers); |
| 1012 EXPECT_TRUE(response2->was_fetched_via_spdy); | 1012 EXPECT_TRUE(response2->was_fetched_via_spdy); |
| 1013 out.status_line = response2->headers->GetStatusLine(); | 1013 out.status_line = response2->headers->GetStatusLine(); |
| 1014 out.response_info = *response2; | 1014 out.response_info = *response2; |
| 1015 out.rv = ReadTransaction(trans2.get(), &out.response_data); | 1015 out.rv = ReadTransaction(trans2.get(), &out.response_data); |
| 1016 EXPECT_EQ(OK, out.rv); | 1016 EXPECT_EQ(OK, out.rv); |
| 1017 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1017 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1018 EXPECT_EQ("hello!hello!", out.response_data); | 1018 EXPECT_EQ("hello!hello!", out.response_data); |
| 1019 | 1019 |
| 1020 helper.VerifyDataConsumed(); | 1020 helper.VerifyDataConsumed(); |
| 1021 } | 1021 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 1090 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 1091 out.rv = trans2->Start(&httpreq, callback2.callback(), log); | 1091 out.rv = trans2->Start(&httpreq, callback2.callback(), log); |
| 1092 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 1092 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 1093 | 1093 |
| 1094 out.rv = callback1.WaitForResult(); | 1094 out.rv = callback1.WaitForResult(); |
| 1095 ASSERT_EQ(OK, out.rv); | 1095 ASSERT_EQ(OK, out.rv); |
| 1096 out.rv = callback2.WaitForResult(); | 1096 out.rv = callback2.WaitForResult(); |
| 1097 ASSERT_EQ(OK, out.rv); | 1097 ASSERT_EQ(OK, out.rv); |
| 1098 | 1098 |
| 1099 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); | 1099 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); |
| 1100 EXPECT_TRUE(response1->headers.get() != NULL); | 1100 EXPECT_TRUE(response1->headers); |
| 1101 EXPECT_TRUE(response1->was_fetched_via_spdy); | 1101 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 1102 out.status_line = response1->headers->GetStatusLine(); | 1102 out.status_line = response1->headers->GetStatusLine(); |
| 1103 out.response_info = *response1; | 1103 out.response_info = *response1; |
| 1104 out.rv = ReadTransaction(trans1.get(), &out.response_data); | 1104 out.rv = ReadTransaction(trans1.get(), &out.response_data); |
| 1105 EXPECT_EQ(OK, out.rv); | 1105 EXPECT_EQ(OK, out.rv); |
| 1106 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1106 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1107 EXPECT_EQ("hello!hello!", out.response_data); | 1107 EXPECT_EQ("hello!hello!", out.response_data); |
| 1108 | 1108 |
| 1109 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); | 1109 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); |
| 1110 EXPECT_TRUE(response2->headers.get() != NULL); | 1110 EXPECT_TRUE(response2->headers); |
| 1111 EXPECT_TRUE(response2->was_fetched_via_spdy); | 1111 EXPECT_TRUE(response2->was_fetched_via_spdy); |
| 1112 out.status_line = response2->headers->GetStatusLine(); | 1112 out.status_line = response2->headers->GetStatusLine(); |
| 1113 out.response_info = *response2; | 1113 out.response_info = *response2; |
| 1114 out.rv = ReadTransaction(trans2.get(), &out.response_data); | 1114 out.rv = ReadTransaction(trans2.get(), &out.response_data); |
| 1115 EXPECT_EQ(OK, out.rv); | 1115 EXPECT_EQ(OK, out.rv); |
| 1116 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1116 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1117 EXPECT_EQ("hello!hello!", out.response_data); | 1117 EXPECT_EQ("hello!hello!", out.response_data); |
| 1118 | 1118 |
| 1119 helper.VerifyDataConsumed(); | 1119 helper.VerifyDataConsumed(); |
| 1120 } | 1120 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 ASSERT_EQ(out.rv, ERR_IO_PENDING); | 1222 ASSERT_EQ(out.rv, ERR_IO_PENDING); |
| 1223 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); | 1223 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); |
| 1224 ASSERT_EQ(out.rv, ERR_IO_PENDING); | 1224 ASSERT_EQ(out.rv, ERR_IO_PENDING); |
| 1225 out.rv = callback2.WaitForResult(); | 1225 out.rv = callback2.WaitForResult(); |
| 1226 ASSERT_EQ(OK, out.rv); | 1226 ASSERT_EQ(OK, out.rv); |
| 1227 | 1227 |
| 1228 out.rv = callback3.WaitForResult(); | 1228 out.rv = callback3.WaitForResult(); |
| 1229 ASSERT_EQ(OK, out.rv); | 1229 ASSERT_EQ(OK, out.rv); |
| 1230 | 1230 |
| 1231 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); | 1231 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); |
| 1232 ASSERT_TRUE(response1 != NULL); | 1232 ASSERT_TRUE(response1); |
| 1233 EXPECT_TRUE(response1->headers.get() != NULL); | 1233 EXPECT_TRUE(response1->headers); |
| 1234 EXPECT_TRUE(response1->was_fetched_via_spdy); | 1234 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 1235 out.status_line = response1->headers->GetStatusLine(); | 1235 out.status_line = response1->headers->GetStatusLine(); |
| 1236 out.response_info = *response1; | 1236 out.response_info = *response1; |
| 1237 out.rv = ReadTransaction(trans1.get(), &out.response_data); | 1237 out.rv = ReadTransaction(trans1.get(), &out.response_data); |
| 1238 EXPECT_EQ(OK, out.rv); | 1238 EXPECT_EQ(OK, out.rv); |
| 1239 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1239 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1240 EXPECT_EQ("hello!hello!", out.response_data); | 1240 EXPECT_EQ("hello!hello!", out.response_data); |
| 1241 | 1241 |
| 1242 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); | 1242 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); |
| 1243 out.status_line = response2->headers->GetStatusLine(); | 1243 out.status_line = response2->headers->GetStatusLine(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 out.rv = trans4->Start(&httpreq4, callback4.callback(), log); | 1378 out.rv = trans4->Start(&httpreq4, callback4.callback(), log); |
| 1379 ASSERT_EQ(ERR_IO_PENDING, out.rv); | 1379 ASSERT_EQ(ERR_IO_PENDING, out.rv); |
| 1380 | 1380 |
| 1381 out.rv = callback2.WaitForResult(); | 1381 out.rv = callback2.WaitForResult(); |
| 1382 ASSERT_EQ(OK, out.rv); | 1382 ASSERT_EQ(OK, out.rv); |
| 1383 | 1383 |
| 1384 out.rv = callback3.WaitForResult(); | 1384 out.rv = callback3.WaitForResult(); |
| 1385 ASSERT_EQ(OK, out.rv); | 1385 ASSERT_EQ(OK, out.rv); |
| 1386 | 1386 |
| 1387 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); | 1387 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); |
| 1388 EXPECT_TRUE(response1->headers.get() != NULL); | 1388 EXPECT_TRUE(response1->headers); |
| 1389 EXPECT_TRUE(response1->was_fetched_via_spdy); | 1389 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 1390 out.status_line = response1->headers->GetStatusLine(); | 1390 out.status_line = response1->headers->GetStatusLine(); |
| 1391 out.response_info = *response1; | 1391 out.response_info = *response1; |
| 1392 out.rv = ReadTransaction(trans1.get(), &out.response_data); | 1392 out.rv = ReadTransaction(trans1.get(), &out.response_data); |
| 1393 EXPECT_EQ(OK, out.rv); | 1393 EXPECT_EQ(OK, out.rv); |
| 1394 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1394 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1395 EXPECT_EQ("hello!hello!", out.response_data); | 1395 EXPECT_EQ("hello!hello!", out.response_data); |
| 1396 | 1396 |
| 1397 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); | 1397 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); |
| 1398 out.status_line = response2->headers->GetStatusLine(); | 1398 out.status_line = response2->headers->GetStatusLine(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 | 1506 |
| 1507 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); | 1507 out.rv = trans2->Start(&httpreq2, callback2.callback(), log); |
| 1508 ASSERT_EQ(out.rv, ERR_IO_PENDING); | 1508 ASSERT_EQ(out.rv, ERR_IO_PENDING); |
| 1509 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); | 1509 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); |
| 1510 trans3.reset(); | 1510 trans3.reset(); |
| 1511 ASSERT_EQ(out.rv, ERR_IO_PENDING); | 1511 ASSERT_EQ(out.rv, ERR_IO_PENDING); |
| 1512 out.rv = callback2.WaitForResult(); | 1512 out.rv = callback2.WaitForResult(); |
| 1513 ASSERT_EQ(OK, out.rv); | 1513 ASSERT_EQ(OK, out.rv); |
| 1514 | 1514 |
| 1515 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); | 1515 const HttpResponseInfo* response1 = trans1->GetResponseInfo(); |
| 1516 ASSERT_TRUE(response1 != NULL); | 1516 ASSERT_TRUE(response1); |
| 1517 EXPECT_TRUE(response1->headers.get() != NULL); | 1517 EXPECT_TRUE(response1->headers); |
| 1518 EXPECT_TRUE(response1->was_fetched_via_spdy); | 1518 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 1519 out.status_line = response1->headers->GetStatusLine(); | 1519 out.status_line = response1->headers->GetStatusLine(); |
| 1520 out.response_info = *response1; | 1520 out.response_info = *response1; |
| 1521 out.rv = ReadTransaction(trans1.get(), &out.response_data); | 1521 out.rv = ReadTransaction(trans1.get(), &out.response_data); |
| 1522 EXPECT_EQ(OK, out.rv); | 1522 EXPECT_EQ(OK, out.rv); |
| 1523 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1523 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1524 EXPECT_EQ("hello!hello!", out.response_data); | 1524 EXPECT_EQ("hello!hello!", out.response_data); |
| 1525 | 1525 |
| 1526 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); | 1526 const HttpResponseInfo* response2 = trans2->GetResponseInfo(); |
| 1527 ASSERT_TRUE(response2 != NULL); | 1527 ASSERT_TRUE(response2); |
| 1528 out.status_line = response2->headers->GetStatusLine(); | 1528 out.status_line = response2->headers->GetStatusLine(); |
| 1529 out.response_info = *response2; | 1529 out.response_info = *response2; |
| 1530 out.rv = ReadTransaction(trans2.get(), &out.response_data); | 1530 out.rv = ReadTransaction(trans2.get(), &out.response_data); |
| 1531 EXPECT_EQ(OK, out.rv); | 1531 EXPECT_EQ(OK, out.rv); |
| 1532 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 1532 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 1533 EXPECT_EQ("hello!hello!", out.response_data); | 1533 EXPECT_EQ("hello!hello!", out.response_data); |
| 1534 helper.VerifyDataConsumed(); | 1534 helper.VerifyDataConsumed(); |
| 1535 EXPECT_EQ(OK, out.rv); | 1535 EXPECT_EQ(OK, out.rv); |
| 1536 } | 1536 } |
| 1537 | 1537 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 ASSERT_EQ(OK, out.rv); | 1641 ASSERT_EQ(OK, out.rv); |
| 1642 | 1642 |
| 1643 out.rv = trans2.Start(&httpreq2, callback2.callback(), log); | 1643 out.rv = trans2.Start(&httpreq2, callback2.callback(), log); |
| 1644 ASSERT_EQ(out.rv, ERR_IO_PENDING); | 1644 ASSERT_EQ(out.rv, ERR_IO_PENDING); |
| 1645 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); | 1645 out.rv = trans3->Start(&httpreq3, callback3.callback(), log); |
| 1646 ASSERT_EQ(out.rv, ERR_IO_PENDING); | 1646 ASSERT_EQ(out.rv, ERR_IO_PENDING); |
| 1647 out.rv = callback3.WaitForResult(); | 1647 out.rv = callback3.WaitForResult(); |
| 1648 ASSERT_EQ(ERR_ABORTED, out.rv); | 1648 ASSERT_EQ(ERR_ABORTED, out.rv); |
| 1649 | 1649 |
| 1650 const HttpResponseInfo* response1 = trans1.GetResponseInfo(); | 1650 const HttpResponseInfo* response1 = trans1.GetResponseInfo(); |
| 1651 ASSERT_TRUE(response1 != NULL); | 1651 ASSERT_TRUE(response1); |
| 1652 EXPECT_TRUE(response1->headers.get() != NULL); | 1652 EXPECT_TRUE(response1->headers); |
| 1653 EXPECT_TRUE(response1->was_fetched_via_spdy); | 1653 EXPECT_TRUE(response1->was_fetched_via_spdy); |
| 1654 out.status_line = response1->headers->GetStatusLine(); | 1654 out.status_line = response1->headers->GetStatusLine(); |
| 1655 out.response_info = *response1; | 1655 out.response_info = *response1; |
| 1656 out.rv = ReadTransaction(&trans1, &out.response_data); | 1656 out.rv = ReadTransaction(&trans1, &out.response_data); |
| 1657 EXPECT_EQ(OK, out.rv); | 1657 EXPECT_EQ(OK, out.rv); |
| 1658 | 1658 |
| 1659 const HttpResponseInfo* response2 = trans2.GetResponseInfo(); | 1659 const HttpResponseInfo* response2 = trans2.GetResponseInfo(); |
| 1660 ASSERT_TRUE(response2 != NULL); | 1660 ASSERT_TRUE(response2); |
| 1661 out.status_line = response2->headers->GetStatusLine(); | 1661 out.status_line = response2->headers->GetStatusLine(); |
| 1662 out.response_info = *response2; | 1662 out.response_info = *response2; |
| 1663 out.rv = ReadTransaction(&trans2, &out.response_data); | 1663 out.rv = ReadTransaction(&trans2, &out.response_data); |
| 1664 EXPECT_EQ(ERR_CONNECTION_RESET, out.rv); | 1664 EXPECT_EQ(ERR_CONNECTION_RESET, out.rv); |
| 1665 | 1665 |
| 1666 helper.VerifyDataConsumed(); | 1666 helper.VerifyDataConsumed(); |
| 1667 } | 1667 } |
| 1668 | 1668 |
| 1669 // Test that a simple PUT request works. | 1669 // Test that a simple PUT request works. |
| 1670 TEST_P(SpdyNetworkTransactionTest, Put) { | 1670 TEST_P(SpdyNetworkTransactionTest, Put) { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 | 2162 |
| 2163 HttpNetworkTransaction* trans = helper.trans(); | 2163 HttpNetworkTransaction* trans = helper.trans(); |
| 2164 | 2164 |
| 2165 TestCompletionCallback callback; | 2165 TestCompletionCallback callback; |
| 2166 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 2166 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
| 2167 EXPECT_EQ(ERR_IO_PENDING, rv); | 2167 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2168 rv = callback.WaitForResult(); | 2168 rv = callback.WaitForResult(); |
| 2169 EXPECT_EQ(OK, rv); | 2169 EXPECT_EQ(OK, rv); |
| 2170 | 2170 |
| 2171 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2171 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2172 ASSERT_TRUE(response != NULL); | 2172 ASSERT_TRUE(response); |
| 2173 EXPECT_TRUE(response->headers.get() != NULL); | 2173 EXPECT_TRUE(response->headers); |
| 2174 EXPECT_TRUE(response->was_fetched_via_spdy); | 2174 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 2175 std::string response_data; | 2175 std::string response_data; |
| 2176 rv = ReadTransaction(trans, &response_data); | 2176 rv = ReadTransaction(trans, &response_data); |
| 2177 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, rv); | 2177 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, rv); |
| 2178 | 2178 |
| 2179 helper.VerifyDataConsumed(); | 2179 helper.VerifyDataConsumed(); |
| 2180 } | 2180 } |
| 2181 | 2181 |
| 2182 TEST_P(SpdyNetworkTransactionTest, ResetReplyWithTransferEncoding) { | 2182 TEST_P(SpdyNetworkTransactionTest, ResetReplyWithTransferEncoding) { |
| 2183 // Construct the request. | 2183 // Construct the request. |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 HttpResponseInfo response; | 2645 HttpResponseInfo response; |
| 2646 HttpResponseInfo response2; | 2646 HttpResponseInfo response2; |
| 2647 std::string expected_push_result("pushed"); | 2647 std::string expected_push_result("pushed"); |
| 2648 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2648 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2649 RunServerPushTest(&data, | 2649 RunServerPushTest(&data, |
| 2650 &response, | 2650 &response, |
| 2651 &response2, | 2651 &response2, |
| 2652 expected_push_result); | 2652 expected_push_result); |
| 2653 | 2653 |
| 2654 // Verify the SYN_REPLY. | 2654 // Verify the SYN_REPLY. |
| 2655 EXPECT_TRUE(response.headers.get() != NULL); | 2655 EXPECT_TRUE(response.headers); |
| 2656 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2656 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2657 | 2657 |
| 2658 // Verify the pushed stream. | 2658 // Verify the pushed stream. |
| 2659 EXPECT_TRUE(response2.headers.get() != NULL); | 2659 EXPECT_TRUE(response2.headers); |
| 2660 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 2660 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2661 } | 2661 } |
| 2662 | 2662 |
| 2663 TEST_P(SpdyNetworkTransactionTest, ServerPushBeforeSynReply) { | 2663 TEST_P(SpdyNetworkTransactionTest, ServerPushBeforeSynReply) { |
| 2664 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2664 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2665 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2665 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2666 MockWrite writes[] = { | 2666 MockWrite writes[] = { |
| 2667 CreateMockWrite(*stream1_syn, 0), | 2667 CreateMockWrite(*stream1_syn, 0), |
| 2668 }; | 2668 }; |
| 2669 | 2669 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2688 HttpResponseInfo response; | 2688 HttpResponseInfo response; |
| 2689 HttpResponseInfo response2; | 2689 HttpResponseInfo response2; |
| 2690 std::string expected_push_result("pushed"); | 2690 std::string expected_push_result("pushed"); |
| 2691 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2691 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2692 RunServerPushTest(&data, | 2692 RunServerPushTest(&data, |
| 2693 &response, | 2693 &response, |
| 2694 &response2, | 2694 &response2, |
| 2695 expected_push_result); | 2695 expected_push_result); |
| 2696 | 2696 |
| 2697 // Verify the SYN_REPLY. | 2697 // Verify the SYN_REPLY. |
| 2698 EXPECT_TRUE(response.headers.get() != NULL); | 2698 EXPECT_TRUE(response.headers); |
| 2699 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2699 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2700 | 2700 |
| 2701 // Verify the pushed stream. | 2701 // Verify the pushed stream. |
| 2702 EXPECT_TRUE(response2.headers.get() != NULL); | 2702 EXPECT_TRUE(response2.headers); |
| 2703 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 2703 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2704 } | 2704 } |
| 2705 | 2705 |
| 2706 TEST_P(SpdyNetworkTransactionTest, ServerPushSingleDataFrame2) { | 2706 TEST_P(SpdyNetworkTransactionTest, ServerPushSingleDataFrame2) { |
| 2707 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2707 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2708 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2708 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2709 MockWrite writes[] = { | 2709 MockWrite writes[] = { |
| 2710 CreateMockWrite(*stream1_syn, 0), | 2710 CreateMockWrite(*stream1_syn, 0), |
| 2711 }; | 2711 }; |
| 2712 | 2712 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2731 HttpResponseInfo response; | 2731 HttpResponseInfo response; |
| 2732 HttpResponseInfo response2; | 2732 HttpResponseInfo response2; |
| 2733 std::string expected_push_result("pushed"); | 2733 std::string expected_push_result("pushed"); |
| 2734 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2734 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2735 RunServerPushTest(&data, | 2735 RunServerPushTest(&data, |
| 2736 &response, | 2736 &response, |
| 2737 &response2, | 2737 &response2, |
| 2738 expected_push_result); | 2738 expected_push_result); |
| 2739 | 2739 |
| 2740 // Verify the SYN_REPLY. | 2740 // Verify the SYN_REPLY. |
| 2741 EXPECT_TRUE(response.headers.get() != NULL); | 2741 EXPECT_TRUE(response.headers); |
| 2742 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2742 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2743 | 2743 |
| 2744 // Verify the pushed stream. | 2744 // Verify the pushed stream. |
| 2745 EXPECT_TRUE(response2.headers.get() != NULL); | 2745 EXPECT_TRUE(response2.headers); |
| 2746 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 2746 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2747 } | 2747 } |
| 2748 | 2748 |
| 2749 TEST_P(SpdyNetworkTransactionTest, ServerPushServerAborted) { | 2749 TEST_P(SpdyNetworkTransactionTest, ServerPushServerAborted) { |
| 2750 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2750 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2751 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2751 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2752 std::unique_ptr<SpdySerializedFrame> stream1_body( | 2752 std::unique_ptr<SpdySerializedFrame> stream1_body( |
| 2753 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2753 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2754 MockWrite writes[] = { | 2754 MockWrite writes[] = { |
| 2755 CreateMockWrite(*stream1_syn, 0), | 2755 CreateMockWrite(*stream1_syn, 0), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2785 EXPECT_EQ(ERR_IO_PENDING, rv); | 2785 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2786 rv = callback.WaitForResult(); | 2786 rv = callback.WaitForResult(); |
| 2787 EXPECT_EQ(OK, rv); | 2787 EXPECT_EQ(OK, rv); |
| 2788 | 2788 |
| 2789 // Verify that we consumed all test data. | 2789 // Verify that we consumed all test data. |
| 2790 EXPECT_TRUE(data.AllReadDataConsumed()); | 2790 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 2791 EXPECT_TRUE(data.AllWriteDataConsumed()); | 2791 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 2792 | 2792 |
| 2793 // Verify the SYN_REPLY. | 2793 // Verify the SYN_REPLY. |
| 2794 HttpResponseInfo response = *trans->GetResponseInfo(); | 2794 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 2795 EXPECT_TRUE(response.headers.get() != NULL); | 2795 EXPECT_TRUE(response.headers); |
| 2796 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2796 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2797 } | 2797 } |
| 2798 | 2798 |
| 2799 // Verify that we don't leak streams and that we properly send a reset | 2799 // Verify that we don't leak streams and that we properly send a reset |
| 2800 // if the server pushes the same stream twice. | 2800 // if the server pushes the same stream twice. |
| 2801 TEST_P(SpdyNetworkTransactionTest, ServerPushDuplicate) { | 2801 TEST_P(SpdyNetworkTransactionTest, ServerPushDuplicate) { |
| 2802 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2802 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2803 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2803 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2804 std::unique_ptr<SpdySerializedFrame> stream1_body( | 2804 std::unique_ptr<SpdySerializedFrame> stream1_body( |
| 2805 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2805 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2831 HttpResponseInfo response; | 2831 HttpResponseInfo response; |
| 2832 HttpResponseInfo response2; | 2832 HttpResponseInfo response2; |
| 2833 std::string expected_push_result("pushed"); | 2833 std::string expected_push_result("pushed"); |
| 2834 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2834 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2835 RunServerPushTest(&data, | 2835 RunServerPushTest(&data, |
| 2836 &response, | 2836 &response, |
| 2837 &response2, | 2837 &response2, |
| 2838 expected_push_result); | 2838 expected_push_result); |
| 2839 | 2839 |
| 2840 // Verify the SYN_REPLY. | 2840 // Verify the SYN_REPLY. |
| 2841 EXPECT_TRUE(response.headers.get() != NULL); | 2841 EXPECT_TRUE(response.headers); |
| 2842 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2842 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2843 | 2843 |
| 2844 // Verify the pushed stream. | 2844 // Verify the pushed stream. |
| 2845 EXPECT_TRUE(response2.headers.get() != NULL); | 2845 EXPECT_TRUE(response2.headers); |
| 2846 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 2846 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2847 } | 2847 } |
| 2848 | 2848 |
| 2849 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrame) { | 2849 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrame) { |
| 2850 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2850 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2851 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2851 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2852 std::unique_ptr<SpdySerializedFrame> stream1_body( | 2852 std::unique_ptr<SpdySerializedFrame> stream1_body( |
| 2853 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2853 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2854 MockWrite writes[] = { | 2854 MockWrite writes[] = { |
| 2855 CreateMockWrite(*stream1_syn, 0), | 2855 CreateMockWrite(*stream1_syn, 0), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2884 MockRead(SYNCHRONOUS, ERR_IO_PENDING, 8), // Force a pause | 2884 MockRead(SYNCHRONOUS, ERR_IO_PENDING, 8), // Force a pause |
| 2885 }; | 2885 }; |
| 2886 | 2886 |
| 2887 HttpResponseInfo response; | 2887 HttpResponseInfo response; |
| 2888 HttpResponseInfo response2; | 2888 HttpResponseInfo response2; |
| 2889 std::string expected_push_result("pushed my darling hello my baby"); | 2889 std::string expected_push_result("pushed my darling hello my baby"); |
| 2890 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2890 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2891 RunServerPushTest(&data, &response, &response2, kPushedData); | 2891 RunServerPushTest(&data, &response, &response2, kPushedData); |
| 2892 | 2892 |
| 2893 // Verify the SYN_REPLY. | 2893 // Verify the SYN_REPLY. |
| 2894 EXPECT_TRUE(response.headers.get() != NULL); | 2894 EXPECT_TRUE(response.headers); |
| 2895 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2895 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2896 | 2896 |
| 2897 // Verify the pushed stream. | 2897 // Verify the pushed stream. |
| 2898 EXPECT_TRUE(response2.headers.get() != NULL); | 2898 EXPECT_TRUE(response2.headers); |
| 2899 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 2899 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2900 } | 2900 } |
| 2901 | 2901 |
| 2902 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrameInterrupted) { | 2902 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrameInterrupted) { |
| 2903 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2903 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2904 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2904 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2905 std::unique_ptr<SpdySerializedFrame> stream1_body( | 2905 std::unique_ptr<SpdySerializedFrame> stream1_body( |
| 2906 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2906 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2907 MockWrite writes[] = { | 2907 MockWrite writes[] = { |
| 2908 CreateMockWrite(*stream1_syn, 0), | 2908 CreateMockWrite(*stream1_syn, 0), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2936 CreateMockRead(*stream1_body.get(), 7, SYNCHRONOUS), | 2936 CreateMockRead(*stream1_body.get(), 7, SYNCHRONOUS), |
| 2937 MockRead(SYNCHRONOUS, ERR_IO_PENDING, 8) // Force a pause. | 2937 MockRead(SYNCHRONOUS, ERR_IO_PENDING, 8) // Force a pause. |
| 2938 }; | 2938 }; |
| 2939 | 2939 |
| 2940 HttpResponseInfo response; | 2940 HttpResponseInfo response; |
| 2941 HttpResponseInfo response2; | 2941 HttpResponseInfo response2; |
| 2942 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2942 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2943 RunServerPushTest(&data, &response, &response2, kPushedData); | 2943 RunServerPushTest(&data, &response, &response2, kPushedData); |
| 2944 | 2944 |
| 2945 // Verify the SYN_REPLY. | 2945 // Verify the SYN_REPLY. |
| 2946 EXPECT_TRUE(response.headers.get() != NULL); | 2946 EXPECT_TRUE(response.headers); |
| 2947 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2947 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2948 | 2948 |
| 2949 // Verify the pushed stream. | 2949 // Verify the pushed stream. |
| 2950 EXPECT_TRUE(response2.headers.get() != NULL); | 2950 EXPECT_TRUE(response2.headers); |
| 2951 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 2951 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2952 } | 2952 } |
| 2953 | 2953 |
| 2954 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) { | 2954 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) { |
| 2955 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 2955 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 2956 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 2956 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 2957 std::unique_ptr<SpdySerializedFrame> goaway; | 2957 std::unique_ptr<SpdySerializedFrame> goaway; |
| 2958 if (spdy_util_.spdy_version() == SPDY3) { | 2958 if (spdy_util_.spdy_version() == SPDY3) { |
| 2959 goaway.reset(spdy_util_.ConstructSpdyGoAway(0, GOAWAY_PROTOCOL_ERROR, | 2959 goaway.reset(spdy_util_.ConstructSpdyGoAway(0, GOAWAY_PROTOCOL_ERROR, |
| 2960 "Push on even stream id.")); | 2960 "Push on even stream id.")); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2991 EXPECT_EQ(ERR_IO_PENDING, rv); | 2991 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2992 rv = callback.WaitForResult(); | 2992 rv = callback.WaitForResult(); |
| 2993 EXPECT_EQ(OK, rv); | 2993 EXPECT_EQ(OK, rv); |
| 2994 | 2994 |
| 2995 // Verify that we consumed all test data. | 2995 // Verify that we consumed all test data. |
| 2996 EXPECT_TRUE(data.AllReadDataConsumed()); | 2996 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 2997 EXPECT_TRUE(data.AllWriteDataConsumed()); | 2997 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 2998 | 2998 |
| 2999 // Verify the SYN_REPLY. | 2999 // Verify the SYN_REPLY. |
| 3000 HttpResponseInfo response = *trans->GetResponseInfo(); | 3000 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 3001 EXPECT_TRUE(response.headers.get() != NULL); | 3001 EXPECT_TRUE(response.headers); |
| 3002 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 3002 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 3003 } | 3003 } |
| 3004 | 3004 |
| 3005 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID9) { | 3005 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID9) { |
| 3006 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 3006 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 3007 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3007 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 3008 std::unique_ptr<SpdySerializedFrame> stream1_body( | 3008 std::unique_ptr<SpdySerializedFrame> stream1_body( |
| 3009 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3009 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3010 std::unique_ptr<SpdySerializedFrame> stream2_rst( | 3010 std::unique_ptr<SpdySerializedFrame> stream2_rst( |
| 3011 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_INVALID_STREAM)); | 3011 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_INVALID_STREAM)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3040 EXPECT_EQ(ERR_IO_PENDING, rv); | 3040 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3041 rv = callback.WaitForResult(); | 3041 rv = callback.WaitForResult(); |
| 3042 EXPECT_EQ(OK, rv); | 3042 EXPECT_EQ(OK, rv); |
| 3043 | 3043 |
| 3044 // Verify that we consumed all test data. | 3044 // Verify that we consumed all test data. |
| 3045 EXPECT_TRUE(data.AllReadDataConsumed()); | 3045 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 3046 EXPECT_TRUE(data.AllWriteDataConsumed()); | 3046 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 3047 | 3047 |
| 3048 // Verify the SYN_REPLY. | 3048 // Verify the SYN_REPLY. |
| 3049 HttpResponseInfo response = *trans->GetResponseInfo(); | 3049 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 3050 EXPECT_TRUE(response.headers.get() != NULL); | 3050 EXPECT_TRUE(response.headers); |
| 3051 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 3051 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 3052 } | 3052 } |
| 3053 | 3053 |
| 3054 TEST_P(SpdyNetworkTransactionTest, ServerPushNoURL) { | 3054 TEST_P(SpdyNetworkTransactionTest, ServerPushNoURL) { |
| 3055 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 3055 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 3056 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3056 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 3057 std::unique_ptr<SpdySerializedFrame> stream1_body( | 3057 std::unique_ptr<SpdySerializedFrame> stream1_body( |
| 3058 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3058 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3059 std::unique_ptr<SpdySerializedFrame> stream2_rst( | 3059 std::unique_ptr<SpdySerializedFrame> stream2_rst( |
| 3060 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); | 3060 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_PROTOCOL_ERROR)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3094 EXPECT_EQ(ERR_IO_PENDING, rv); | 3094 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3095 rv = callback.WaitForResult(); | 3095 rv = callback.WaitForResult(); |
| 3096 EXPECT_EQ(OK, rv); | 3096 EXPECT_EQ(OK, rv); |
| 3097 | 3097 |
| 3098 // Verify that we consumed all test data. | 3098 // Verify that we consumed all test data. |
| 3099 EXPECT_TRUE(data.AllReadDataConsumed()); | 3099 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 3100 EXPECT_TRUE(data.AllWriteDataConsumed()); | 3100 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 3101 | 3101 |
| 3102 // Verify the SYN_REPLY. | 3102 // Verify the SYN_REPLY. |
| 3103 HttpResponseInfo response = *trans->GetResponseInfo(); | 3103 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 3104 EXPECT_TRUE(response.headers.get() != NULL); | 3104 EXPECT_TRUE(response.headers); |
| 3105 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 3105 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 3106 } | 3106 } |
| 3107 | 3107 |
| 3108 // PUSH_PROMISE on a server-initiated stream should trigger GOAWAY. | 3108 // PUSH_PROMISE on a server-initiated stream should trigger GOAWAY. |
| 3109 TEST_P(SpdyNetworkTransactionTest, ServerPushOnPushedStream) { | 3109 TEST_P(SpdyNetworkTransactionTest, ServerPushOnPushedStream) { |
| 3110 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 3110 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 3111 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 3111 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 3112 std::unique_ptr<SpdySerializedFrame> goaway(spdy_util_.ConstructSpdyGoAway( | 3112 std::unique_ptr<SpdySerializedFrame> goaway(spdy_util_.ConstructSpdyGoAway( |
| 3113 2, GOAWAY_PROTOCOL_ERROR, "Push on even stream id.")); | 3113 2, GOAWAY_PROTOCOL_ERROR, "Push on even stream id.")); |
| 3114 MockWrite writes[] = { | 3114 MockWrite writes[] = { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3160 helper.AddData(&data); | 3160 helper.AddData(&data); |
| 3161 | 3161 |
| 3162 HttpNetworkTransaction* trans = helper.trans(); | 3162 HttpNetworkTransaction* trans = helper.trans(); |
| 3163 | 3163 |
| 3164 TestCompletionCallback callback; | 3164 TestCompletionCallback callback; |
| 3165 int rv = | 3165 int rv = |
| 3166 trans->Start(&CreateGetRequest(), callback.callback(), BoundNetLog()); | 3166 trans->Start(&CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 3167 rv = callback.GetResult(rv); | 3167 rv = callback.GetResult(rv); |
| 3168 EXPECT_EQ(OK, rv); | 3168 EXPECT_EQ(OK, rv); |
| 3169 HttpResponseInfo response = *trans->GetResponseInfo(); | 3169 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 3170 EXPECT_TRUE(response.headers.get()); | 3170 EXPECT_TRUE(response.headers); |
| 3171 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 3171 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 3172 | 3172 |
| 3173 EXPECT_TRUE(data.AllReadDataConsumed()); | 3173 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 3174 EXPECT_TRUE(data.AllWriteDataConsumed()); | 3174 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 3175 VerifyStreamsClosed(helper); | 3175 VerifyStreamsClosed(helper); |
| 3176 } | 3176 } |
| 3177 | 3177 |
| 3178 // PUSH_PROMISE on a server-initiated stream should trigger GOAWAY even if | 3178 // PUSH_PROMISE on a server-initiated stream should trigger GOAWAY even if |
| 3179 // stream is closed. | 3179 // stream is closed. |
| 3180 TEST_P(SpdyNetworkTransactionTest, ServerPushOnClosedPushedStream) { | 3180 TEST_P(SpdyNetworkTransactionTest, ServerPushOnClosedPushedStream) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3211 helper.RunPreTestSetup(); | 3211 helper.RunPreTestSetup(); |
| 3212 helper.AddData(&data); | 3212 helper.AddData(&data); |
| 3213 | 3213 |
| 3214 HttpNetworkTransaction* trans1 = helper.trans(); | 3214 HttpNetworkTransaction* trans1 = helper.trans(); |
| 3215 TestCompletionCallback callback1; | 3215 TestCompletionCallback callback1; |
| 3216 int rv = | 3216 int rv = |
| 3217 trans1->Start(&CreateGetRequest(), callback1.callback(), BoundNetLog()); | 3217 trans1->Start(&CreateGetRequest(), callback1.callback(), BoundNetLog()); |
| 3218 rv = callback1.GetResult(rv); | 3218 rv = callback1.GetResult(rv); |
| 3219 EXPECT_EQ(OK, rv); | 3219 EXPECT_EQ(OK, rv); |
| 3220 HttpResponseInfo response = *trans1->GetResponseInfo(); | 3220 HttpResponseInfo response = *trans1->GetResponseInfo(); |
| 3221 EXPECT_TRUE(response.headers.get()); | 3221 EXPECT_TRUE(response.headers); |
| 3222 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 3222 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 3223 | 3223 |
| 3224 std::unique_ptr<HttpNetworkTransaction> trans2( | 3224 std::unique_ptr<HttpNetworkTransaction> trans2( |
| 3225 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); | 3225 new HttpNetworkTransaction(DEFAULT_PRIORITY, helper.session())); |
| 3226 TestCompletionCallback callback2; | 3226 TestCompletionCallback callback2; |
| 3227 rv = trans2->Start(&CreateGetPushRequest(), callback2.callback(), | 3227 rv = trans2->Start(&CreateGetPushRequest(), callback2.callback(), |
| 3228 BoundNetLog()); | 3228 BoundNetLog()); |
| 3229 rv = callback2.GetResult(rv); | 3229 rv = callback2.GetResult(rv); |
| 3230 EXPECT_EQ(OK, rv); | 3230 EXPECT_EQ(OK, rv); |
| 3231 response = *trans2->GetResponseInfo(); | 3231 response = *trans2->GetResponseInfo(); |
| 3232 EXPECT_TRUE(response.headers.get()); | 3232 EXPECT_TRUE(response.headers); |
| 3233 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 3233 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 3234 std::string result; | 3234 std::string result; |
| 3235 ReadResult(trans2.get(), &result); | 3235 ReadResult(trans2.get(), &result); |
| 3236 EXPECT_EQ(kPushedData, result); | 3236 EXPECT_EQ(kPushedData, result); |
| 3237 | 3237 |
| 3238 data.Resume(); | 3238 data.Resume(); |
| 3239 base::RunLoop().RunUntilIdle(); | 3239 base::RunLoop().RunUntilIdle(); |
| 3240 | 3240 |
| 3241 EXPECT_TRUE(data.AllReadDataConsumed()); | 3241 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 3242 EXPECT_TRUE(data.AllWriteDataConsumed()); | 3242 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3311 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, | 3311 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, |
| 3312 BoundNetLog(), GetParam(), NULL); | 3312 BoundNetLog(), GetParam(), NULL); |
| 3313 helper.RunToCompletion(&data); | 3313 helper.RunToCompletion(&data); |
| 3314 TransactionHelperResult out = helper.output(); | 3314 TransactionHelperResult out = helper.output(); |
| 3315 | 3315 |
| 3316 EXPECT_EQ(OK, out.rv); | 3316 EXPECT_EQ(OK, out.rv); |
| 3317 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 3317 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 3318 EXPECT_EQ("hello!", out.response_data); | 3318 EXPECT_EQ("hello!", out.response_data); |
| 3319 | 3319 |
| 3320 scoped_refptr<HttpResponseHeaders> headers = out.response_info.headers; | 3320 scoped_refptr<HttpResponseHeaders> headers = out.response_info.headers; |
| 3321 EXPECT_TRUE(headers.get() != NULL); | 3321 EXPECT_TRUE(headers); |
| 3322 size_t iter = 0; | 3322 size_t iter = 0; |
| 3323 std::string name, value; | 3323 std::string name, value; |
| 3324 SpdyHeaderBlock header_block; | 3324 SpdyHeaderBlock header_block; |
| 3325 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 3325 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
| 3326 SpdyHeaderBlock::StringPieceProxy mutable_header_block_value = | 3326 SpdyHeaderBlock::StringPieceProxy mutable_header_block_value = |
| 3327 header_block[name]; | 3327 header_block[name]; |
| 3328 if (static_cast<base::StringPiece>(mutable_header_block_value).empty()) { | 3328 if (static_cast<base::StringPiece>(mutable_header_block_value).empty()) { |
| 3329 mutable_header_block_value = value; | 3329 mutable_header_block_value = value; |
| 3330 } else { | 3330 } else { |
| 3331 std::string joint_value = mutable_header_block_value.as_string(); | 3331 std::string joint_value = mutable_header_block_value.as_string(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3428 EXPECT_EQ(OK, out.rv) << i; | 3428 EXPECT_EQ(OK, out.rv) << i; |
| 3429 EXPECT_EQ("HTTP/1.1 200", out.status_line) << i; | 3429 EXPECT_EQ("HTTP/1.1 200", out.status_line) << i; |
| 3430 EXPECT_EQ("hello!", out.response_data) << i; | 3430 EXPECT_EQ("hello!", out.response_data) << i; |
| 3431 | 3431 |
| 3432 // Test the response information. | 3432 // Test the response information. |
| 3433 EXPECT_EQ(out.response_info.vary_data.is_valid(), | 3433 EXPECT_EQ(out.response_info.vary_data.is_valid(), |
| 3434 test_cases[i].vary_matches) << i; | 3434 test_cases[i].vary_matches) << i; |
| 3435 | 3435 |
| 3436 // Check the headers. | 3436 // Check the headers. |
| 3437 scoped_refptr<HttpResponseHeaders> headers = out.response_info.headers; | 3437 scoped_refptr<HttpResponseHeaders> headers = out.response_info.headers; |
| 3438 ASSERT_TRUE(headers.get() != NULL) << i; | 3438 ASSERT_TRUE(headers) << i; |
| 3439 size_t iter = 0; | 3439 size_t iter = 0; |
| 3440 std::string name, value, lines; | 3440 std::string name, value, lines; |
| 3441 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 3441 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
| 3442 lines.append(name); | 3442 lines.append(name); |
| 3443 lines.append(": "); | 3443 lines.append(": "); |
| 3444 lines.append(value); | 3444 lines.append(value); |
| 3445 lines.append("\n"); | 3445 lines.append("\n"); |
| 3446 } | 3446 } |
| 3447 | 3447 |
| 3448 // Construct the expected header reply string. | 3448 // Construct the expected header reply string. |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3829 HttpNetworkTransaction* trans = helper.trans(); | 3829 HttpNetworkTransaction* trans = helper.trans(); |
| 3830 int rv = trans->Start( | 3830 int rv = trans->Start( |
| 3831 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 3831 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 3832 EXPECT_EQ(ERR_IO_PENDING, rv); | 3832 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3833 | 3833 |
| 3834 TransactionHelperResult out = helper.output(); | 3834 TransactionHelperResult out = helper.output(); |
| 3835 out.rv = callback.WaitForResult(); | 3835 out.rv = callback.WaitForResult(); |
| 3836 EXPECT_EQ(out.rv, OK); | 3836 EXPECT_EQ(out.rv, OK); |
| 3837 | 3837 |
| 3838 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3838 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3839 EXPECT_TRUE(response->headers.get() != NULL); | 3839 EXPECT_TRUE(response->headers); |
| 3840 EXPECT_TRUE(response->was_fetched_via_spdy); | 3840 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 3841 out.status_line = response->headers->GetStatusLine(); | 3841 out.status_line = response->headers->GetStatusLine(); |
| 3842 out.response_info = *response; // Make a copy so we can verify. | 3842 out.response_info = *response; // Make a copy so we can verify. |
| 3843 | 3843 |
| 3844 // Read Data | 3844 // Read Data |
| 3845 TestCompletionCallback read_callback; | 3845 TestCompletionCallback read_callback; |
| 3846 | 3846 |
| 3847 std::string content; | 3847 std::string content; |
| 3848 do { | 3848 do { |
| 3849 // Read small chunks at a time. | 3849 // Read small chunks at a time. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3918 TestCompletionCallback callback; | 3918 TestCompletionCallback callback; |
| 3919 int rv = trans->Start( | 3919 int rv = trans->Start( |
| 3920 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 3920 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 3921 EXPECT_EQ(ERR_IO_PENDING, rv); | 3921 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3922 | 3922 |
| 3923 TransactionHelperResult out = helper.output(); | 3923 TransactionHelperResult out = helper.output(); |
| 3924 out.rv = callback.WaitForResult(); | 3924 out.rv = callback.WaitForResult(); |
| 3925 EXPECT_EQ(out.rv, OK); | 3925 EXPECT_EQ(out.rv, OK); |
| 3926 | 3926 |
| 3927 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3927 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 3928 EXPECT_TRUE(response->headers.get() != NULL); | 3928 EXPECT_TRUE(response->headers); |
| 3929 EXPECT_TRUE(response->was_fetched_via_spdy); | 3929 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 3930 out.status_line = response->headers->GetStatusLine(); | 3930 out.status_line = response->headers->GetStatusLine(); |
| 3931 out.response_info = *response; // Make a copy so we can verify. | 3931 out.response_info = *response; // Make a copy so we can verify. |
| 3932 | 3932 |
| 3933 // Read Data | 3933 // Read Data |
| 3934 TestCompletionCallback read_callback; | 3934 TestCompletionCallback read_callback; |
| 3935 | 3935 |
| 3936 std::string content; | 3936 std::string content; |
| 3937 int reads_completed = 0; | 3937 int reads_completed = 0; |
| 3938 do { | 3938 do { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 TestCompletionCallback callback; | 4008 TestCompletionCallback callback; |
| 4009 int rv = trans->Start( | 4009 int rv = trans->Start( |
| 4010 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 4010 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 4011 EXPECT_EQ(ERR_IO_PENDING, rv); | 4011 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4012 | 4012 |
| 4013 TransactionHelperResult out = helper.output(); | 4013 TransactionHelperResult out = helper.output(); |
| 4014 out.rv = callback.WaitForResult(); | 4014 out.rv = callback.WaitForResult(); |
| 4015 EXPECT_EQ(out.rv, OK); | 4015 EXPECT_EQ(out.rv, OK); |
| 4016 | 4016 |
| 4017 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4017 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4018 EXPECT_TRUE(response->headers.get() != NULL); | 4018 EXPECT_TRUE(response->headers); |
| 4019 EXPECT_TRUE(response->was_fetched_via_spdy); | 4019 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 4020 out.status_line = response->headers->GetStatusLine(); | 4020 out.status_line = response->headers->GetStatusLine(); |
| 4021 out.response_info = *response; // Make a copy so we can verify. | 4021 out.response_info = *response; // Make a copy so we can verify. |
| 4022 | 4022 |
| 4023 // Read Data | 4023 // Read Data |
| 4024 TestCompletionCallback read_callback; | 4024 TestCompletionCallback read_callback; |
| 4025 | 4025 |
| 4026 std::string content; | 4026 std::string content; |
| 4027 int reads_completed = 0; | 4027 int reads_completed = 0; |
| 4028 do { | 4028 do { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4094 | 4094 |
| 4095 int rv = trans->Start( | 4095 int rv = trans->Start( |
| 4096 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 4096 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 4097 EXPECT_EQ(ERR_IO_PENDING, rv); | 4097 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4098 | 4098 |
| 4099 TransactionHelperResult out = helper.output(); | 4099 TransactionHelperResult out = helper.output(); |
| 4100 out.rv = callback.WaitForResult(); | 4100 out.rv = callback.WaitForResult(); |
| 4101 EXPECT_EQ(out.rv, OK); | 4101 EXPECT_EQ(out.rv, OK); |
| 4102 | 4102 |
| 4103 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4103 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4104 EXPECT_TRUE(response->headers.get() != NULL); | 4104 EXPECT_TRUE(response->headers); |
| 4105 EXPECT_TRUE(response->was_fetched_via_spdy); | 4105 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 4106 out.status_line = response->headers->GetStatusLine(); | 4106 out.status_line = response->headers->GetStatusLine(); |
| 4107 out.response_info = *response; // Make a copy so we can verify. | 4107 out.response_info = *response; // Make a copy so we can verify. |
| 4108 | 4108 |
| 4109 // Read Data | 4109 // Read Data |
| 4110 TestCompletionCallback read_callback; | 4110 TestCompletionCallback read_callback; |
| 4111 | 4111 |
| 4112 std::string content; | 4112 std::string content; |
| 4113 int reads_completed = 0; | 4113 int reads_completed = 0; |
| 4114 do { | 4114 do { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4176 | 4176 |
| 4177 int rv = trans->Start( | 4177 int rv = trans->Start( |
| 4178 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 4178 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 4179 EXPECT_EQ(ERR_IO_PENDING, rv); | 4179 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4180 | 4180 |
| 4181 TransactionHelperResult out = helper.output(); | 4181 TransactionHelperResult out = helper.output(); |
| 4182 out.rv = callback.WaitForResult(); | 4182 out.rv = callback.WaitForResult(); |
| 4183 EXPECT_EQ(out.rv, OK); | 4183 EXPECT_EQ(out.rv, OK); |
| 4184 | 4184 |
| 4185 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4185 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4186 EXPECT_TRUE(response->headers.get() != NULL); | 4186 EXPECT_TRUE(response->headers); |
| 4187 EXPECT_TRUE(response->was_fetched_via_spdy); | 4187 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 4188 out.status_line = response->headers->GetStatusLine(); | 4188 out.status_line = response->headers->GetStatusLine(); |
| 4189 out.response_info = *response; // Make a copy so we can verify. | 4189 out.response_info = *response; // Make a copy so we can verify. |
| 4190 | 4190 |
| 4191 // Read Data | 4191 // Read Data |
| 4192 TestCompletionCallback read_callback; | 4192 TestCompletionCallback read_callback; |
| 4193 | 4193 |
| 4194 const int kReadSize = 256; | 4194 const int kReadSize = 256; |
| 4195 scoped_refptr<IOBuffer> buf(new IOBuffer(kReadSize)); | 4195 scoped_refptr<IOBuffer> buf(new IOBuffer(kReadSize)); |
| 4196 rv = trans->Read(buf.get(), kReadSize, read_callback.callback()); | 4196 rv = trans->Read(buf.get(), kReadSize, read_callback.callback()); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4487 | 4487 |
| 4488 TestCompletionCallback callback; | 4488 TestCompletionCallback callback; |
| 4489 TransactionHelperResult out; | 4489 TransactionHelperResult out; |
| 4490 out.rv = trans->Start(&CreateGetRequest(), callback.callback(), log); | 4490 out.rv = trans->Start(&CreateGetRequest(), callback.callback(), log); |
| 4491 | 4491 |
| 4492 EXPECT_EQ(out.rv, ERR_IO_PENDING); | 4492 EXPECT_EQ(out.rv, ERR_IO_PENDING); |
| 4493 out.rv = callback.WaitForResult(); | 4493 out.rv = callback.WaitForResult(); |
| 4494 EXPECT_EQ(out.rv, OK); | 4494 EXPECT_EQ(out.rv, OK); |
| 4495 | 4495 |
| 4496 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4496 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4497 EXPECT_TRUE(response->headers.get() != NULL); | 4497 EXPECT_TRUE(response->headers); |
| 4498 EXPECT_TRUE(response->was_fetched_via_spdy); | 4498 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 4499 out.rv = ReadTransaction(trans, &out.response_data); | 4499 out.rv = ReadTransaction(trans, &out.response_data); |
| 4500 EXPECT_EQ(ERR_CONNECTION_CLOSED, out.rv); | 4500 EXPECT_EQ(ERR_CONNECTION_CLOSED, out.rv); |
| 4501 | 4501 |
| 4502 // Verify that we consumed all test data. | 4502 // Verify that we consumed all test data. |
| 4503 helper.VerifyDataConsumed(); | 4503 helper.VerifyDataConsumed(); |
| 4504 } | 4504 } |
| 4505 | 4505 |
| 4506 // HTTP_1_1_REQUIRED results in ERR_HTTP_1_1_REQUIRED. | 4506 // HTTP_1_1_REQUIRED results in ERR_HTTP_1_1_REQUIRED. |
| 4507 TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredError) { | 4507 TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredError) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4593 const HostPortPair host_port_pair = HostPortPair::FromURL(GURL(url)); | 4593 const HostPortPair host_port_pair = HostPortPair::FromURL(GURL(url)); |
| 4594 EXPECT_FALSE(http_server_properties->RequiresHTTP11(host_port_pair)); | 4594 EXPECT_FALSE(http_server_properties->RequiresHTTP11(host_port_pair)); |
| 4595 | 4595 |
| 4596 helper.RunPreTestSetup(); | 4596 helper.RunPreTestSetup(); |
| 4597 helper.StartDefaultTest(); | 4597 helper.StartDefaultTest(); |
| 4598 helper.FinishDefaultTestWithoutVerification(); | 4598 helper.FinishDefaultTestWithoutVerification(); |
| 4599 helper.VerifyDataConsumed(); | 4599 helper.VerifyDataConsumed(); |
| 4600 EXPECT_TRUE(http_server_properties->RequiresHTTP11(host_port_pair)); | 4600 EXPECT_TRUE(http_server_properties->RequiresHTTP11(host_port_pair)); |
| 4601 | 4601 |
| 4602 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); | 4602 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); |
| 4603 ASSERT_TRUE(response != nullptr); | 4603 ASSERT_TRUE(response); |
| 4604 ASSERT_TRUE(response->headers.get() != nullptr); | 4604 ASSERT_TRUE(response->headers); |
| 4605 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4605 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4606 EXPECT_FALSE(response->was_fetched_via_spdy); | 4606 EXPECT_FALSE(response->was_fetched_via_spdy); |
| 4607 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, response->connection_info); | 4607 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, response->connection_info); |
| 4608 EXPECT_TRUE(response->was_npn_negotiated); | 4608 EXPECT_TRUE(response->was_npn_negotiated); |
| 4609 EXPECT_TRUE(request.url.SchemeIs("https")); | 4609 EXPECT_TRUE(request.url.SchemeIs("https")); |
| 4610 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 4610 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
| 4611 EXPECT_EQ(443, response->socket_address.port()); | 4611 EXPECT_EQ(443, response->socket_address.port()); |
| 4612 std::string response_data; | 4612 std::string response_data; |
| 4613 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); | 4613 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); |
| 4614 EXPECT_EQ("hello", response_data); | 4614 EXPECT_EQ("hello", response_data); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4698 const HostPortPair proxy_host_port_pair = HostPortPair("myproxy", 70); | 4698 const HostPortPair proxy_host_port_pair = HostPortPair("myproxy", 70); |
| 4699 EXPECT_FALSE(http_server_properties->RequiresHTTP11(proxy_host_port_pair)); | 4699 EXPECT_FALSE(http_server_properties->RequiresHTTP11(proxy_host_port_pair)); |
| 4700 | 4700 |
| 4701 helper.RunPreTestSetup(); | 4701 helper.RunPreTestSetup(); |
| 4702 helper.StartDefaultTest(); | 4702 helper.StartDefaultTest(); |
| 4703 helper.FinishDefaultTestWithoutVerification(); | 4703 helper.FinishDefaultTestWithoutVerification(); |
| 4704 helper.VerifyDataConsumed(); | 4704 helper.VerifyDataConsumed(); |
| 4705 EXPECT_TRUE(http_server_properties->RequiresHTTP11(proxy_host_port_pair)); | 4705 EXPECT_TRUE(http_server_properties->RequiresHTTP11(proxy_host_port_pair)); |
| 4706 | 4706 |
| 4707 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); | 4707 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); |
| 4708 ASSERT_TRUE(response != nullptr); | 4708 ASSERT_TRUE(response); |
| 4709 ASSERT_TRUE(response->headers.get() != nullptr); | 4709 ASSERT_TRUE(response->headers); |
| 4710 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4710 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 4711 EXPECT_FALSE(response->was_fetched_via_spdy); | 4711 EXPECT_FALSE(response->was_fetched_via_spdy); |
| 4712 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, response->connection_info); | 4712 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1, response->connection_info); |
| 4713 EXPECT_FALSE(response->was_npn_negotiated); | 4713 EXPECT_FALSE(response->was_npn_negotiated); |
| 4714 EXPECT_TRUE(request.url.SchemeIs("https")); | 4714 EXPECT_TRUE(request.url.SchemeIs("https")); |
| 4715 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 4715 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
| 4716 EXPECT_EQ(70, response->socket_address.port()); | 4716 EXPECT_EQ(70, response->socket_address.port()); |
| 4717 std::string response_data; | 4717 std::string response_data; |
| 4718 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); | 4718 ASSERT_EQ(OK, ReadTransaction(helper.trans(), &response_data)); |
| 4719 EXPECT_EQ("hello", response_data); | 4719 EXPECT_EQ("hello", response_data); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4760 | 4760 |
| 4761 int rv = trans->Start( | 4761 int rv = trans->Start( |
| 4762 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 4762 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 4763 EXPECT_EQ(ERR_IO_PENDING, rv); | 4763 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4764 | 4764 |
| 4765 rv = callback.WaitForResult(); | 4765 rv = callback.WaitForResult(); |
| 4766 EXPECT_EQ(0, rv); | 4766 EXPECT_EQ(0, rv); |
| 4767 | 4767 |
| 4768 // Verify the SYN_REPLY. | 4768 // Verify the SYN_REPLY. |
| 4769 HttpResponseInfo response = *trans->GetResponseInfo(); | 4769 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 4770 ASSERT_TRUE(response.headers.get() != NULL); | 4770 ASSERT_TRUE(response.headers); |
| 4771 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 4771 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 4772 | 4772 |
| 4773 std::string response_data; | 4773 std::string response_data; |
| 4774 ASSERT_EQ(OK, ReadTransaction(trans, &response_data)); | 4774 ASSERT_EQ(OK, ReadTransaction(trans, &response_data)); |
| 4775 EXPECT_EQ("hello!", response_data); | 4775 EXPECT_EQ("hello!", response_data); |
| 4776 helper.VerifyDataConsumed(); | 4776 helper.VerifyDataConsumed(); |
| 4777 } | 4777 } |
| 4778 | 4778 |
| 4779 // Test to make sure we can correctly connect through a proxy to | 4779 // Test to make sure we can correctly connect through a proxy to |
| 4780 // www.example.org, if there already exists a direct spdy connection to | 4780 // www.example.org, if there already exists a direct spdy connection to |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4821 TestCompletionCallback callback; | 4821 TestCompletionCallback callback; |
| 4822 TransactionHelperResult out; | 4822 TransactionHelperResult out; |
| 4823 out.rv = trans->Start( | 4823 out.rv = trans->Start( |
| 4824 &CreateGetRequest(), callback.callback(), BoundNetLog()); | 4824 &CreateGetRequest(), callback.callback(), BoundNetLog()); |
| 4825 | 4825 |
| 4826 EXPECT_EQ(out.rv, ERR_IO_PENDING); | 4826 EXPECT_EQ(out.rv, ERR_IO_PENDING); |
| 4827 out.rv = callback.WaitForResult(); | 4827 out.rv = callback.WaitForResult(); |
| 4828 EXPECT_EQ(out.rv, OK); | 4828 EXPECT_EQ(out.rv, OK); |
| 4829 | 4829 |
| 4830 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4830 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4831 EXPECT_TRUE(response->headers.get() != NULL); | 4831 EXPECT_TRUE(response->headers); |
| 4832 EXPECT_TRUE(response->was_fetched_via_spdy); | 4832 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 4833 out.rv = ReadTransaction(trans, &out.response_data); | 4833 out.rv = ReadTransaction(trans, &out.response_data); |
| 4834 EXPECT_EQ(OK, out.rv); | 4834 EXPECT_EQ(OK, out.rv); |
| 4835 out.status_line = response->headers->GetStatusLine(); | 4835 out.status_line = response->headers->GetStatusLine(); |
| 4836 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 4836 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 4837 EXPECT_EQ("hello!", out.response_data); | 4837 EXPECT_EQ("hello!", out.response_data); |
| 4838 | 4838 |
| 4839 // Check that the SpdySession is still in the SpdySessionPool. | 4839 // Check that the SpdySession is still in the SpdySessionPool. |
| 4840 HostPortPair host_port_pair("www.example.org", helper.port()); | 4840 HostPortPair host_port_pair("www.example.org", helper.port()); |
| 4841 SpdySessionKey session_pool_key_direct( | 4841 SpdySessionKey session_pool_key_direct( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4902 | 4902 |
| 4903 HttpNetworkTransaction* trans_proxy = helper_proxy.trans(); | 4903 HttpNetworkTransaction* trans_proxy = helper_proxy.trans(); |
| 4904 TestCompletionCallback callback_proxy; | 4904 TestCompletionCallback callback_proxy; |
| 4905 int rv = trans_proxy->Start( | 4905 int rv = trans_proxy->Start( |
| 4906 &request_proxy, callback_proxy.callback(), BoundNetLog()); | 4906 &request_proxy, callback_proxy.callback(), BoundNetLog()); |
| 4907 EXPECT_EQ(ERR_IO_PENDING, rv); | 4907 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 4908 rv = callback_proxy.WaitForResult(); | 4908 rv = callback_proxy.WaitForResult(); |
| 4909 EXPECT_EQ(0, rv); | 4909 EXPECT_EQ(0, rv); |
| 4910 | 4910 |
| 4911 HttpResponseInfo response_proxy = *trans_proxy->GetResponseInfo(); | 4911 HttpResponseInfo response_proxy = *trans_proxy->GetResponseInfo(); |
| 4912 ASSERT_TRUE(response_proxy.headers.get() != NULL); | 4912 ASSERT_TRUE(response_proxy.headers); |
| 4913 EXPECT_EQ("HTTP/1.1 200", response_proxy.headers->GetStatusLine()); | 4913 EXPECT_EQ("HTTP/1.1 200", response_proxy.headers->GetStatusLine()); |
| 4914 | 4914 |
| 4915 std::string response_data; | 4915 std::string response_data; |
| 4916 ASSERT_EQ(OK, ReadTransaction(trans_proxy, &response_data)); | 4916 ASSERT_EQ(OK, ReadTransaction(trans_proxy, &response_data)); |
| 4917 EXPECT_EQ("hello!", response_data); | 4917 EXPECT_EQ("hello!", response_data); |
| 4918 | 4918 |
| 4919 helper_proxy.VerifyDataConsumed(); | 4919 helper_proxy.VerifyDataConsumed(); |
| 4920 } | 4920 } |
| 4921 | 4921 |
| 4922 // When we get a TCP-level RST, we need to retry a HttpNetworkTransaction | 4922 // When we get a TCP-level RST, we need to retry a HttpNetworkTransaction |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4990 base::RunLoop().RunUntilIdle(); | 4990 base::RunLoop().RunUntilIdle(); |
| 4991 } | 4991 } |
| 4992 | 4992 |
| 4993 // Now schedule the ERR_CONNECTION_RESET. | 4993 // Now schedule the ERR_CONNECTION_RESET. |
| 4994 data1.Resume(); | 4994 data1.Resume(); |
| 4995 } | 4995 } |
| 4996 rv = callback.WaitForResult(); | 4996 rv = callback.WaitForResult(); |
| 4997 EXPECT_EQ(OK, rv); | 4997 EXPECT_EQ(OK, rv); |
| 4998 | 4998 |
| 4999 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4999 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5000 ASSERT_TRUE(response != NULL); | 5000 ASSERT_TRUE(response); |
| 5001 EXPECT_TRUE(response->headers.get() != NULL); | 5001 EXPECT_TRUE(response->headers); |
| 5002 EXPECT_TRUE(response->was_fetched_via_spdy); | 5002 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 5003 std::string response_data; | 5003 std::string response_data; |
| 5004 rv = ReadTransaction(trans.get(), &response_data); | 5004 rv = ReadTransaction(trans.get(), &response_data); |
| 5005 EXPECT_EQ(OK, rv); | 5005 EXPECT_EQ(OK, rv); |
| 5006 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 5006 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
| 5007 EXPECT_EQ("hello!", response_data); | 5007 EXPECT_EQ("hello!", response_data); |
| 5008 base::RunLoop().RunUntilIdle(); | 5008 base::RunLoop().RunUntilIdle(); |
| 5009 } | 5009 } |
| 5010 | 5010 |
| 5011 helper.VerifyDataConsumed(); | 5011 helper.VerifyDataConsumed(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5124 helper.AddData(&data); | 5124 helper.AddData(&data); |
| 5125 HttpNetworkTransaction* trans = helper.trans(); | 5125 HttpNetworkTransaction* trans = helper.trans(); |
| 5126 TestCompletionCallback callback; | 5126 TestCompletionCallback callback; |
| 5127 const int rv_start = trans->Start(&request, callback.callback(), net_log); | 5127 const int rv_start = trans->Start(&request, callback.callback(), net_log); |
| 5128 EXPECT_EQ(ERR_IO_PENDING, rv_start); | 5128 EXPECT_EQ(ERR_IO_PENDING, rv_start); |
| 5129 const int rv_start_complete = callback.WaitForResult(); | 5129 const int rv_start_complete = callback.WaitForResult(); |
| 5130 EXPECT_EQ(OK, rv_start_complete); | 5130 EXPECT_EQ(OK, rv_start_complete); |
| 5131 | 5131 |
| 5132 // Make sure the response has an auth challenge. | 5132 // Make sure the response has an auth challenge. |
| 5133 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); | 5133 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); |
| 5134 ASSERT_TRUE(response_start != NULL); | 5134 ASSERT_TRUE(response_start); |
| 5135 ASSERT_TRUE(response_start->headers.get() != NULL); | 5135 ASSERT_TRUE(response_start->headers); |
| 5136 EXPECT_EQ(401, response_start->headers->response_code()); | 5136 EXPECT_EQ(401, response_start->headers->response_code()); |
| 5137 EXPECT_TRUE(response_start->was_fetched_via_spdy); | 5137 EXPECT_TRUE(response_start->was_fetched_via_spdy); |
| 5138 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); | 5138 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); |
| 5139 ASSERT_TRUE(auth_challenge != NULL); | 5139 ASSERT_TRUE(auth_challenge); |
| 5140 EXPECT_FALSE(auth_challenge->is_proxy); | 5140 EXPECT_FALSE(auth_challenge->is_proxy); |
| 5141 EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme); | 5141 EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme); |
| 5142 EXPECT_EQ("MyRealm", auth_challenge->realm); | 5142 EXPECT_EQ("MyRealm", auth_challenge->realm); |
| 5143 | 5143 |
| 5144 // Restart with a username/password. | 5144 // Restart with a username/password. |
| 5145 AuthCredentials credentials(base::ASCIIToUTF16("foo"), | 5145 AuthCredentials credentials(base::ASCIIToUTF16("foo"), |
| 5146 base::ASCIIToUTF16("bar")); | 5146 base::ASCIIToUTF16("bar")); |
| 5147 TestCompletionCallback callback_restart; | 5147 TestCompletionCallback callback_restart; |
| 5148 const int rv_restart = trans->RestartWithAuth( | 5148 const int rv_restart = trans->RestartWithAuth( |
| 5149 credentials, callback_restart.callback()); | 5149 credentials, callback_restart.callback()); |
| 5150 EXPECT_EQ(ERR_IO_PENDING, rv_restart); | 5150 EXPECT_EQ(ERR_IO_PENDING, rv_restart); |
| 5151 const int rv_restart_complete = callback_restart.WaitForResult(); | 5151 const int rv_restart_complete = callback_restart.WaitForResult(); |
| 5152 EXPECT_EQ(OK, rv_restart_complete); | 5152 EXPECT_EQ(OK, rv_restart_complete); |
| 5153 // TODO(cbentzel): This is actually the same response object as before, but | 5153 // TODO(cbentzel): This is actually the same response object as before, but |
| 5154 // data has changed. | 5154 // data has changed. |
| 5155 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); | 5155 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); |
| 5156 ASSERT_TRUE(response_restart != NULL); | 5156 ASSERT_TRUE(response_restart); |
| 5157 ASSERT_TRUE(response_restart->headers.get() != NULL); | 5157 ASSERT_TRUE(response_restart->headers); |
| 5158 EXPECT_EQ(200, response_restart->headers->response_code()); | 5158 EXPECT_EQ(200, response_restart->headers->response_code()); |
| 5159 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); | 5159 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); |
| 5160 } | 5160 } |
| 5161 | 5161 |
| 5162 TEST_P(SpdyNetworkTransactionTest, ServerPushWithHeaders) { | 5162 TEST_P(SpdyNetworkTransactionTest, ServerPushWithHeaders) { |
| 5163 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 5163 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 5164 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 5164 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 5165 MockWrite writes[] = { | 5165 MockWrite writes[] = { |
| 5166 CreateMockWrite(*stream1_syn, 0), | 5166 CreateMockWrite(*stream1_syn, 0), |
| 5167 }; | 5167 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5203 HttpResponseInfo response; | 5203 HttpResponseInfo response; |
| 5204 HttpResponseInfo response2; | 5204 HttpResponseInfo response2; |
| 5205 std::string expected_push_result("pushed"); | 5205 std::string expected_push_result("pushed"); |
| 5206 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 5206 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 5207 RunServerPushTest(&data, | 5207 RunServerPushTest(&data, |
| 5208 &response, | 5208 &response, |
| 5209 &response2, | 5209 &response2, |
| 5210 expected_push_result); | 5210 expected_push_result); |
| 5211 | 5211 |
| 5212 // Verify the SYN_REPLY. | 5212 // Verify the SYN_REPLY. |
| 5213 EXPECT_TRUE(response.headers.get() != NULL); | 5213 EXPECT_TRUE(response.headers); |
| 5214 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 5214 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 5215 | 5215 |
| 5216 // Verify the pushed stream. | 5216 // Verify the pushed stream. |
| 5217 EXPECT_TRUE(response2.headers.get() != NULL); | 5217 EXPECT_TRUE(response2.headers); |
| 5218 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 5218 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 5219 } | 5219 } |
| 5220 | 5220 |
| 5221 TEST_P(SpdyNetworkTransactionTest, ServerPushClaimBeforeHeaders) { | 5221 TEST_P(SpdyNetworkTransactionTest, ServerPushClaimBeforeHeaders) { |
| 5222 // We push a stream and attempt to claim it before the headers come down. | 5222 // We push a stream and attempt to claim it before the headers come down. |
| 5223 std::unique_ptr<SpdySerializedFrame> stream1_syn( | 5223 std::unique_ptr<SpdySerializedFrame> stream1_syn( |
| 5224 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); | 5224 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); |
| 5225 MockWrite writes[] = { | 5225 MockWrite writes[] = { |
| 5226 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS), | 5226 CreateMockWrite(*stream1_syn, 0, SYNCHRONOUS), |
| 5227 }; | 5227 }; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5302 << expected_push_result; | 5302 << expected_push_result; |
| 5303 | 5303 |
| 5304 // Verify the SYN_REPLY. | 5304 // Verify the SYN_REPLY. |
| 5305 // Copy the response info, because trans goes away. | 5305 // Copy the response info, because trans goes away. |
| 5306 response = *trans->GetResponseInfo(); | 5306 response = *trans->GetResponseInfo(); |
| 5307 response2 = *trans2->GetResponseInfo(); | 5307 response2 = *trans2->GetResponseInfo(); |
| 5308 | 5308 |
| 5309 VerifyStreamsClosed(helper); | 5309 VerifyStreamsClosed(helper); |
| 5310 | 5310 |
| 5311 // Verify the SYN_REPLY. | 5311 // Verify the SYN_REPLY. |
| 5312 EXPECT_TRUE(response.headers.get() != NULL); | 5312 EXPECT_TRUE(response.headers); |
| 5313 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 5313 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 5314 | 5314 |
| 5315 // Verify the pushed stream. | 5315 // Verify the pushed stream. |
| 5316 EXPECT_TRUE(response2.headers.get() != NULL); | 5316 EXPECT_TRUE(response2.headers); |
| 5317 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 5317 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 5318 | 5318 |
| 5319 // Read the final EOF (which will close the session) | 5319 // Read the final EOF (which will close the session) |
| 5320 data.Resume(); | 5320 data.Resume(); |
| 5321 base::RunLoop().RunUntilIdle(); | 5321 base::RunLoop().RunUntilIdle(); |
| 5322 | 5322 |
| 5323 // Verify that we consumed all test data. | 5323 // Verify that we consumed all test data. |
| 5324 EXPECT_TRUE(data.AllReadDataConsumed()); | 5324 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 5325 EXPECT_TRUE(data.AllWriteDataConsumed()); | 5325 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 5326 } | 5326 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5429 EXPECT_EQ(expected_push_result, result2); | 5429 EXPECT_EQ(expected_push_result, result2); |
| 5430 | 5430 |
| 5431 // Verify the SYN_REPLY. | 5431 // Verify the SYN_REPLY. |
| 5432 // Copy the response info, because trans goes away. | 5432 // Copy the response info, because trans goes away. |
| 5433 response = *trans->GetResponseInfo(); | 5433 response = *trans->GetResponseInfo(); |
| 5434 response2 = *trans2->GetResponseInfo(); | 5434 response2 = *trans2->GetResponseInfo(); |
| 5435 | 5435 |
| 5436 VerifyStreamsClosed(helper); | 5436 VerifyStreamsClosed(helper); |
| 5437 | 5437 |
| 5438 // Verify the SYN_REPLY. | 5438 // Verify the SYN_REPLY. |
| 5439 EXPECT_TRUE(response.headers.get() != NULL); | 5439 EXPECT_TRUE(response.headers); |
| 5440 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 5440 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 5441 | 5441 |
| 5442 // Verify the pushed stream. | 5442 // Verify the pushed stream. |
| 5443 EXPECT_TRUE(response2.headers.get() != NULL); | 5443 EXPECT_TRUE(response2.headers); |
| 5444 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); | 5444 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 5445 | 5445 |
| 5446 // Verify we got all the headers from all header blocks. | 5446 // Verify we got all the headers from all header blocks. |
| 5447 if (spdy_util_.spdy_version() < HTTP2) | 5447 if (spdy_util_.spdy_version() < HTTP2) |
| 5448 EXPECT_TRUE(response2.headers->HasHeaderValue("alpha", "beta")); | 5448 EXPECT_TRUE(response2.headers->HasHeaderValue("alpha", "beta")); |
| 5449 EXPECT_TRUE(response2.headers->HasHeaderValue("hello", "bye")); | 5449 EXPECT_TRUE(response2.headers->HasHeaderValue("hello", "bye")); |
| 5450 EXPECT_TRUE(response2.headers->HasHeaderValue("status", "200")); | 5450 EXPECT_TRUE(response2.headers->HasHeaderValue("status", "200")); |
| 5451 | 5451 |
| 5452 // Read the final EOF (which will close the session) | 5452 // Read the final EOF (which will close the session) |
| 5453 data.Resume(); | 5453 data.Resume(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5538 // Verify that we haven't received any push data. | 5538 // Verify that we haven't received any push data. |
| 5539 EXPECT_EQ("", result2); | 5539 EXPECT_EQ("", result2); |
| 5540 | 5540 |
| 5541 // Verify the SYN_REPLY. | 5541 // Verify the SYN_REPLY. |
| 5542 // Copy the response info, because trans goes away. | 5542 // Copy the response info, because trans goes away. |
| 5543 HttpResponseInfo response = *trans->GetResponseInfo(); | 5543 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 5544 | 5544 |
| 5545 VerifyStreamsClosed(helper); | 5545 VerifyStreamsClosed(helper); |
| 5546 | 5546 |
| 5547 // Verify the SYN_REPLY. | 5547 // Verify the SYN_REPLY. |
| 5548 EXPECT_TRUE(response.headers.get() != NULL); | 5548 EXPECT_TRUE(response.headers); |
| 5549 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 5549 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 5550 | 5550 |
| 5551 // Read the final EOF (which will close the session). | 5551 // Read the final EOF (which will close the session). |
| 5552 data.Resume(); | 5552 data.Resume(); |
| 5553 base::RunLoop().RunUntilIdle(); | 5553 base::RunLoop().RunUntilIdle(); |
| 5554 | 5554 |
| 5555 // Verify that we consumed all test data. | 5555 // Verify that we consumed all test data. |
| 5556 EXPECT_TRUE(data.AllReadDataConsumed()); | 5556 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 5557 EXPECT_TRUE(data.AllWriteDataConsumed()); | 5557 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 5558 } | 5558 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5727 EXPECT_TRUE(data.AllReadDataConsumed()); | 5727 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 5728 EXPECT_TRUE(data.AllWriteDataConsumed()); | 5728 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 5729 | 5729 |
| 5730 // Verify the SYN_REPLY. | 5730 // Verify the SYN_REPLY. |
| 5731 // Copy the response info, because trans goes away. | 5731 // Copy the response info, because trans goes away. |
| 5732 response = *trans->GetResponseInfo(); | 5732 response = *trans->GetResponseInfo(); |
| 5733 | 5733 |
| 5734 VerifyStreamsClosed(helper); | 5734 VerifyStreamsClosed(helper); |
| 5735 | 5735 |
| 5736 // Verify the SYN_REPLY. | 5736 // Verify the SYN_REPLY. |
| 5737 EXPECT_TRUE(response.headers.get() != NULL); | 5737 EXPECT_TRUE(response.headers); |
| 5738 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 5738 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 5739 } | 5739 } |
| 5740 } | 5740 } |
| 5741 | 5741 |
| 5742 // Verify that push works cross origin as long as the certificate is valid for | 5742 // Verify that push works cross origin as long as the certificate is valid for |
| 5743 // the pushed authority. | 5743 // the pushed authority. |
| 5744 TEST_P(SpdyNetworkTransactionTest, ServerPushValidCrossOrigin) { | 5744 TEST_P(SpdyNetworkTransactionTest, ServerPushValidCrossOrigin) { |
| 5745 // "spdy_pooling.pem" is valid for both www.example.org and mail.example.org. | 5745 // "spdy_pooling.pem" is valid for both www.example.org and mail.example.org. |
| 5746 const char* url_to_fetch = "https://www.example.org"; | 5746 const char* url_to_fetch = "https://www.example.org"; |
| 5747 const char* url_to_push = "https://mail.example.org"; | 5747 const char* url_to_push = "https://mail.example.org"; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5812 rv = callback1.GetResult(rv); | 5812 rv = callback1.GetResult(rv); |
| 5813 EXPECT_EQ(OK, rv); | 5813 EXPECT_EQ(OK, rv); |
| 5814 | 5814 |
| 5815 EXPECT_TRUE(spdy_session->unclaimed_pushed_streams_.empty()); | 5815 EXPECT_TRUE(spdy_session->unclaimed_pushed_streams_.empty()); |
| 5816 EXPECT_EQ(0u, spdy_session->unclaimed_pushed_streams_.size()); | 5816 EXPECT_EQ(0u, spdy_session->unclaimed_pushed_streams_.size()); |
| 5817 | 5817 |
| 5818 helper.VerifyDataConsumed(); | 5818 helper.VerifyDataConsumed(); |
| 5819 VerifyStreamsClosed(helper); | 5819 VerifyStreamsClosed(helper); |
| 5820 | 5820 |
| 5821 HttpResponseInfo response = *trans0->GetResponseInfo(); | 5821 HttpResponseInfo response = *trans0->GetResponseInfo(); |
| 5822 EXPECT_TRUE(response.headers.get() != nullptr); | 5822 EXPECT_TRUE(response.headers); |
| 5823 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 5823 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 5824 | 5824 |
| 5825 std::string result0; | 5825 std::string result0; |
| 5826 ReadResult(trans0, &result0); | 5826 ReadResult(trans0, &result0); |
| 5827 EXPECT_EQ("hello!", result0); | 5827 EXPECT_EQ("hello!", result0); |
| 5828 | 5828 |
| 5829 HttpResponseInfo push_response = *trans1->GetResponseInfo(); | 5829 HttpResponseInfo push_response = *trans1->GetResponseInfo(); |
| 5830 EXPECT_TRUE(push_response.headers.get() != nullptr); | 5830 EXPECT_TRUE(push_response.headers); |
| 5831 EXPECT_EQ("HTTP/1.1 200", push_response.headers->GetStatusLine()); | 5831 EXPECT_EQ("HTTP/1.1 200", push_response.headers->GetStatusLine()); |
| 5832 | 5832 |
| 5833 std::string result1; | 5833 std::string result1; |
| 5834 ReadResult(trans1.get(), &result1); | 5834 ReadResult(trans1.get(), &result1); |
| 5835 EXPECT_EQ(kPushedData, result1); | 5835 EXPECT_EQ(kPushedData, result1); |
| 5836 } | 5836 } |
| 5837 | 5837 |
| 5838 // Verify that push works cross origin, even if there is already a connection | 5838 // Verify that push works cross origin, even if there is already a connection |
| 5839 // open to origin of pushed resource. | 5839 // open to origin of pushed resource. |
| 5840 TEST_P(SpdyNetworkTransactionTest, ServerPushValidCrossOriginWithOpenSession) { | 5840 TEST_P(SpdyNetworkTransactionTest, ServerPushValidCrossOriginWithOpenSession) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5983 EXPECT_TRUE(spdy_session0->unclaimed_pushed_streams_.empty()); | 5983 EXPECT_TRUE(spdy_session0->unclaimed_pushed_streams_.empty()); |
| 5984 EXPECT_EQ(0u, spdy_session0->unclaimed_pushed_streams_.size()); | 5984 EXPECT_EQ(0u, spdy_session0->unclaimed_pushed_streams_.size()); |
| 5985 | 5985 |
| 5986 EXPECT_TRUE(spdy_session1->unclaimed_pushed_streams_.empty()); | 5986 EXPECT_TRUE(spdy_session1->unclaimed_pushed_streams_.empty()); |
| 5987 EXPECT_EQ(0u, spdy_session1->unclaimed_pushed_streams_.size()); | 5987 EXPECT_EQ(0u, spdy_session1->unclaimed_pushed_streams_.size()); |
| 5988 | 5988 |
| 5989 helper.VerifyDataConsumed(); | 5989 helper.VerifyDataConsumed(); |
| 5990 VerifyStreamsClosed(helper); | 5990 VerifyStreamsClosed(helper); |
| 5991 | 5991 |
| 5992 HttpResponseInfo response0 = *trans0->GetResponseInfo(); | 5992 HttpResponseInfo response0 = *trans0->GetResponseInfo(); |
| 5993 EXPECT_TRUE(response0.headers.get() != nullptr); | 5993 EXPECT_TRUE(response0.headers); |
| 5994 EXPECT_EQ("HTTP/1.1 200", response0.headers->GetStatusLine()); | 5994 EXPECT_EQ("HTTP/1.1 200", response0.headers->GetStatusLine()); |
| 5995 | 5995 |
| 5996 std::string result0; | 5996 std::string result0; |
| 5997 ReadResult(trans0, &result0); | 5997 ReadResult(trans0, &result0); |
| 5998 EXPECT_EQ(kData0, result0); | 5998 EXPECT_EQ(kData0, result0); |
| 5999 | 5999 |
| 6000 HttpResponseInfo response1 = *trans1->GetResponseInfo(); | 6000 HttpResponseInfo response1 = *trans1->GetResponseInfo(); |
| 6001 EXPECT_TRUE(response1.headers.get() != nullptr); | 6001 EXPECT_TRUE(response1.headers); |
| 6002 EXPECT_EQ("HTTP/1.1 200", response1.headers->GetStatusLine()); | 6002 EXPECT_EQ("HTTP/1.1 200", response1.headers->GetStatusLine()); |
| 6003 | 6003 |
| 6004 std::string result1; | 6004 std::string result1; |
| 6005 ReadResult(trans1.get(), &result1); | 6005 ReadResult(trans1.get(), &result1); |
| 6006 EXPECT_EQ(kData1, result1); | 6006 EXPECT_EQ(kData1, result1); |
| 6007 | 6007 |
| 6008 HttpResponseInfo push_response = *trans2->GetResponseInfo(); | 6008 HttpResponseInfo push_response = *trans2->GetResponseInfo(); |
| 6009 EXPECT_TRUE(push_response.headers.get() != nullptr); | 6009 EXPECT_TRUE(push_response.headers); |
| 6010 EXPECT_EQ("HTTP/1.1 200", push_response.headers->GetStatusLine()); | 6010 EXPECT_EQ("HTTP/1.1 200", push_response.headers->GetStatusLine()); |
| 6011 | 6011 |
| 6012 std::string result2; | 6012 std::string result2; |
| 6013 ReadResult(trans2.get(), &result2); | 6013 ReadResult(trans2.get(), &result2); |
| 6014 EXPECT_EQ(kPushedData, result2); | 6014 EXPECT_EQ(kPushedData, result2); |
| 6015 } | 6015 } |
| 6016 | 6016 |
| 6017 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidCrossOrigin) { | 6017 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidCrossOrigin) { |
| 6018 // "spdy_pooling.pem" is valid for www.example.org, | 6018 // "spdy_pooling.pem" is valid for www.example.org, |
| 6019 // but not for invalid.example.org. | 6019 // but not for invalid.example.org. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6103 EXPECT_EQ(ERR_IO_PENDING, rv); | 6103 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6104 rv = callback.WaitForResult(); | 6104 rv = callback.WaitForResult(); |
| 6105 EXPECT_EQ(OK, rv); | 6105 EXPECT_EQ(OK, rv); |
| 6106 | 6106 |
| 6107 // Verify that we consumed all test data. | 6107 // Verify that we consumed all test data. |
| 6108 EXPECT_TRUE(data.AllReadDataConsumed()); | 6108 EXPECT_TRUE(data.AllReadDataConsumed()); |
| 6109 EXPECT_TRUE(data.AllWriteDataConsumed()); | 6109 EXPECT_TRUE(data.AllWriteDataConsumed()); |
| 6110 | 6110 |
| 6111 // Verify the SYN_REPLY. | 6111 // Verify the SYN_REPLY. |
| 6112 HttpResponseInfo response = *trans->GetResponseInfo(); | 6112 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 6113 EXPECT_TRUE(response.headers.get() != NULL); | 6113 EXPECT_TRUE(response.headers); |
| 6114 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 6114 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 6115 } | 6115 } |
| 6116 | 6116 |
| 6117 TEST_P(SpdyNetworkTransactionTest, OutOfOrderSynStream) { | 6117 TEST_P(SpdyNetworkTransactionTest, OutOfOrderSynStream) { |
| 6118 // This first request will start to establish the SpdySession. | 6118 // This first request will start to establish the SpdySession. |
| 6119 // Then we will start the second (MEDIUM priority) and then third | 6119 // Then we will start the second (MEDIUM priority) and then third |
| 6120 // (HIGHEST priority) request in such a way that the third will actually | 6120 // (HIGHEST priority) request in such a way that the third will actually |
| 6121 // start before the second, causing the second to be numbered differently | 6121 // start before the second, causing the second to be numbered differently |
| 6122 // than the order they were created. | 6122 // than the order they were created. |
| 6123 // | 6123 // |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6299 | 6299 |
| 6300 TestCompletionCallback callback; | 6300 TestCompletionCallback callback; |
| 6301 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6301 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
| 6302 | 6302 |
| 6303 EXPECT_EQ(ERR_IO_PENDING, rv); | 6303 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6304 | 6304 |
| 6305 data.RunUntilPaused(); | 6305 data.RunUntilPaused(); |
| 6306 base::RunLoop().RunUntilIdle(); | 6306 base::RunLoop().RunUntilIdle(); |
| 6307 | 6307 |
| 6308 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 6308 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 6309 ASSERT_TRUE(stream != NULL); | 6309 ASSERT_TRUE(stream); |
| 6310 ASSERT_TRUE(stream->stream() != NULL); | 6310 ASSERT_TRUE(stream->stream()); |
| 6311 EXPECT_EQ(static_cast<int>( | 6311 EXPECT_EQ(static_cast<int>( |
| 6312 SpdySession::GetDefaultInitialWindowSize(GetParam().protocol)) + | 6312 SpdySession::GetDefaultInitialWindowSize(GetParam().protocol)) + |
| 6313 kDeltaWindowSize * kDeltaCount - | 6313 kDeltaWindowSize * kDeltaCount - |
| 6314 kMaxSpdyFrameChunkSize * kFrameCount, | 6314 kMaxSpdyFrameChunkSize * kFrameCount, |
| 6315 stream->stream()->send_window_size()); | 6315 stream->stream()->send_window_size()); |
| 6316 | 6316 |
| 6317 data.Resume(); | 6317 data.Resume(); |
| 6318 base::RunLoop().RunUntilIdle(); | 6318 base::RunLoop().RunUntilIdle(); |
| 6319 | 6319 |
| 6320 rv = callback.WaitForResult(); | 6320 rv = callback.WaitForResult(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6423 HttpNetworkTransaction* trans = helper.trans(); | 6423 HttpNetworkTransaction* trans = helper.trans(); |
| 6424 TestCompletionCallback callback; | 6424 TestCompletionCallback callback; |
| 6425 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6425 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
| 6426 | 6426 |
| 6427 EXPECT_EQ(ERR_IO_PENDING, rv); | 6427 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6428 rv = callback.WaitForResult(); | 6428 rv = callback.WaitForResult(); |
| 6429 EXPECT_EQ(OK, rv); | 6429 EXPECT_EQ(OK, rv); |
| 6430 | 6430 |
| 6431 SpdyHttpStream* stream = | 6431 SpdyHttpStream* stream = |
| 6432 static_cast<SpdyHttpStream*>(trans->stream_.get()); | 6432 static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 6433 ASSERT_TRUE(stream != NULL); | 6433 ASSERT_TRUE(stream); |
| 6434 ASSERT_TRUE(stream->stream() != NULL); | 6434 ASSERT_TRUE(stream->stream()); |
| 6435 | 6435 |
| 6436 // All data has been read, but not consumed. The window reflects this. | 6436 // All data has been read, but not consumed. The window reflects this. |
| 6437 EXPECT_EQ(static_cast<int>(stream_max_recv_window_size - kTargetSize), | 6437 EXPECT_EQ(static_cast<int>(stream_max_recv_window_size - kTargetSize), |
| 6438 stream->stream()->recv_window_size()); | 6438 stream->stream()->recv_window_size()); |
| 6439 | 6439 |
| 6440 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6440 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6441 ASSERT_TRUE(response != NULL); | 6441 ASSERT_TRUE(response); |
| 6442 ASSERT_TRUE(response->headers.get() != NULL); | 6442 ASSERT_TRUE(response->headers); |
| 6443 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 6443 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
| 6444 EXPECT_TRUE(response->was_fetched_via_spdy); | 6444 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 6445 | 6445 |
| 6446 // Issue a read which will cause a WINDOW_UPDATE to be sent and window | 6446 // Issue a read which will cause a WINDOW_UPDATE to be sent and window |
| 6447 // size increased to default. | 6447 // size increased to default. |
| 6448 scoped_refptr<IOBuffer> buf(new IOBuffer(kTargetSize)); | 6448 scoped_refptr<IOBuffer> buf(new IOBuffer(kTargetSize)); |
| 6449 EXPECT_EQ(static_cast<int>(kTargetSize), | 6449 EXPECT_EQ(static_cast<int>(kTargetSize), |
| 6450 trans->Read(buf.get(), kTargetSize, CompletionCallback())); | 6450 trans->Read(buf.get(), kTargetSize, CompletionCallback())); |
| 6451 EXPECT_EQ(static_cast<int>(stream_max_recv_window_size), | 6451 EXPECT_EQ(static_cast<int>(stream_max_recv_window_size), |
| 6452 stream->stream()->recv_window_size()); | 6452 stream->stream()->recv_window_size()); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6652 | 6652 |
| 6653 HttpNetworkTransaction* trans = helper.trans(); | 6653 HttpNetworkTransaction* trans = helper.trans(); |
| 6654 | 6654 |
| 6655 TestCompletionCallback callback; | 6655 TestCompletionCallback callback; |
| 6656 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6656 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
| 6657 EXPECT_EQ(ERR_IO_PENDING, rv); | 6657 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6658 | 6658 |
| 6659 base::RunLoop().RunUntilIdle(); // Write as much as we can. | 6659 base::RunLoop().RunUntilIdle(); // Write as much as we can. |
| 6660 | 6660 |
| 6661 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 6661 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 6662 ASSERT_TRUE(stream != NULL); | 6662 ASSERT_TRUE(stream); |
| 6663 ASSERT_TRUE(stream->stream() != NULL); | 6663 ASSERT_TRUE(stream->stream()); |
| 6664 EXPECT_EQ(0, stream->stream()->send_window_size()); | 6664 EXPECT_EQ(0, stream->stream()->send_window_size()); |
| 6665 if (initial_window_size % kBufferSize != 0) { | 6665 if (initial_window_size % kBufferSize != 0) { |
| 6666 // If it does not take whole number of full upload buffer to zero out | 6666 // If it does not take whole number of full upload buffer to zero out |
| 6667 // initial window size, then the upload data is not at EOF, because the | 6667 // initial window size, then the upload data is not at EOF, because the |
| 6668 // last read must be stalled. | 6668 // last read must be stalled. |
| 6669 EXPECT_FALSE(upload_data_stream.IsEOF()); | 6669 EXPECT_FALSE(upload_data_stream.IsEOF()); |
| 6670 } else { | 6670 } else { |
| 6671 // All the body data should have been read. | 6671 // All the body data should have been read. |
| 6672 // TODO(satorux): This is because of the weirdness in reading the request | 6672 // TODO(satorux): This is because of the weirdness in reading the request |
| 6673 // body in OnSendBodyComplete(). See crbug.com/113107. | 6673 // body in OnSendBodyComplete(). See crbug.com/113107. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6812 HttpNetworkTransaction* trans = helper.trans(); | 6812 HttpNetworkTransaction* trans = helper.trans(); |
| 6813 | 6813 |
| 6814 TestCompletionCallback callback; | 6814 TestCompletionCallback callback; |
| 6815 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6815 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
| 6816 EXPECT_EQ(ERR_IO_PENDING, rv); | 6816 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6817 | 6817 |
| 6818 data.RunUntilPaused(); // Write as much as we can. | 6818 data.RunUntilPaused(); // Write as much as we can. |
| 6819 base::RunLoop().RunUntilIdle(); | 6819 base::RunLoop().RunUntilIdle(); |
| 6820 | 6820 |
| 6821 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 6821 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 6822 ASSERT_TRUE(stream != NULL); | 6822 ASSERT_TRUE(stream); |
| 6823 ASSERT_TRUE(stream->stream() != NULL); | 6823 ASSERT_TRUE(stream->stream()); |
| 6824 EXPECT_EQ(0, stream->stream()->send_window_size()); | 6824 EXPECT_EQ(0, stream->stream()->send_window_size()); |
| 6825 | 6825 |
| 6826 if (initial_window_size % kBufferSize != 0) { | 6826 if (initial_window_size % kBufferSize != 0) { |
| 6827 // If it does not take whole number of full upload buffer to zero out | 6827 // If it does not take whole number of full upload buffer to zero out |
| 6828 // initial window size, then the upload data is not at EOF, because the | 6828 // initial window size, then the upload data is not at EOF, because the |
| 6829 // last read must be stalled. | 6829 // last read must be stalled. |
| 6830 EXPECT_FALSE(upload_data_stream.IsEOF()); | 6830 EXPECT_FALSE(upload_data_stream.IsEOF()); |
| 6831 } else { | 6831 } else { |
| 6832 // All the body data should have been read. | 6832 // All the body data should have been read. |
| 6833 // TODO(satorux): This is because of the weirdness in reading the request | 6833 // TODO(satorux): This is because of the weirdness in reading the request |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6980 HttpNetworkTransaction* trans = helper.trans(); | 6980 HttpNetworkTransaction* trans = helper.trans(); |
| 6981 | 6981 |
| 6982 TestCompletionCallback callback; | 6982 TestCompletionCallback callback; |
| 6983 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); | 6983 int rv = trans->Start(&helper.request(), callback.callback(), BoundNetLog()); |
| 6984 EXPECT_EQ(ERR_IO_PENDING, rv); | 6984 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6985 | 6985 |
| 6986 data.RunUntilPaused(); // Write as much as we can. | 6986 data.RunUntilPaused(); // Write as much as we can. |
| 6987 base::RunLoop().RunUntilIdle(); | 6987 base::RunLoop().RunUntilIdle(); |
| 6988 | 6988 |
| 6989 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); | 6989 SpdyHttpStream* stream = static_cast<SpdyHttpStream*>(trans->stream_.get()); |
| 6990 ASSERT_TRUE(stream != NULL); | 6990 ASSERT_TRUE(stream); |
| 6991 ASSERT_TRUE(stream->stream() != NULL); | 6991 ASSERT_TRUE(stream->stream()); |
| 6992 EXPECT_EQ(0, stream->stream()->send_window_size()); | 6992 EXPECT_EQ(0, stream->stream()->send_window_size()); |
| 6993 | 6993 |
| 6994 if (initial_window_size % kBufferSize != 0) { | 6994 if (initial_window_size % kBufferSize != 0) { |
| 6995 // If it does not take whole number of full upload buffer to zero out | 6995 // If it does not take whole number of full upload buffer to zero out |
| 6996 // initial window size, then the upload data is not at EOF, because the | 6996 // initial window size, then the upload data is not at EOF, because the |
| 6997 // last read must be stalled. | 6997 // last read must be stalled. |
| 6998 EXPECT_FALSE(upload_data_stream.IsEOF()); | 6998 EXPECT_FALSE(upload_data_stream.IsEOF()); |
| 6999 } else { | 6999 } else { |
| 7000 // All the body data should have been read. | 7000 // All the body data should have been read. |
| 7001 // TODO(satorux): This is because of the weirdness in reading the request | 7001 // TODO(satorux): This is because of the weirdness in reading the request |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7257 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 7257 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 7258 std::unique_ptr<SSLSocketDataProvider> ssl_provider( | 7258 std::unique_ptr<SSLSocketDataProvider> ssl_provider( |
| 7259 new SSLSocketDataProvider(ASYNC, OK)); | 7259 new SSLSocketDataProvider(ASYNC, OK)); |
| 7260 // Set to TLS_RSA_WITH_NULL_MD5 | 7260 // Set to TLS_RSA_WITH_NULL_MD5 |
| 7261 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 7261 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 7262 | 7262 |
| 7263 RunTLSUsageCheckTest(std::move(ssl_provider)); | 7263 RunTLSUsageCheckTest(std::move(ssl_provider)); |
| 7264 } | 7264 } |
| 7265 | 7265 |
| 7266 } // namespace net | 7266 } // namespace net |
| OLD | NEW |