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 <string> | 6 #include <string> |
7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 ASSERT_TRUE(Initialize()); | 917 ASSERT_TRUE(Initialize()); |
918 client_->client()->WaitForCryptoHandshakeConfirmed(); | 918 client_->client()->WaitForCryptoHandshakeConfirmed(); |
919 QuicConfig* client_negotiated_config = client_->client()->session()->config(); | 919 QuicConfig* client_negotiated_config = client_->client()->session()->config(); |
920 EXPECT_EQ(2u, client_negotiated_config->MaxStreamsPerConnection()); | 920 EXPECT_EQ(2u, client_negotiated_config->MaxStreamsPerConnection()); |
921 } | 921 } |
922 | 922 |
923 TEST_P(EndToEndTest, LimitCongestionWindowAndRTT) { | 923 TEST_P(EndToEndTest, LimitCongestionWindowAndRTT) { |
924 // Client tries to request twice the server's max initial window, and the | 924 // Client tries to request twice the server's max initial window, and the |
925 // server limits it to the max. | 925 // server limits it to the max. |
926 client_config_.SetInitialCongestionWindowToSend(2 * kMaxInitialWindow); | 926 client_config_.SetInitialCongestionWindowToSend(2 * kMaxInitialWindow); |
927 client_config_.SetInitialRoundTripTimeUsToSend(1000); | 927 client_config_.SetInitialRoundTripTimeUsToSend(20000); |
928 | 928 |
929 ASSERT_TRUE(Initialize()); | 929 ASSERT_TRUE(Initialize()); |
930 client_->client()->WaitForCryptoHandshakeConfirmed(); | 930 client_->client()->WaitForCryptoHandshakeConfirmed(); |
931 server_thread_->WaitForCryptoHandshakeConfirmed(); | 931 server_thread_->WaitForCryptoHandshakeConfirmed(); |
932 | 932 |
933 // Pause the server so we can access the server's internals without races. | 933 // Pause the server so we can access the server's internals without races. |
934 server_thread_->Pause(); | 934 server_thread_->Pause(); |
935 QuicDispatcher* dispatcher = | 935 QuicDispatcher* dispatcher = |
936 QuicServerPeer::GetDispatcher(server_thread_->server()); | 936 QuicServerPeer::GetDispatcher(server_thread_->server()); |
937 ASSERT_EQ(1u, dispatcher->session_map().size()); | 937 ASSERT_EQ(1u, dispatcher->session_map().size()); |
938 const QuicSentPacketManager& client_sent_packet_manager = | 938 const QuicSentPacketManager& client_sent_packet_manager = |
939 client_->client()->session()->connection()->sent_packet_manager(); | 939 client_->client()->session()->connection()->sent_packet_manager(); |
940 const QuicSentPacketManager& server_sent_packet_manager = | 940 const QuicSentPacketManager& server_sent_packet_manager = |
941 *GetSentPacketManagerFromFirstServerSession(); | 941 *GetSentPacketManagerFromFirstServerSession(); |
942 | 942 |
943 // The client shouldn't set its initial window based on the negotiated value. | 943 // The client shouldn't set its initial window based on the negotiated value. |
944 EXPECT_EQ(kDefaultInitialWindow, | 944 EXPECT_EQ(kDefaultInitialWindow, |
945 client_sent_packet_manager.GetCongestionWindowInTcpMss()); | 945 client_sent_packet_manager.GetCongestionWindowInTcpMss()); |
946 EXPECT_EQ(kMaxInitialWindow, | 946 EXPECT_EQ(kMaxInitialWindow, |
947 server_sent_packet_manager.GetCongestionWindowInTcpMss()); | 947 server_sent_packet_manager.GetCongestionWindowInTcpMss()); |
948 | 948 |
949 EXPECT_EQ(GetParam().use_pacing, server_sent_packet_manager.using_pacing()); | 949 EXPECT_EQ(GetParam().use_pacing, server_sent_packet_manager.using_pacing()); |
950 EXPECT_EQ(GetParam().use_pacing, client_sent_packet_manager.using_pacing()); | 950 EXPECT_EQ(GetParam().use_pacing, client_sent_packet_manager.using_pacing()); |
951 | 951 |
952 // The client *should* set the intitial RTT. | 952 // The client *should* set the intitial RTT, but it's increased to 10ms. |
953 EXPECT_EQ(1000u, client_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 953 EXPECT_EQ(20000u, client_sent_packet_manager.GetRttStats()->initial_rtt_us()); |
954 EXPECT_EQ(1000u, server_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 954 EXPECT_EQ(20000u, server_sent_packet_manager.GetRttStats()->initial_rtt_us()); |
955 | 955 |
956 // Now use the negotiated limits with packet loss. | 956 // Now use the negotiated limits with packet loss. |
957 SetPacketLossPercentage(30); | 957 SetPacketLossPercentage(30); |
958 | 958 |
959 // 10 KB body. | 959 // 10 KB body. |
960 string body; | 960 string body; |
961 GenerateBody(&body, 1024 * 10); | 961 GenerateBody(&body, 1024 * 10); |
962 | 962 |
963 HTTPMessage request(HttpConstants::HTTP_1_1, | 963 HTTPMessage request(HttpConstants::HTTP_1_1, |
964 HttpConstants::POST, "/foo"); | 964 HttpConstants::POST, "/foo"); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 QuicSession* session = dispatcher->session_map().begin()->second; | 1359 QuicSession* session = dispatcher->session_map().begin()->second; |
1360 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1360 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1361 session).size()); | 1361 session).size()); |
1362 server_thread_->Resume(); | 1362 server_thread_->Resume(); |
1363 } | 1363 } |
1364 | 1364 |
1365 } // namespace | 1365 } // namespace |
1366 } // namespace test | 1366 } // namespace test |
1367 } // namespace tools | 1367 } // namespace tools |
1368 } // namespace net | 1368 } // namespace net |
OLD | NEW |