| 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 "net/quic/congestion_control/tcp_cubic_sender_packets.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 QuicPacketCount max_tcp_congestion_window) | 40 QuicPacketCount max_tcp_congestion_window) |
| 41 : TcpCubicSenderPackets(clock, | 41 : TcpCubicSenderPackets(clock, |
| 42 &rtt_stats_, | 42 &rtt_stats_, |
| 43 reno, | 43 reno, |
| 44 kInitialCongestionWindowPackets, | 44 kInitialCongestionWindowPackets, |
| 45 max_tcp_congestion_window, | 45 max_tcp_congestion_window, |
| 46 &stats_) {} | 46 &stats_) {} |
| 47 | 47 |
| 48 QuicPacketCount congestion_window() { return congestion_window_; } | 48 QuicPacketCount congestion_window() { return congestion_window_; } |
| 49 | 49 |
| 50 QuicPacketCount max_congestion_window() { return max_tcp_congestion_window_; } |
| 51 |
| 50 QuicPacketCount slowstart_threshold() { return slowstart_threshold_; } | 52 QuicPacketCount slowstart_threshold() { return slowstart_threshold_; } |
| 51 | 53 |
| 52 const HybridSlowStart& hybrid_slow_start() const { | 54 const HybridSlowStart& hybrid_slow_start() const { |
| 53 return hybrid_slow_start_; | 55 return hybrid_slow_start_; |
| 54 } | 56 } |
| 55 | 57 |
| 56 float GetRenoBeta() const { return RenoBeta(); } | 58 float GetRenoBeta() const { return RenoBeta(); } |
| 57 | 59 |
| 58 RttStats rtt_stats_; | 60 RttStats rtt_stats_; |
| 59 QuicConnectionStats stats_; | 61 QuicConnectionStats stats_; |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 EXPECT_EQ(expected_send_window / kDefaultTCPMSS, | 956 EXPECT_EQ(expected_send_window / kDefaultTCPMSS, |
| 955 sender_->slowstart_threshold()); | 957 sender_->slowstart_threshold()); |
| 956 | 958 |
| 957 // Resets cwnd and slow start threshold on connection migrations. | 959 // Resets cwnd and slow start threshold on connection migrations. |
| 958 sender_->OnConnectionMigration(); | 960 sender_->OnConnectionMigration(); |
| 959 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); | 961 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); |
| 960 EXPECT_EQ(kMaxCongestionWindowPackets, sender_->slowstart_threshold()); | 962 EXPECT_EQ(kMaxCongestionWindowPackets, sender_->slowstart_threshold()); |
| 961 EXPECT_FALSE(sender_->hybrid_slow_start().started()); | 963 EXPECT_FALSE(sender_->hybrid_slow_start().started()); |
| 962 } | 964 } |
| 963 | 965 |
| 966 TEST_F(TcpCubicSenderPacketsTest, DefaultMaxCwnd) { |
| 967 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, true); |
| 968 RttStats rtt_stats; |
| 969 QuicConnectionStats stats; |
| 970 std::unique_ptr<SendAlgorithmInterface> sender(SendAlgorithmInterface::Create( |
| 971 &clock_, &rtt_stats, kCubic, &stats, kInitialCongestionWindow)); |
| 972 |
| 973 SendAlgorithmInterface::CongestionVector acked_packets; |
| 974 SendAlgorithmInterface::CongestionVector missing_packets; |
| 975 for (uint64_t i = 1; i < kDefaultMaxCongestionWindowPackets; ++i) { |
| 976 acked_packets.clear(); |
| 977 acked_packets.push_back(std::make_pair(i, 1350)); |
| 978 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), |
| 979 acked_packets, missing_packets); |
| 980 } |
| 981 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, |
| 982 sender->GetCongestionWindow() / kDefaultTCPMSS); |
| 983 } |
| 984 |
| 964 } // namespace test | 985 } // namespace test |
| 965 } // namespace net | 986 } // namespace net |
| OLD | NEW |