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 <memory> | 5 #include <memory> |
6 #include <ostream> | 6 #include <ostream> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 session_->quic_stream_factory()->socket_receive_buffer_size()); | 483 session_->quic_stream_factory()->socket_receive_buffer_size()); |
484 } | 484 } |
485 | 485 |
486 void CheckWasQuicResponse(HttpNetworkTransaction* trans) { | 486 void CheckWasQuicResponse(HttpNetworkTransaction* trans) { |
487 const HttpResponseInfo* response = trans->GetResponseInfo(); | 487 const HttpResponseInfo* response = trans->GetResponseInfo(); |
488 ASSERT_TRUE(response != nullptr); | 488 ASSERT_TRUE(response != nullptr); |
489 ASSERT_TRUE(response->headers.get() != nullptr); | 489 ASSERT_TRUE(response->headers.get() != nullptr); |
490 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 490 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
491 EXPECT_TRUE(response->was_fetched_via_spdy); | 491 EXPECT_TRUE(response->was_fetched_via_spdy); |
492 EXPECT_TRUE(response->was_alpn_negotiated); | 492 EXPECT_TRUE(response->was_alpn_negotiated); |
493 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, | 493 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC, |
494 response->connection_info); | 494 response->connection_info); |
495 } | 495 } |
496 | 496 |
497 void CheckResponsePort(HttpNetworkTransaction* trans, uint16_t port) { | 497 void CheckResponsePort(HttpNetworkTransaction* trans, uint16_t port) { |
498 const HttpResponseInfo* response = trans->GetResponseInfo(); | 498 const HttpResponseInfo* response = trans->GetResponseInfo(); |
499 ASSERT_TRUE(response != nullptr); | 499 ASSERT_TRUE(response != nullptr); |
500 EXPECT_EQ(port, response->socket_address.port()); | 500 EXPECT_EQ(port, response->socket_address.port()); |
501 } | 501 } |
502 | 502 |
503 void CheckWasHttpResponse(HttpNetworkTransaction* trans) { | 503 void CheckWasHttpResponse(HttpNetworkTransaction* trans) { |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 QuicSession::HANDSHAKE_CONFIRMED); | 2097 QuicSession::HANDSHAKE_CONFIRMED); |
2098 // Read the headers. | 2098 // Read the headers. |
2099 EXPECT_THAT(callback.WaitForResult(), IsOk()); | 2099 EXPECT_THAT(callback.WaitForResult(), IsOk()); |
2100 | 2100 |
2101 const HttpResponseInfo* response = trans.GetResponseInfo(); | 2101 const HttpResponseInfo* response = trans.GetResponseInfo(); |
2102 ASSERT_TRUE(response != nullptr); | 2102 ASSERT_TRUE(response != nullptr); |
2103 ASSERT_TRUE(response->headers.get() != nullptr); | 2103 ASSERT_TRUE(response->headers.get() != nullptr); |
2104 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 2104 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
2105 EXPECT_TRUE(response->was_fetched_via_spdy); | 2105 EXPECT_TRUE(response->was_fetched_via_spdy); |
2106 EXPECT_TRUE(response->was_alpn_negotiated); | 2106 EXPECT_TRUE(response->was_alpn_negotiated); |
2107 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, | 2107 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC, response->connection_info); |
2108 response->connection_info); | |
2109 | 2108 |
2110 std::string response_data; | 2109 std::string response_data; |
2111 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, ReadTransaction(&trans, &response_data)); | 2110 ASSERT_EQ(ERR_QUIC_PROTOCOL_ERROR, ReadTransaction(&trans, &response_data)); |
2112 } | 2111 } |
2113 | 2112 |
2114 TEST_P(QuicNetworkTransactionTest, RstSteamBeforeHeaders) { | 2113 TEST_P(QuicNetworkTransactionTest, RstSteamBeforeHeaders) { |
2115 MockQuicData mock_quic_data; | 2114 MockQuicData mock_quic_data; |
2116 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( | 2115 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( |
2117 1, kClientDataStreamId1, true, true, | 2116 1, kClientDataStreamId1, true, true, |
2118 GetRequestHeaders("GET", "https", "/"))); | 2117 GetRequestHeaders("GET", "https", "/"))); |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 std::string response_data; | 3045 std::string response_data; |
3047 ASSERT_THAT(ReadTransaction(&trans, &response_data), IsOk()); | 3046 ASSERT_THAT(ReadTransaction(&trans, &response_data), IsOk()); |
3048 EXPECT_EQ("hello", response_data); | 3047 EXPECT_EQ("hello", response_data); |
3049 | 3048 |
3050 const HttpResponseInfo* response = trans.GetResponseInfo(); | 3049 const HttpResponseInfo* response = trans.GetResponseInfo(); |
3051 ASSERT_TRUE(response != nullptr); | 3050 ASSERT_TRUE(response != nullptr); |
3052 ASSERT_TRUE(response->headers.get() != nullptr); | 3051 ASSERT_TRUE(response->headers.get() != nullptr); |
3053 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 3052 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
3054 EXPECT_TRUE(response->was_fetched_via_spdy); | 3053 EXPECT_TRUE(response->was_fetched_via_spdy); |
3055 EXPECT_TRUE(response->was_alpn_negotiated); | 3054 EXPECT_TRUE(response->was_alpn_negotiated); |
3056 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3, | 3055 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_QUIC, |
3057 response->connection_info); | 3056 response->connection_info); |
3058 EXPECT_EQ(443, response->socket_address.port()); | 3057 EXPECT_EQ(443, response->socket_address.port()); |
3059 } | 3058 } |
3060 | 3059 |
3061 MockClock* clock_; | 3060 MockClock* clock_; |
3062 QuicVersion version_; | 3061 QuicVersion version_; |
3063 DestinationType destination_type_; | 3062 DestinationType destination_type_; |
3064 std::string origin1_; | 3063 std::string origin1_; |
3065 std::string origin2_; | 3064 std::string origin2_; |
3066 std::unique_ptr<HttpNetworkSession> session_; | 3065 std::unique_ptr<HttpNetworkSession> session_; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3274 AddHangingSocketData(); | 3273 AddHangingSocketData(); |
3275 | 3274 |
3276 SendRequestAndExpectQuicResponse(origin1_); | 3275 SendRequestAndExpectQuicResponse(origin1_); |
3277 SendRequestAndExpectQuicResponse(origin2_); | 3276 SendRequestAndExpectQuicResponse(origin2_); |
3278 | 3277 |
3279 EXPECT_TRUE(AllDataConsumed()); | 3278 EXPECT_TRUE(AllDataConsumed()); |
3280 } | 3279 } |
3281 | 3280 |
3282 } // namespace test | 3281 } // namespace test |
3283 } // namespace net | 3282 } // namespace net |
OLD | NEW |