| 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 <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 CHECK(server_thread_.get() == nullptr); | 406 CHECK(server_thread_.get() == nullptr); |
| 407 DVLOG(1) << "Setting server initial session flow control window: " | 407 DVLOG(1) << "Setting server initial session flow control window: " |
| 408 << window; | 408 << window; |
| 409 server_config_.SetInitialSessionFlowControlWindowToSend(window); | 409 server_config_.SetInitialSessionFlowControlWindowToSend(window); |
| 410 } | 410 } |
| 411 | 411 |
| 412 const QuicSentPacketManagerInterface* | 412 const QuicSentPacketManagerInterface* |
| 413 GetSentPacketManagerFromFirstServerSession() const { | 413 GetSentPacketManagerFromFirstServerSession() const { |
| 414 QuicDispatcher* dispatcher = | 414 QuicDispatcher* dispatcher = |
| 415 QuicServerPeer::GetDispatcher(server_thread_->server()); | 415 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 416 QuicSession* session = dispatcher->session_map().begin()->second; | 416 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 417 return &session->connection()->sent_packet_manager(); | 417 return &session->connection()->sent_packet_manager(); |
| 418 } | 418 } |
| 419 | 419 |
| 420 bool Initialize() { | 420 bool Initialize() { |
| 421 QuicTagVector copt; | 421 QuicTagVector copt; |
| 422 server_config_.SetConnectionOptionsToSend(copt); | 422 server_config_.SetConnectionOptionsToSend(copt); |
| 423 | 423 |
| 424 // TODO(nimia): Consider setting the congestion control algorithm for the | 424 // TODO(nimia): Consider setting the congestion control algorithm for the |
| 425 // client as well according to the test parameter. | 425 // client as well according to the test parameter. |
| 426 copt.push_back(GetParam().congestion_control_tag); | 426 copt.push_back(GetParam().congestion_control_tag); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 client_->client()->session()->GetNumSentClientHellos() > 0) | 567 client_->client()->session()->GetNumSentClientHellos() > 0) |
| 568 ? 1 | 568 ? 1 |
| 569 : 0; | 569 : 0; |
| 570 EXPECT_EQ(num_expected_stateless_rejects, | 570 EXPECT_EQ(num_expected_stateless_rejects, |
| 571 client_->client()->num_stateless_rejects_received()); | 571 client_->client()->num_stateless_rejects_received()); |
| 572 | 572 |
| 573 server_thread_->Pause(); | 573 server_thread_->Pause(); |
| 574 QuicDispatcher* dispatcher = | 574 QuicDispatcher* dispatcher = |
| 575 QuicServerPeer::GetDispatcher(server_thread_->server()); | 575 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 576 ASSERT_EQ(1u, dispatcher->session_map().size()); | 576 ASSERT_EQ(1u, dispatcher->session_map().size()); |
| 577 QuicSession* session = dispatcher->session_map().begin()->second; | 577 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 578 QuicConnectionStats server_stats = session->connection()->GetStats(); | 578 QuicConnectionStats server_stats = session->connection()->GetStats(); |
| 579 if (!had_packet_loss) { | 579 if (!had_packet_loss) { |
| 580 EXPECT_EQ(0u, server_stats.packets_lost); | 580 EXPECT_EQ(0u, server_stats.packets_lost); |
| 581 } | 581 } |
| 582 EXPECT_EQ(0u, server_stats.packets_discarded); | 582 EXPECT_EQ(0u, server_stats.packets_discarded); |
| 583 // TODO(ianswett): Restore the check for packets_dropped equals 0. | 583 // TODO(ianswett): Restore the check for packets_dropped equals 0. |
| 584 // The expect for packets received is equal to packets processed fails | 584 // The expect for packets received is equal to packets processed fails |
| 585 // due to version negotiation packets. | 585 // due to version negotiation packets. |
| 586 server_thread_->Resume(); | 586 server_thread_->Resume(); |
| 587 } | 587 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 QuicCryptoStream* crypto_stream = | 636 QuicCryptoStream* crypto_stream = |
| 637 QuicSessionPeer::GetCryptoStream(client_->client()->session()); | 637 QuicSessionPeer::GetCryptoStream(client_->client()->session()); |
| 638 QuicStreamSequencer* sequencer = | 638 QuicStreamSequencer* sequencer = |
| 639 ReliableQuicStreamPeer::sequencer(crypto_stream); | 639 ReliableQuicStreamPeer::sequencer(crypto_stream); |
| 640 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && | 640 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && |
| 641 FLAGS_quic_reduce_sequencer_buffer_memory_life_time, | 641 FLAGS_quic_reduce_sequencer_buffer_memory_life_time, |
| 642 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); | 642 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); |
| 643 server_thread_->Pause(); | 643 server_thread_->Pause(); |
| 644 QuicDispatcher* dispatcher = | 644 QuicDispatcher* dispatcher = |
| 645 QuicServerPeer::GetDispatcher(server_thread_->server()); | 645 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 646 QuicSession* server_session = dispatcher->session_map().begin()->second; | 646 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); |
| 647 crypto_stream = QuicSessionPeer::GetCryptoStream(server_session); | 647 crypto_stream = QuicSessionPeer::GetCryptoStream(server_session); |
| 648 sequencer = ReliableQuicStreamPeer::sequencer(crypto_stream); | 648 sequencer = ReliableQuicStreamPeer::sequencer(crypto_stream); |
| 649 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && | 649 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && |
| 650 FLAGS_quic_reduce_sequencer_buffer_memory_life_time, | 650 FLAGS_quic_reduce_sequencer_buffer_memory_life_time, |
| 651 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); | 651 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); |
| 652 } | 652 } |
| 653 | 653 |
| 654 TEST_P(EndToEndTest, SimpleRequestResponse) { | 654 TEST_P(EndToEndTest, SimpleRequestResponse) { |
| 655 ASSERT_TRUE(Initialize()); | 655 ASSERT_TRUE(Initialize()); |
| 656 | 656 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 // Earlier versions negotiated max open streams. | 1350 // Earlier versions negotiated max open streams. |
| 1351 return; | 1351 return; |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 // The client has received the server's limit and vice versa. | 1354 // The client has received the server's limit and vice versa. |
| 1355 EXPECT_EQ(kServerMaxIncomingDynamicStreams, | 1355 EXPECT_EQ(kServerMaxIncomingDynamicStreams, |
| 1356 client_->client()->session()->max_open_outgoing_streams()); | 1356 client_->client()->session()->max_open_outgoing_streams()); |
| 1357 server_thread_->Pause(); | 1357 server_thread_->Pause(); |
| 1358 QuicDispatcher* dispatcher = | 1358 QuicDispatcher* dispatcher = |
| 1359 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1359 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1360 QuicSession* server_session = dispatcher->session_map().begin()->second; | 1360 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); |
| 1361 EXPECT_EQ(kClientMaxIncomingDynamicStreams, | 1361 EXPECT_EQ(kClientMaxIncomingDynamicStreams, |
| 1362 server_session->max_open_outgoing_streams()); | 1362 server_session->max_open_outgoing_streams()); |
| 1363 server_thread_->Resume(); | 1363 server_thread_->Resume(); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 TEST_P(EndToEndTest, NegotiateCongestionControl) { | 1366 TEST_P(EndToEndTest, NegotiateCongestionControl) { |
| 1367 FLAGS_quic_allow_new_bbr = true; | 1367 FLAGS_quic_allow_new_bbr = true; |
| 1368 // Disable this flag because if connection uses multipath sent packet manager, | 1368 // Disable this flag because if connection uses multipath sent packet manager, |
| 1369 // static_cast here does not work. | 1369 // static_cast here does not work. |
| 1370 FLAGS_quic_enable_multipath = false; | 1370 FLAGS_quic_enable_multipath = false; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 | 1445 |
| 1446 ASSERT_TRUE(Initialize()); | 1446 ASSERT_TRUE(Initialize()); |
| 1447 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1447 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 1448 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1448 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1449 | 1449 |
| 1450 // Pause the server so we can access the server's internals without races. | 1450 // Pause the server so we can access the server's internals without races. |
| 1451 server_thread_->Pause(); | 1451 server_thread_->Pause(); |
| 1452 QuicDispatcher* dispatcher = | 1452 QuicDispatcher* dispatcher = |
| 1453 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1453 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1454 ASSERT_EQ(1u, dispatcher->session_map().size()); | 1454 ASSERT_EQ(1u, dispatcher->session_map().size()); |
| 1455 QuicSession* session = dispatcher->session_map().begin()->second; | 1455 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 1456 const QuicSentPacketManagerInterface& client_sent_packet_manager = | 1456 const QuicSentPacketManagerInterface& client_sent_packet_manager = |
| 1457 client_->client()->session()->connection()->sent_packet_manager(); | 1457 client_->client()->session()->connection()->sent_packet_manager(); |
| 1458 | 1458 |
| 1459 // Now that acks have been exchanged, the RTT estimate has decreased on the | 1459 // Now that acks have been exchanged, the RTT estimate has decreased on the |
| 1460 // server and is not infinite on the client. | 1460 // server and is not infinite on the client. |
| 1461 EXPECT_FALSE( | 1461 EXPECT_FALSE( |
| 1462 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); | 1462 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); |
| 1463 const RttStats& server_rtt_stats = | 1463 const RttStats& server_rtt_stats = |
| 1464 *session->connection()->sent_packet_manager().GetRttStats(); | 1464 *session->connection()->sent_packet_manager().GetRttStats(); |
| 1465 EXPECT_EQ(static_cast<int64_t>(kMaxInitialRoundTripTimeUs), | 1465 EXPECT_EQ(static_cast<int64_t>(kMaxInitialRoundTripTimeUs), |
| 1466 server_rtt_stats.initial_rtt_us()); | 1466 server_rtt_stats.initial_rtt_us()); |
| 1467 EXPECT_GE(static_cast<int64_t>(kMaxInitialRoundTripTimeUs), | 1467 EXPECT_GE(static_cast<int64_t>(kMaxInitialRoundTripTimeUs), |
| 1468 server_rtt_stats.smoothed_rtt().ToMicroseconds()); | 1468 server_rtt_stats.smoothed_rtt().ToMicroseconds()); |
| 1469 server_thread_->Resume(); | 1469 server_thread_->Resume(); |
| 1470 } | 1470 } |
| 1471 | 1471 |
| 1472 TEST_P(EndToEndTest, MinInitialRTT) { | 1472 TEST_P(EndToEndTest, MinInitialRTT) { |
| 1473 // Client tries to suggest 0 and the server uses the default. | 1473 // Client tries to suggest 0 and the server uses the default. |
| 1474 client_config_.SetInitialRoundTripTimeUsToSend(0); | 1474 client_config_.SetInitialRoundTripTimeUsToSend(0); |
| 1475 | 1475 |
| 1476 ASSERT_TRUE(Initialize()); | 1476 ASSERT_TRUE(Initialize()); |
| 1477 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1477 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 1478 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1478 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1479 | 1479 |
| 1480 // Pause the server so we can access the server's internals without races. | 1480 // Pause the server so we can access the server's internals without races. |
| 1481 server_thread_->Pause(); | 1481 server_thread_->Pause(); |
| 1482 QuicDispatcher* dispatcher = | 1482 QuicDispatcher* dispatcher = |
| 1483 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1483 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1484 ASSERT_EQ(1u, dispatcher->session_map().size()); | 1484 ASSERT_EQ(1u, dispatcher->session_map().size()); |
| 1485 QuicSession* session = dispatcher->session_map().begin()->second; | 1485 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 1486 const QuicSentPacketManagerInterface& client_sent_packet_manager = | 1486 const QuicSentPacketManagerInterface& client_sent_packet_manager = |
| 1487 client_->client()->session()->connection()->sent_packet_manager(); | 1487 client_->client()->session()->connection()->sent_packet_manager(); |
| 1488 const QuicSentPacketManagerInterface& server_sent_packet_manager = | 1488 const QuicSentPacketManagerInterface& server_sent_packet_manager = |
| 1489 session->connection()->sent_packet_manager(); | 1489 session->connection()->sent_packet_manager(); |
| 1490 | 1490 |
| 1491 // Now that acks have been exchanged, the RTT estimate has decreased on the | 1491 // Now that acks have been exchanged, the RTT estimate has decreased on the |
| 1492 // server and is not infinite on the client. | 1492 // server and is not infinite on the client. |
| 1493 EXPECT_FALSE( | 1493 EXPECT_FALSE( |
| 1494 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); | 1494 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); |
| 1495 // Expect the default rtt of 100ms. | 1495 // Expect the default rtt of 100ms. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 EXPECT_EQ(kServerStreamIFCW, QuicFlowControllerPeer::SendWindowOffset( | 1735 EXPECT_EQ(kServerStreamIFCW, QuicFlowControllerPeer::SendWindowOffset( |
| 1736 stream->flow_controller())); | 1736 stream->flow_controller())); |
| 1737 EXPECT_EQ(kServerSessionIFCW, | 1737 EXPECT_EQ(kServerSessionIFCW, |
| 1738 QuicFlowControllerPeer::SendWindowOffset( | 1738 QuicFlowControllerPeer::SendWindowOffset( |
| 1739 client_->client()->session()->flow_controller())); | 1739 client_->client()->session()->flow_controller())); |
| 1740 | 1740 |
| 1741 // Server should have the right values for client's receive window. | 1741 // Server should have the right values for client's receive window. |
| 1742 server_thread_->Pause(); | 1742 server_thread_->Pause(); |
| 1743 QuicDispatcher* dispatcher = | 1743 QuicDispatcher* dispatcher = |
| 1744 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1744 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1745 QuicSession* session = dispatcher->session_map().begin()->second; | 1745 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 1746 EXPECT_EQ(kClientStreamIFCW, | 1746 EXPECT_EQ(kClientStreamIFCW, |
| 1747 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); | 1747 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); |
| 1748 EXPECT_EQ(kClientSessionIFCW, | 1748 EXPECT_EQ(kClientSessionIFCW, |
| 1749 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); | 1749 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); |
| 1750 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( | 1750 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( |
| 1751 session->flow_controller())); | 1751 session->flow_controller())); |
| 1752 server_thread_->Resume(); | 1752 server_thread_->Resume(); |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) { | 1755 TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 kStreamIFCW); | 1790 kStreamIFCW); |
| 1791 } | 1791 } |
| 1792 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( | 1792 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( |
| 1793 client_->client()->session()->flow_controller())); | 1793 client_->client()->session()->flow_controller())); |
| 1794 | 1794 |
| 1795 // Server should be in a similar state: connection flow control window should | 1795 // Server should be in a similar state: connection flow control window should |
| 1796 // not have any bytes marked as received. | 1796 // not have any bytes marked as received. |
| 1797 server_thread_->Pause(); | 1797 server_thread_->Pause(); |
| 1798 QuicDispatcher* dispatcher = | 1798 QuicDispatcher* dispatcher = |
| 1799 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1799 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1800 QuicSession* session = dispatcher->session_map().begin()->second; | 1800 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 1801 QuicFlowController* server_connection_flow_controller = | 1801 QuicFlowController* server_connection_flow_controller = |
| 1802 session->flow_controller(); | 1802 session->flow_controller(); |
| 1803 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::ReceiveWindowSize( | 1803 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::ReceiveWindowSize( |
| 1804 server_connection_flow_controller)); | 1804 server_connection_flow_controller)); |
| 1805 server_thread_->Resume(); | 1805 server_thread_->Resume(); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 TEST_P(EndToEndTest, FlowControlsSynced) { | 1808 TEST_P(EndToEndTest, FlowControlsSynced) { |
| 1809 set_smaller_flow_control_receive_window(); | 1809 set_smaller_flow_control_receive_window(); |
| 1810 | 1810 |
| 1811 ASSERT_TRUE(Initialize()); | 1811 ASSERT_TRUE(Initialize()); |
| 1812 | 1812 |
| 1813 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1813 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 1814 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1814 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1815 | 1815 |
| 1816 server_thread_->Pause(); | 1816 server_thread_->Pause(); |
| 1817 QuicSpdySession* const client_session = client_->client()->session(); | 1817 QuicSpdySession* const client_session = client_->client()->session(); |
| 1818 QuicDispatcher* dispatcher = | 1818 QuicDispatcher* dispatcher = |
| 1819 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1819 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1820 QuicSpdySession* server_session = dispatcher->session_map().begin()->second; | 1820 QuicSpdySession* server_session = |
| 1821 dispatcher->session_map().begin()->second.get(); |
| 1821 | 1822 |
| 1822 ExpectFlowControlsSynced(client_session->flow_controller(), | 1823 ExpectFlowControlsSynced(client_session->flow_controller(), |
| 1823 server_session->flow_controller()); | 1824 server_session->flow_controller()); |
| 1824 ExpectFlowControlsSynced( | 1825 ExpectFlowControlsSynced( |
| 1825 QuicSessionPeer::GetCryptoStream(client_session)->flow_controller(), | 1826 QuicSessionPeer::GetCryptoStream(client_session)->flow_controller(), |
| 1826 QuicSessionPeer::GetCryptoStream(server_session)->flow_controller()); | 1827 QuicSessionPeer::GetCryptoStream(server_session)->flow_controller()); |
| 1827 ExpectFlowControlsSynced( | 1828 ExpectFlowControlsSynced( |
| 1828 QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(), | 1829 QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(), |
| 1829 QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller()); | 1830 QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller()); |
| 1830 | 1831 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1847 ASSERT_TRUE(Initialize()); | 1848 ASSERT_TRUE(Initialize()); |
| 1848 | 1849 |
| 1849 // Send a simple headers only request, and receive response. | 1850 // Send a simple headers only request, and receive response. |
| 1850 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1851 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1851 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1852 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1852 | 1853 |
| 1853 // Now verify that the server is not waiting for a final FIN or RST. | 1854 // Now verify that the server is not waiting for a final FIN or RST. |
| 1854 server_thread_->Pause(); | 1855 server_thread_->Pause(); |
| 1855 QuicDispatcher* dispatcher = | 1856 QuicDispatcher* dispatcher = |
| 1856 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1857 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1857 QuicSession* session = dispatcher->session_map().begin()->second; | 1858 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 1858 EXPECT_EQ( | 1859 EXPECT_EQ( |
| 1859 0u, | 1860 0u, |
| 1860 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(session).size()); | 1861 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(session).size()); |
| 1861 server_thread_->Resume(); | 1862 server_thread_->Resume(); |
| 1862 } | 1863 } |
| 1863 | 1864 |
| 1864 // A TestAckListener verifies that its OnAckNotification method has been | 1865 // A TestAckListener verifies that its OnAckNotification method has been |
| 1865 // called exactly once on destruction. | 1866 // called exactly once on destruction. |
| 1866 class TestAckListener : public QuicAckListenerInterface { | 1867 class TestAckListener : public QuicAckListenerInterface { |
| 1867 public: | 1868 public: |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 | 2452 |
| 2452 // Pause the server so we can access the server's internals without races. | 2453 // Pause the server so we can access the server's internals without races. |
| 2453 server_thread_->Pause(); | 2454 server_thread_->Pause(); |
| 2454 | 2455 |
| 2455 QuicDispatcher* dispatcher = | 2456 QuicDispatcher* dispatcher = |
| 2456 QuicServerPeer::GetDispatcher(server_thread_->server()); | 2457 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 2457 QuicDispatcher::SessionMap const& map = | 2458 QuicDispatcher::SessionMap const& map = |
| 2458 QuicDispatcherPeer::session_map(dispatcher); | 2459 QuicDispatcherPeer::session_map(dispatcher); |
| 2459 QuicDispatcher::SessionMap::const_iterator it = map.begin(); | 2460 QuicDispatcher::SessionMap::const_iterator it = map.begin(); |
| 2460 EXPECT_TRUE(it != map.end()); | 2461 EXPECT_TRUE(it != map.end()); |
| 2461 QuicServerSessionBase* server_session = it->second; | 2462 QuicServerSessionBase* server_session = it->second.get(); |
| 2462 | 2463 |
| 2463 // The stream is not waiting for the arrival of the peer's final offset. | 2464 // The stream is not waiting for the arrival of the peer's final offset. |
| 2464 EXPECT_EQ( | 2465 EXPECT_EQ( |
| 2465 0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(server_session) | 2466 0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(server_session) |
| 2466 .size()); | 2467 .size()); |
| 2467 | 2468 |
| 2468 server_thread_->Resume(); | 2469 server_thread_->Resume(); |
| 2469 } | 2470 } |
| 2470 | 2471 |
| 2471 TEST_P(EndToEndTest, LargePostEarlyResponse) { | 2472 TEST_P(EndToEndTest, LargePostEarlyResponse) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 // request. | 2761 // request. |
| 2761 client_->WaitForResponse(); | 2762 client_->WaitForResponse(); |
| 2762 } | 2763 } |
| 2763 | 2764 |
| 2764 // Check server session to see if it has max number of outgoing streams opened | 2765 // Check server session to see if it has max number of outgoing streams opened |
| 2765 // though more resources need to be pushed. | 2766 // though more resources need to be pushed. |
| 2766 server_thread_->Pause(); | 2767 server_thread_->Pause(); |
| 2767 QuicDispatcher* dispatcher = | 2768 QuicDispatcher* dispatcher = |
| 2768 QuicServerPeer::GetDispatcher(server_thread_->server()); | 2769 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 2769 ASSERT_EQ(1u, dispatcher->session_map().size()); | 2770 ASSERT_EQ(1u, dispatcher->session_map().size()); |
| 2770 QuicSession* session = dispatcher->session_map().begin()->second; | 2771 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 2771 EXPECT_EQ(kNumMaxStreams, session->GetNumOpenOutgoingStreams()); | 2772 EXPECT_EQ(kNumMaxStreams, session->GetNumOpenOutgoingStreams()); |
| 2772 server_thread_->Resume(); | 2773 server_thread_->Resume(); |
| 2773 | 2774 |
| 2774 EXPECT_EQ(1u, client_->num_requests()); | 2775 EXPECT_EQ(1u, client_->num_requests()); |
| 2775 EXPECT_EQ(1u, client_->num_responses()); | 2776 EXPECT_EQ(1u, client_->num_responses()); |
| 2776 EXPECT_EQ(kBody, client_->response_body()); | 2777 EXPECT_EQ(kBody, client_->response_body()); |
| 2777 | 2778 |
| 2778 // "Send" request for a promised resources will not really send out it because | 2779 // "Send" request for a promised resources will not really send out it because |
| 2779 // its response is being pushed(but blocked). And the following ack and | 2780 // its response is being pushed(but blocked). And the following ack and |
| 2780 // flow control behavior of SendSynchronousRequests() | 2781 // flow control behavior of SendSynchronousRequests() |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2957 client_->WaitForResponse(); | 2958 client_->WaitForResponse(); |
| 2958 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 2959 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 2959 QuicConnectionStats client_stats = | 2960 QuicConnectionStats client_stats = |
| 2960 client_->client()->session()->connection()->GetStats(); | 2961 client_->client()->session()->connection()->GetStats(); |
| 2961 EXPECT_EQ(0u, client_stats.packets_lost); | 2962 EXPECT_EQ(0u, client_stats.packets_lost); |
| 2962 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 2963 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 2963 } | 2964 } |
| 2964 } // namespace | 2965 } // namespace |
| 2965 } // namespace test | 2966 } // namespace test |
| 2966 } // namespace net | 2967 } // namespace net |
| OLD | NEW |