| 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 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 kStreamIFCW); | 1750 kStreamIFCW); |
| 1751 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( | 1751 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( |
| 1752 client_->client()->session()->flow_controller())); | 1752 client_->client()->session()->flow_controller())); |
| 1753 | 1753 |
| 1754 // Send a request with no body, and verify that the connection level window | 1754 // Send a request with no body, and verify that the connection level window |
| 1755 // has not been affected. | 1755 // has not been affected. |
| 1756 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1756 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1757 | 1757 |
| 1758 QuicHeadersStream* headers_stream = | 1758 QuicHeadersStream* headers_stream = |
| 1759 QuicSpdySessionPeer::GetHeadersStream(client_->client()->session()); | 1759 QuicSpdySessionPeer::GetHeadersStream(client_->client()->session()); |
| 1760 EXPECT_LT( | 1760 if (!client_->client()->session()->force_hol_blocking()) { |
| 1761 QuicFlowControllerPeer::SendWindowSize(headers_stream->flow_controller()), | 1761 EXPECT_LT(QuicFlowControllerPeer::SendWindowSize( |
| 1762 kStreamIFCW); | 1762 headers_stream->flow_controller()), |
| 1763 kStreamIFCW); |
| 1764 } |
| 1763 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( | 1765 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( |
| 1764 client_->client()->session()->flow_controller())); | 1766 client_->client()->session()->flow_controller())); |
| 1765 | 1767 |
| 1766 // Server should be in a similar state: connection flow control window should | 1768 // Server should be in a similar state: connection flow control window should |
| 1767 // not have any bytes marked as received. | 1769 // not have any bytes marked as received. |
| 1768 server_thread_->Pause(); | 1770 server_thread_->Pause(); |
| 1769 QuicDispatcher* dispatcher = | 1771 QuicDispatcher* dispatcher = |
| 1770 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1772 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1771 QuicSession* session = dispatcher->session_map().begin()->second; | 1773 QuicSession* session = dispatcher->session_map().begin()->second; |
| 1772 QuicFlowController* server_connection_flow_controller = | 1774 QuicFlowController* server_connection_flow_controller = |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1792 | 1794 |
| 1793 ExpectFlowControlsSynced(client_session->flow_controller(), | 1795 ExpectFlowControlsSynced(client_session->flow_controller(), |
| 1794 server_session->flow_controller()); | 1796 server_session->flow_controller()); |
| 1795 ExpectFlowControlsSynced( | 1797 ExpectFlowControlsSynced( |
| 1796 QuicSessionPeer::GetCryptoStream(client_session)->flow_controller(), | 1798 QuicSessionPeer::GetCryptoStream(client_session)->flow_controller(), |
| 1797 QuicSessionPeer::GetCryptoStream(server_session)->flow_controller()); | 1799 QuicSessionPeer::GetCryptoStream(server_session)->flow_controller()); |
| 1798 ExpectFlowControlsSynced( | 1800 ExpectFlowControlsSynced( |
| 1799 QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(), | 1801 QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(), |
| 1800 QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller()); | 1802 QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller()); |
| 1801 | 1803 |
| 1802 EXPECT_EQ(static_cast<float>(QuicFlowControllerPeer::ReceiveWindowSize( | 1804 if (!client_session->force_hol_blocking()) { |
| 1803 client_session->flow_controller())) / | 1805 EXPECT_EQ(static_cast<float>(QuicFlowControllerPeer::ReceiveWindowSize( |
| 1804 QuicFlowControllerPeer::ReceiveWindowSize( | 1806 client_session->flow_controller())) / |
| 1805 QuicSpdySessionPeer::GetHeadersStream(client_session) | 1807 QuicFlowControllerPeer::ReceiveWindowSize( |
| 1806 ->flow_controller()), | 1808 QuicSpdySessionPeer::GetHeadersStream(client_session) |
| 1807 kSessionToStreamRatio); | 1809 ->flow_controller()), |
| 1810 kSessionToStreamRatio); |
| 1811 } |
| 1808 | 1812 |
| 1809 server_thread_->Resume(); | 1813 server_thread_->Resume(); |
| 1810 } | 1814 } |
| 1811 | 1815 |
| 1812 TEST_P(EndToEndTest, RequestWithNoBodyWillNeverSendStreamFrameWithFIN) { | 1816 TEST_P(EndToEndTest, RequestWithNoBodyWillNeverSendStreamFrameWithFIN) { |
| 1813 // A stream created on receipt of a simple request with no body will never get | 1817 // A stream created on receipt of a simple request with no body will never get |
| 1814 // a stream frame with a FIN. Verify that we don't keep track of the stream in | 1818 // a stream frame with a FIN. Verify that we don't keep track of the stream in |
| 1815 // the locally closed streams map: it will never be removed if so. | 1819 // the locally closed streams map: it will never be removed if so. |
| 1816 ASSERT_TRUE(Initialize()); | 1820 ASSERT_TRUE(Initialize()); |
| 1817 | 1821 |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2925 client_->WaitForResponse(); | 2929 client_->WaitForResponse(); |
| 2926 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 2930 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 2927 QuicConnectionStats client_stats = | 2931 QuicConnectionStats client_stats = |
| 2928 client_->client()->session()->connection()->GetStats(); | 2932 client_->client()->session()->connection()->GetStats(); |
| 2929 EXPECT_EQ(0u, client_stats.packets_lost); | 2933 EXPECT_EQ(0u, client_stats.packets_lost); |
| 2930 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 2934 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 2931 } | 2935 } |
| 2932 } // namespace | 2936 } // namespace |
| 2933 } // namespace test | 2937 } // namespace test |
| 2934 } // namespace net | 2938 } // namespace net |
| OLD | NEW |