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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 sender_->slowstart_threshold()); | 1019 sender_->slowstart_threshold()); |
1020 | 1020 |
1021 // Resets cwnd and slow start threshold on connection migrations. | 1021 // Resets cwnd and slow start threshold on connection migrations. |
1022 sender_->OnConnectionMigration(); | 1022 sender_->OnConnectionMigration(); |
1023 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); | 1023 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); |
1024 EXPECT_EQ(kMaxCongestionWindowPackets, sender_->slowstart_threshold()); | 1024 EXPECT_EQ(kMaxCongestionWindowPackets, sender_->slowstart_threshold()); |
1025 EXPECT_FALSE(sender_->hybrid_slow_start().started()); | 1025 EXPECT_FALSE(sender_->hybrid_slow_start().started()); |
1026 } | 1026 } |
1027 | 1027 |
1028 TEST_F(TcpCubicSenderPacketsTest, DefaultMaxCwnd) { | 1028 TEST_F(TcpCubicSenderPacketsTest, DefaultMaxCwnd) { |
1029 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, true); | |
1030 RttStats rtt_stats; | 1029 RttStats rtt_stats; |
1031 QuicConnectionStats stats; | 1030 QuicConnectionStats stats; |
1032 std::unique_ptr<SendAlgorithmInterface> sender(SendAlgorithmInterface::Create( | 1031 std::unique_ptr<SendAlgorithmInterface> sender(SendAlgorithmInterface::Create( |
1033 &clock_, &rtt_stats, kCubic, &stats, kInitialCongestionWindow)); | 1032 &clock_, &rtt_stats, kCubic, &stats, kInitialCongestionWindow)); |
1034 | 1033 |
1035 SendAlgorithmInterface::CongestionVector acked_packets; | 1034 SendAlgorithmInterface::CongestionVector acked_packets; |
1036 SendAlgorithmInterface::CongestionVector missing_packets; | 1035 SendAlgorithmInterface::CongestionVector missing_packets; |
1037 for (uint64_t i = 1; i < kDefaultMaxCongestionWindowPackets; ++i) { | 1036 for (uint64_t i = 1; i < kDefaultMaxCongestionWindowPackets; ++i) { |
1038 acked_packets.clear(); | 1037 acked_packets.clear(); |
1039 acked_packets.push_back(std::make_pair(i, 1350)); | 1038 acked_packets.push_back(std::make_pair(i, 1350)); |
1040 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), | 1039 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), |
1041 acked_packets, missing_packets); | 1040 acked_packets, missing_packets); |
1042 } | 1041 } |
1043 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, | 1042 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, |
1044 sender->GetCongestionWindow() / kDefaultTCPMSS); | 1043 sender->GetCongestionWindow() / kDefaultTCPMSS); |
1045 } | 1044 } |
1046 | 1045 |
1047 } // namespace test | 1046 } // namespace test |
1048 } // namespace net | 1047 } // namespace net |
OLD | NEW |