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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 it's 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 * kDefaultTCPMSS, | 944 EXPECT_EQ(kDefaultInitialWindow, |
945 client_sent_packet_manager.GetCongestionWindow()); | 945 client_sent_packet_manager.GetCongestionWindowInTcpMss()); |
946 EXPECT_EQ(kMaxInitialWindow * kDefaultTCPMSS, | 946 EXPECT_EQ(kMaxInitialWindow, |
947 server_sent_packet_manager.GetCongestionWindow()); | 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. |
953 EXPECT_EQ(1000u, client_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 953 EXPECT_EQ(1000u, client_sent_packet_manager.GetRttStats()->initial_rtt_us()); |
954 EXPECT_EQ(1000u, server_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 954 EXPECT_EQ(1000u, 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); |
(...skipping 22 matching lines...) Expand all Loading... |
980 server_thread_->WaitForCryptoHandshakeConfirmed(); | 980 server_thread_->WaitForCryptoHandshakeConfirmed(); |
981 | 981 |
982 // Pause the server so we can access the server's internals without races. | 982 // Pause the server so we can access the server's internals without races. |
983 server_thread_->Pause(); | 983 server_thread_->Pause(); |
984 QuicDispatcher* dispatcher = | 984 QuicDispatcher* dispatcher = |
985 QuicServerPeer::GetDispatcher(server_thread_->server()); | 985 QuicServerPeer::GetDispatcher(server_thread_->server()); |
986 ASSERT_EQ(1u, dispatcher->session_map().size()); | 986 ASSERT_EQ(1u, dispatcher->session_map().size()); |
987 QuicSession* session = dispatcher->session_map().begin()->second; | 987 QuicSession* session = dispatcher->session_map().begin()->second; |
988 const QuicSentPacketManager& client_sent_packet_manager = | 988 const QuicSentPacketManager& client_sent_packet_manager = |
989 client_->client()->session()->connection()->sent_packet_manager(); | 989 client_->client()->session()->connection()->sent_packet_manager(); |
990 const QuicSentPacketManager& server_sent_packet_manager = | |
991 session->connection()->sent_packet_manager(); | |
992 | 990 |
993 // Now that acks have been exchanged, the RTT estimate has decreased on the | 991 // Now that acks have been exchanged, the RTT estimate has decreased on the |
994 // server and is not infinite on the client. | 992 // server and is not infinite on the client. |
995 EXPECT_FALSE( | 993 EXPECT_FALSE( |
996 client_sent_packet_manager.GetRttStats()->SmoothedRtt().IsInfinite()); | 994 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); |
| 995 const RttStats& server_rtt_stats = |
| 996 *session->connection()->sent_packet_manager().GetRttStats(); |
997 EXPECT_EQ(static_cast<int64>(kMaxInitialRoundTripTimeUs), | 997 EXPECT_EQ(static_cast<int64>(kMaxInitialRoundTripTimeUs), |
998 server_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 998 server_rtt_stats.initial_rtt_us()); |
999 EXPECT_GE( | 999 EXPECT_GE(static_cast<int64>(kMaxInitialRoundTripTimeUs), |
1000 static_cast<int64>(kMaxInitialRoundTripTimeUs), | 1000 server_rtt_stats.smoothed_rtt().ToMicroseconds()); |
1001 server_sent_packet_manager.GetRttStats()->SmoothedRtt().ToMicroseconds()); | |
1002 server_thread_->Resume(); | 1001 server_thread_->Resume(); |
1003 } | 1002 } |
1004 | 1003 |
1005 TEST_P(EndToEndTest, MinInitialRTT) { | 1004 TEST_P(EndToEndTest, MinInitialRTT) { |
1006 // Client tries to suggest 0 and the server uses the default. | 1005 // Client tries to suggest 0 and the server uses the default. |
1007 client_config_.SetInitialRoundTripTimeUsToSend(0); | 1006 client_config_.SetInitialRoundTripTimeUsToSend(0); |
1008 | 1007 |
1009 ASSERT_TRUE(Initialize()); | 1008 ASSERT_TRUE(Initialize()); |
1010 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1009 client_->client()->WaitForCryptoHandshakeConfirmed(); |
1011 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1010 server_thread_->WaitForCryptoHandshakeConfirmed(); |
1012 | 1011 |
1013 // Pause the server so we can access the server's internals without races. | 1012 // Pause the server so we can access the server's internals without races. |
1014 server_thread_->Pause(); | 1013 server_thread_->Pause(); |
1015 QuicDispatcher* dispatcher = | 1014 QuicDispatcher* dispatcher = |
1016 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1015 QuicServerPeer::GetDispatcher(server_thread_->server()); |
1017 ASSERT_EQ(1u, dispatcher->session_map().size()); | 1016 ASSERT_EQ(1u, dispatcher->session_map().size()); |
1018 QuicSession* session = dispatcher->session_map().begin()->second; | 1017 QuicSession* session = dispatcher->session_map().begin()->second; |
1019 const QuicSentPacketManager& client_sent_packet_manager = | 1018 const QuicSentPacketManager& client_sent_packet_manager = |
1020 client_->client()->session()->connection()->sent_packet_manager(); | 1019 client_->client()->session()->connection()->sent_packet_manager(); |
1021 const QuicSentPacketManager& server_sent_packet_manager = | 1020 const QuicSentPacketManager& server_sent_packet_manager = |
1022 session->connection()->sent_packet_manager(); | 1021 session->connection()->sent_packet_manager(); |
1023 | 1022 |
1024 // Now that acks have been exchanged, the RTT estimate has decreased on the | 1023 // Now that acks have been exchanged, the RTT estimate has decreased on the |
1025 // server and is not infinite on the client. | 1024 // server and is not infinite on the client. |
1026 EXPECT_FALSE( | 1025 EXPECT_FALSE( |
1027 client_sent_packet_manager.GetRttStats()->SmoothedRtt().IsInfinite()); | 1026 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); |
1028 // Expect the default rtt of 100ms. | 1027 // Expect the default rtt of 100ms. |
1029 EXPECT_EQ(static_cast<int64>(100 * base::Time::kMicrosecondsPerMillisecond), | 1028 EXPECT_EQ(static_cast<int64>(100 * base::Time::kMicrosecondsPerMillisecond), |
1030 server_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 1029 server_sent_packet_manager.GetRttStats()->initial_rtt_us()); |
1031 // Ensure the bandwidth is valid. | 1030 // Ensure the bandwidth is valid. |
1032 client_sent_packet_manager.BandwidthEstimate(); | 1031 client_sent_packet_manager.BandwidthEstimate(); |
1033 server_sent_packet_manager.BandwidthEstimate(); | 1032 server_sent_packet_manager.BandwidthEstimate(); |
1034 server_thread_->Resume(); | 1033 server_thread_->Resume(); |
1035 } | 1034 } |
1036 | 1035 |
1037 TEST_P(EndToEndTest, ResetConnection) { | 1036 TEST_P(EndToEndTest, ResetConnection) { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 QuicSession* session = dispatcher->session_map().begin()->second; | 1359 QuicSession* session = dispatcher->session_map().begin()->second; |
1361 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1360 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1362 session).size()); | 1361 session).size()); |
1363 server_thread_->Resume(); | 1362 server_thread_->Resume(); |
1364 } | 1363 } |
1365 | 1364 |
1366 } // namespace | 1365 } // namespace |
1367 } // namespace test | 1366 } // namespace test |
1368 } // namespace tools | 1367 } // namespace tools |
1369 } // namespace net | 1368 } // namespace net |
OLD | NEW |