| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <sys/epoll.h> | 6 #include <sys/epoll.h> |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <ostream> | 11 #include <ostream> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "net/base/ip_address.h" | 20 #include "net/base/ip_address.h" |
| 21 #include "net/base/ip_endpoint.h" | 21 #include "net/base/ip_endpoint.h" |
| 22 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" | 22 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" |
| 23 #include "net/quic/core/crypto/null_encrypter.h" | 23 #include "net/quic/core/crypto/null_encrypter.h" |
| 24 #include "net/quic/core/quic_client_session_base.h" | 24 #include "net/quic/core/quic_client_session_base.h" |
| 25 #include "net/quic/core/quic_flags.h" | |
| 26 #include "net/quic/core/quic_framer.h" | 25 #include "net/quic/core/quic_framer.h" |
| 27 #include "net/quic/core/quic_packet_creator.h" | 26 #include "net/quic/core/quic_packet_creator.h" |
| 28 #include "net/quic/core/quic_packets.h" | 27 #include "net/quic/core/quic_packets.h" |
| 29 #include "net/quic/core/quic_server_id.h" | 28 #include "net/quic/core/quic_server_id.h" |
| 30 #include "net/quic/core/quic_session.h" | 29 #include "net/quic/core/quic_session.h" |
| 31 #include "net/quic/core/quic_utils.h" | 30 #include "net/quic/core/quic_utils.h" |
| 31 #include "net/quic/platform/api/quic_flags.h" |
| 32 #include "net/quic/platform/api/quic_logging.h" | 32 #include "net/quic/platform/api/quic_logging.h" |
| 33 #include "net/quic/platform/api/quic_ptr_util.h" | 33 #include "net/quic/platform/api/quic_ptr_util.h" |
| 34 #include "net/quic/platform/api/quic_socket_address.h" | 34 #include "net/quic/platform/api/quic_socket_address.h" |
| 35 #include "net/quic/platform/api/quic_str_cat.h" | 35 #include "net/quic/platform/api/quic_str_cat.h" |
| 36 #include "net/quic/platform/api/quic_string_piece.h" | 36 #include "net/quic/platform/api/quic_string_piece.h" |
| 37 #include "net/quic/platform/api/quic_text_utils.h" | 37 #include "net/quic/platform/api/quic_text_utils.h" |
| 38 #include "net/quic/test_tools/crypto_test_utils.h" | 38 #include "net/quic/test_tools/crypto_test_utils.h" |
| 39 #include "net/quic/test_tools/quic_config_peer.h" | 39 #include "net/quic/test_tools/quic_config_peer.h" |
| 40 #include "net/quic/test_tools/quic_connection_peer.h" | 40 #include "net/quic/test_tools/quic_connection_peer.h" |
| 41 #include "net/quic/test_tools/quic_flow_controller_peer.h" | 41 #include "net/quic/test_tools/quic_flow_controller_peer.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // layout (for example to change HTTP/2 headers to SPDY/3). So | 146 // layout (for example to change HTTP/2 headers to SPDY/3). So |
| 147 // these tests need to ensure that clients are never attempting | 147 // these tests need to ensure that clients are never attempting |
| 148 // to do 0-RTT across incompatible versions. Chromium only supports | 148 // to do 0-RTT across incompatible versions. Chromium only supports |
| 149 // a single version at a time anyway. :) | 149 // a single version at a time anyway. :) |
| 150 QuicVersionVector all_supported_versions = AllSupportedVersions(); | 150 QuicVersionVector all_supported_versions = AllSupportedVersions(); |
| 151 // Even though this currently has one element, it may well get another | 151 // Even though this currently has one element, it may well get another |
| 152 // with future versions of QUIC, so don't remove it. | 152 // with future versions of QUIC, so don't remove it. |
| 153 QuicVersionVector version_buckets[1]; | 153 QuicVersionVector version_buckets[1]; |
| 154 | 154 |
| 155 for (const QuicVersion version : all_supported_versions) { | 155 for (const QuicVersion version : all_supported_versions) { |
| 156 // Versions: 34+ | 156 // Versions: 35+ |
| 157 // QUIC_VERSION_34 deprecates entropy and uses new ack and stop waiting | 157 // QUIC_VERSION_35 allows endpoints to independently set stream limit. |
| 158 // wire formats. | |
| 159 version_buckets[0].push_back(version); | 158 version_buckets[0].push_back(version); |
| 160 } | 159 } |
| 161 | 160 |
| 162 // This must be kept in sync with the number of nested for-loops below as it | 161 // This must be kept in sync with the number of nested for-loops below as it |
| 163 // is used to prune the number of tests that are run. | 162 // is used to prune the number of tests that are run. |
| 164 const int kMaxEnabledOptions = 7; | 163 const int kMaxEnabledOptions = 7; |
| 165 int max_enabled_options = 0; | 164 int max_enabled_options = 0; |
| 166 std::vector<TestParams> params; | 165 std::vector<TestParams> params; |
| 167 for (bool server_uses_stateless_rejects_if_peer_supported : {true, false}) { | 166 for (bool server_uses_stateless_rejects_if_peer_supported : {true, false}) { |
| 168 for (bool client_supports_stateless_rejects : {true, false}) { | 167 for (bool client_supports_stateless_rejects : {true, false}) { |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 626 |
| 628 // Run all end to end tests with all supported versions. | 627 // Run all end to end tests with all supported versions. |
| 629 INSTANTIATE_TEST_CASE_P(EndToEndTests, | 628 INSTANTIATE_TEST_CASE_P(EndToEndTests, |
| 630 EndToEndTest, | 629 EndToEndTest, |
| 631 ::testing::ValuesIn(GetTestParams())); | 630 ::testing::ValuesIn(GetTestParams())); |
| 632 | 631 |
| 633 TEST_P(EndToEndTest, HandshakeSuccessful) { | 632 TEST_P(EndToEndTest, HandshakeSuccessful) { |
| 634 ASSERT_TRUE(Initialize()); | 633 ASSERT_TRUE(Initialize()); |
| 635 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 634 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 636 QuicCryptoStream* crypto_stream = | 635 QuicCryptoStream* crypto_stream = |
| 637 QuicSessionPeer::GetCryptoStream(client_->client()->session()); | 636 QuicSessionPeer::GetMutableCryptoStream(client_->client()->session()); |
| 638 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(crypto_stream); | 637 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(crypto_stream); |
| 639 EXPECT_NE(FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer, | 638 EXPECT_NE(FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer, |
| 640 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); | 639 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); |
| 641 server_thread_->Pause(); | 640 server_thread_->Pause(); |
| 642 QuicDispatcher* dispatcher = | 641 QuicDispatcher* dispatcher = |
| 643 QuicServerPeer::GetDispatcher(server_thread_->server()); | 642 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 644 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); | 643 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); |
| 645 crypto_stream = QuicSessionPeer::GetCryptoStream(server_session); | 644 crypto_stream = QuicSessionPeer::GetMutableCryptoStream(server_session); |
| 646 sequencer = QuicStreamPeer::sequencer(crypto_stream); | 645 sequencer = QuicStreamPeer::sequencer(crypto_stream); |
| 647 EXPECT_NE(FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer, | 646 EXPECT_NE(FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer, |
| 648 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); | 647 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); |
| 649 } | 648 } |
| 650 | 649 |
| 651 TEST_P(EndToEndTest, SimpleRequestResponsev6) { | 650 TEST_P(EndToEndTest, SimpleRequestResponsev6) { |
| 652 ASSERT_TRUE(Initialize()); | 651 ASSERT_TRUE(Initialize()); |
| 653 | 652 |
| 654 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 653 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 655 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); | 654 EXPECT_EQ("200", client_->response_headers()->find(":status")->second); |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 client_config_.SetIdleNetworkTimeout(QuicTime::Delta::FromMicroseconds(500), | 1271 client_config_.SetIdleNetworkTimeout(QuicTime::Delta::FromMicroseconds(500), |
| 1273 QuicTime::Delta::FromMicroseconds(500)); | 1272 QuicTime::Delta::FromMicroseconds(500)); |
| 1274 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: | 1273 // Note: we do NOT ASSERT_TRUE: we may time out during initial handshake: |
| 1275 // that's enough to validate timeout in this case. | 1274 // that's enough to validate timeout in this case. |
| 1276 Initialize(); | 1275 Initialize(); |
| 1277 while (client_->client()->connected()) { | 1276 while (client_->client()->connected()) { |
| 1278 client_->client()->WaitForEvents(); | 1277 client_->client()->WaitForEvents(); |
| 1279 } | 1278 } |
| 1280 } | 1279 } |
| 1281 | 1280 |
| 1282 TEST_P(EndToEndTest, NegotiateMaxOpenStreams) { | |
| 1283 // Negotiate 1 max open stream. | |
| 1284 client_config_.SetMaxStreamsPerConnection(1, 1); | |
| 1285 ASSERT_TRUE(Initialize()); | |
| 1286 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | |
| 1287 | |
| 1288 if (negotiated_version_ > QUIC_VERSION_34) { | |
| 1289 // Newer versions use max incoming dynamic streams. | |
| 1290 return; | |
| 1291 } | |
| 1292 | |
| 1293 // Make the client misbehave after negotiation. | |
| 1294 const int kServerMaxStreams = kMaxStreamsMinimumIncrement + 1; | |
| 1295 QuicSessionPeer::SetMaxOpenOutgoingStreams(client_->client()->session(), | |
| 1296 kServerMaxStreams + 1); | |
| 1297 | |
| 1298 SpdyHeaderBlock headers; | |
| 1299 headers[":method"] = "POST"; | |
| 1300 headers[":path"] = "/foo"; | |
| 1301 headers[":scheme"] = "https"; | |
| 1302 headers[":authority"] = server_hostname_; | |
| 1303 headers["content-length"] = "3"; | |
| 1304 | |
| 1305 // The server supports a small number of additional streams beyond the | |
| 1306 // negotiated limit. Open enough streams to go beyond that limit. | |
| 1307 for (int i = 0; i < kServerMaxStreams + 1; ++i) { | |
| 1308 client_->SendMessage(headers, "", /*fin=*/false); | |
| 1309 } | |
| 1310 client_->WaitForResponse(); | |
| 1311 | |
| 1312 EXPECT_TRUE(client_->connected()); | |
| 1313 EXPECT_EQ(QUIC_REFUSED_STREAM, client_->stream_error()); | |
| 1314 EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error()); | |
| 1315 } | |
| 1316 | |
| 1317 TEST_P(EndToEndTest, MaxIncomingDynamicStreamsLimitRespected) { | 1281 TEST_P(EndToEndTest, MaxIncomingDynamicStreamsLimitRespected) { |
| 1318 // Set a limit on maximum number of incoming dynamic streams. | 1282 // Set a limit on maximum number of incoming dynamic streams. |
| 1319 // Make sure the limit is respected. | 1283 // Make sure the limit is respected. |
| 1320 const uint32_t kServerMaxIncomingDynamicStreams = 1; | 1284 const uint32_t kServerMaxIncomingDynamicStreams = 1; |
| 1321 server_config_.SetMaxIncomingDynamicStreamsToSend( | 1285 server_config_.SetMaxIncomingDynamicStreamsToSend( |
| 1322 kServerMaxIncomingDynamicStreams); | 1286 kServerMaxIncomingDynamicStreams); |
| 1323 ASSERT_TRUE(Initialize()); | 1287 ASSERT_TRUE(Initialize()); |
| 1324 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 1288 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 1325 | 1289 |
| 1326 if (negotiated_version_ <= QUIC_VERSION_34) { | |
| 1327 // Earlier versions negotiated max open streams. | |
| 1328 return; | |
| 1329 } | |
| 1330 | |
| 1331 // Make the client misbehave after negotiation. | 1290 // Make the client misbehave after negotiation. |
| 1332 const int kServerMaxStreams = | 1291 const int kServerMaxStreams = |
| 1333 kMaxStreamsMinimumIncrement + kServerMaxIncomingDynamicStreams; | 1292 kMaxStreamsMinimumIncrement + kServerMaxIncomingDynamicStreams; |
| 1334 QuicSessionPeer::SetMaxOpenOutgoingStreams(client_->client()->session(), | 1293 QuicSessionPeer::SetMaxOpenOutgoingStreams(client_->client()->session(), |
| 1335 kServerMaxStreams + 1); | 1294 kServerMaxStreams + 1); |
| 1336 | 1295 |
| 1337 SpdyHeaderBlock headers; | 1296 SpdyHeaderBlock headers; |
| 1338 headers[":method"] = "POST"; | 1297 headers[":method"] = "POST"; |
| 1339 headers[":path"] = "/foo"; | 1298 headers[":path"] = "/foo"; |
| 1340 headers[":scheme"] = "https"; | 1299 headers[":scheme"] = "https"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1357 // Each endpoint can set max incoming dynamic streams independently. | 1316 // Each endpoint can set max incoming dynamic streams independently. |
| 1358 const uint32_t kClientMaxIncomingDynamicStreams = 2; | 1317 const uint32_t kClientMaxIncomingDynamicStreams = 2; |
| 1359 const uint32_t kServerMaxIncomingDynamicStreams = 1; | 1318 const uint32_t kServerMaxIncomingDynamicStreams = 1; |
| 1360 client_config_.SetMaxIncomingDynamicStreamsToSend( | 1319 client_config_.SetMaxIncomingDynamicStreamsToSend( |
| 1361 kClientMaxIncomingDynamicStreams); | 1320 kClientMaxIncomingDynamicStreams); |
| 1362 server_config_.SetMaxIncomingDynamicStreamsToSend( | 1321 server_config_.SetMaxIncomingDynamicStreamsToSend( |
| 1363 kServerMaxIncomingDynamicStreams); | 1322 kServerMaxIncomingDynamicStreams); |
| 1364 ASSERT_TRUE(Initialize()); | 1323 ASSERT_TRUE(Initialize()); |
| 1365 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 1324 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 1366 | 1325 |
| 1367 if (negotiated_version_ <= QUIC_VERSION_34) { | |
| 1368 // Earlier versions negotiated max open streams. | |
| 1369 return; | |
| 1370 } | |
| 1371 | |
| 1372 // The client has received the server's limit and vice versa. | 1326 // The client has received the server's limit and vice versa. |
| 1373 EXPECT_EQ(kServerMaxIncomingDynamicStreams, | 1327 EXPECT_EQ(kServerMaxIncomingDynamicStreams, |
| 1374 client_->client()->session()->max_open_outgoing_streams()); | 1328 client_->client()->session()->max_open_outgoing_streams()); |
| 1375 server_thread_->Pause(); | 1329 server_thread_->Pause(); |
| 1376 QuicDispatcher* dispatcher = | 1330 QuicDispatcher* dispatcher = |
| 1377 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1331 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1378 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); | 1332 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); |
| 1379 EXPECT_EQ(kClientMaxIncomingDynamicStreams, | 1333 EXPECT_EQ(kClientMaxIncomingDynamicStreams, |
| 1380 server_session->max_open_outgoing_streams()); | 1334 server_session->max_open_outgoing_streams()); |
| 1381 server_thread_->Resume(); | 1335 server_thread_->Resume(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1402 } | 1356 } |
| 1403 | 1357 |
| 1404 server_thread_->Pause(); | 1358 server_thread_->Pause(); |
| 1405 EXPECT_EQ(expected_congestion_control_type, | 1359 EXPECT_EQ(expected_congestion_control_type, |
| 1406 QuicSentPacketManagerPeer::GetSendAlgorithm( | 1360 QuicSentPacketManagerPeer::GetSendAlgorithm( |
| 1407 *GetSentPacketManagerFromFirstServerSession()) | 1361 *GetSentPacketManagerFromFirstServerSession()) |
| 1408 ->GetCongestionControlType()); | 1362 ->GetCongestionControlType()); |
| 1409 server_thread_->Resume(); | 1363 server_thread_->Resume(); |
| 1410 } | 1364 } |
| 1411 | 1365 |
| 1412 TEST_P(EndToEndTest, LimitMaxOpenStreams) { | |
| 1413 // Server limits the number of max streams to 2. | |
| 1414 server_config_.SetMaxStreamsPerConnection(2, 2); | |
| 1415 // Client tries to negotiate for 10. | |
| 1416 client_config_.SetMaxStreamsPerConnection(10, 5); | |
| 1417 | |
| 1418 ASSERT_TRUE(Initialize()); | |
| 1419 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | |
| 1420 if (negotiated_version_ > QUIC_VERSION_34) { | |
| 1421 // No negotiated max streams beyond version 34. | |
| 1422 return; | |
| 1423 } | |
| 1424 QuicConfig* client_negotiated_config = client_->client()->session()->config(); | |
| 1425 EXPECT_EQ(2u, client_negotiated_config->MaxStreamsPerConnection()); | |
| 1426 } | |
| 1427 | |
| 1428 TEST_P(EndToEndTest, ClientSuggestsRTT) { | 1366 TEST_P(EndToEndTest, ClientSuggestsRTT) { |
| 1429 // Client suggests initial RTT, verify it is used. | 1367 // Client suggests initial RTT, verify it is used. |
| 1430 const uint32_t kInitialRTT = 20000; | 1368 const uint32_t kInitialRTT = 20000; |
| 1431 client_config_.SetInitialRoundTripTimeUsToSend(kInitialRTT); | 1369 client_config_.SetInitialRoundTripTimeUsToSend(kInitialRTT); |
| 1432 | 1370 |
| 1433 ASSERT_TRUE(Initialize()); | 1371 ASSERT_TRUE(Initialize()); |
| 1434 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 1372 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 1435 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1373 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1436 | 1374 |
| 1437 // Pause the server so we can access the server's internals without races. | 1375 // Pause the server so we can access the server's internals without races. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); | 1695 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); |
| 1758 EXPECT_EQ(kClientSessionIFCW, | 1696 EXPECT_EQ(kClientSessionIFCW, |
| 1759 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); | 1697 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); |
| 1760 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( | 1698 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( |
| 1761 session->flow_controller())); | 1699 session->flow_controller())); |
| 1762 server_thread_->Resume(); | 1700 server_thread_->Resume(); |
| 1763 } | 1701 } |
| 1764 | 1702 |
| 1765 // Test negotiation of IFWA connection option. | 1703 // Test negotiation of IFWA connection option. |
| 1766 TEST_P(EndToEndTest, NegotiatedServerInitialFlowControlWindow) { | 1704 TEST_P(EndToEndTest, NegotiatedServerInitialFlowControlWindow) { |
| 1767 FLAGS_quic_reloadable_flag_quic_large_ifw_options = true; | |
| 1768 | |
| 1769 const uint32_t kClientStreamIFCW = 123456; | 1705 const uint32_t kClientStreamIFCW = 123456; |
| 1770 const uint32_t kClientSessionIFCW = 234567; | 1706 const uint32_t kClientSessionIFCW = 234567; |
| 1771 set_client_initial_stream_flow_control_receive_window(kClientStreamIFCW); | 1707 set_client_initial_stream_flow_control_receive_window(kClientStreamIFCW); |
| 1772 set_client_initial_session_flow_control_receive_window(kClientSessionIFCW); | 1708 set_client_initial_session_flow_control_receive_window(kClientSessionIFCW); |
| 1773 | 1709 |
| 1774 uint32_t kServerStreamIFCW = 32 * 1024; | 1710 uint32_t kServerStreamIFCW = 32 * 1024; |
| 1775 uint32_t kServerSessionIFCW = 48 * 1024; | 1711 uint32_t kServerSessionIFCW = 48 * 1024; |
| 1776 set_server_initial_stream_flow_control_receive_window(kServerStreamIFCW); | 1712 set_server_initial_stream_flow_control_receive_window(kServerStreamIFCW); |
| 1777 set_server_initial_session_flow_control_receive_window(kServerSessionIFCW); | 1713 set_server_initial_session_flow_control_receive_window(kServerSessionIFCW); |
| 1778 | 1714 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 | 1757 |
| 1822 ASSERT_TRUE(Initialize()); | 1758 ASSERT_TRUE(Initialize()); |
| 1823 | 1759 |
| 1824 // Wait for crypto handshake to finish. This should have contributed to the | 1760 // Wait for crypto handshake to finish. This should have contributed to the |
| 1825 // crypto stream flow control window, but not affected the session flow | 1761 // crypto stream flow control window, but not affected the session flow |
| 1826 // control window. | 1762 // control window. |
| 1827 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 1763 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 1828 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1764 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1829 | 1765 |
| 1830 QuicCryptoStream* crypto_stream = | 1766 QuicCryptoStream* crypto_stream = |
| 1831 QuicSessionPeer::GetCryptoStream(client_->client()->session()); | 1767 QuicSessionPeer::GetMutableCryptoStream(client_->client()->session()); |
| 1832 EXPECT_LT( | 1768 EXPECT_LT( |
| 1833 QuicFlowControllerPeer::SendWindowSize(crypto_stream->flow_controller()), | 1769 QuicFlowControllerPeer::SendWindowSize(crypto_stream->flow_controller()), |
| 1834 kStreamIFCW); | 1770 kStreamIFCW); |
| 1835 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( | 1771 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( |
| 1836 client_->client()->session()->flow_controller())); | 1772 client_->client()->session()->flow_controller())); |
| 1837 | 1773 |
| 1838 // Send a request with no body, and verify that the connection level window | 1774 // Send a request with no body, and verify that the connection level window |
| 1839 // has not been affected. | 1775 // has not been affected. |
| 1840 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1776 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1841 | 1777 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1872 | 1808 |
| 1873 server_thread_->Pause(); | 1809 server_thread_->Pause(); |
| 1874 QuicSpdySession* const client_session = client_->client()->session(); | 1810 QuicSpdySession* const client_session = client_->client()->session(); |
| 1875 QuicDispatcher* dispatcher = | 1811 QuicDispatcher* dispatcher = |
| 1876 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1812 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1877 auto* server_session = static_cast<QuicSpdySession*>( | 1813 auto* server_session = static_cast<QuicSpdySession*>( |
| 1878 dispatcher->session_map().begin()->second.get()); | 1814 dispatcher->session_map().begin()->second.get()); |
| 1879 ExpectFlowControlsSynced(client_session->flow_controller(), | 1815 ExpectFlowControlsSynced(client_session->flow_controller(), |
| 1880 server_session->flow_controller()); | 1816 server_session->flow_controller()); |
| 1881 ExpectFlowControlsSynced( | 1817 ExpectFlowControlsSynced( |
| 1882 QuicSessionPeer::GetCryptoStream(client_session)->flow_controller(), | 1818 QuicSessionPeer::GetMutableCryptoStream(client_session) |
| 1883 QuicSessionPeer::GetCryptoStream(server_session)->flow_controller()); | 1819 ->flow_controller(), |
| 1820 QuicSessionPeer::GetMutableCryptoStream(server_session) |
| 1821 ->flow_controller()); |
| 1884 SpdyFramer spdy_framer(SpdyFramer::ENABLE_COMPRESSION); | 1822 SpdyFramer spdy_framer(SpdyFramer::ENABLE_COMPRESSION); |
| 1885 SpdySettingsIR settings_frame; | 1823 SpdySettingsIR settings_frame; |
| 1886 settings_frame.AddSetting(SETTINGS_MAX_HEADER_LIST_SIZE, | 1824 settings_frame.AddSetting(SETTINGS_MAX_HEADER_LIST_SIZE, |
| 1887 kDefaultMaxUncompressedHeaderSize); | 1825 kDefaultMaxUncompressedHeaderSize); |
| 1888 SpdySerializedFrame frame(spdy_framer.SerializeFrame(settings_frame)); | 1826 SpdySerializedFrame frame(spdy_framer.SerializeFrame(settings_frame)); |
| 1889 QuicFlowController* client_header_stream_flow_controller = | 1827 QuicFlowController* client_header_stream_flow_controller = |
| 1890 QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(); | 1828 QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(); |
| 1891 QuicFlowController* server_header_stream_flow_controller = | 1829 QuicFlowController* server_header_stream_flow_controller = |
| 1892 QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller(); | 1830 QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller(); |
| 1893 if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { | 1831 if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 client_->WaitForResponse(); | 3070 client_->WaitForResponse(); |
| 3133 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3071 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 3134 QuicConnectionStats client_stats = | 3072 QuicConnectionStats client_stats = |
| 3135 client_->client()->session()->connection()->GetStats(); | 3073 client_->client()->session()->connection()->GetStats(); |
| 3136 EXPECT_EQ(0u, client_stats.packets_lost); | 3074 EXPECT_EQ(0u, client_stats.packets_lost); |
| 3137 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3075 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 3138 } | 3076 } |
| 3139 } // namespace | 3077 } // namespace |
| 3140 } // namespace test | 3078 } // namespace test |
| 3141 } // namespace net | 3079 } // namespace net |
| OLD | NEW |