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 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 protected: | 62 protected: |
63 TcpCubicSenderPacketsTest() | 63 TcpCubicSenderPacketsTest() |
64 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), | 64 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), |
65 sender_( | 65 sender_( |
66 new TcpCubicSenderPacketsPeer(&clock_, true, kMaxCongestionWindow)), | 66 new TcpCubicSenderPacketsPeer(&clock_, true, kMaxCongestionWindow)), |
67 packet_number_(1), | 67 packet_number_(1), |
68 acked_packet_number_(0), | 68 acked_packet_number_(0), |
69 bytes_in_flight_(0) {} | 69 bytes_in_flight_(0) {} |
70 | 70 |
71 int SendAvailableSendWindow() { | 71 int SendAvailableSendWindow() { |
| 72 return SendAvailableSendWindow(kDefaultTCPMSS); |
| 73 } |
| 74 |
| 75 int SendAvailableSendWindow(QuicPacketLength packet_length) { |
72 // Send as long as TimeUntilSend returns Zero. | 76 // Send as long as TimeUntilSend returns Zero. |
73 int packets_sent = 0; | 77 int packets_sent = 0; |
74 bool can_send = sender_ | 78 bool can_send = |
75 ->TimeUntilSend(clock_.Now(), bytes_in_flight_, | 79 sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_).IsZero(); |
76 HAS_RETRANSMITTABLE_DATA) | |
77 .IsZero(); | |
78 while (can_send) { | 80 while (can_send) { |
79 sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, packet_number_++, | 81 sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, packet_number_++, |
80 kDefaultTCPMSS, HAS_RETRANSMITTABLE_DATA); | 82 kDefaultTCPMSS, HAS_RETRANSMITTABLE_DATA); |
81 ++packets_sent; | 83 ++packets_sent; |
82 bytes_in_flight_ += kDefaultTCPMSS; | 84 bytes_in_flight_ += kDefaultTCPMSS; |
83 can_send = sender_ | 85 can_send = |
84 ->TimeUntilSend(clock_.Now(), bytes_in_flight_, | 86 sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_).IsZero(); |
85 HAS_RETRANSMITTABLE_DATA) | |
86 .IsZero(); | |
87 } | 87 } |
88 return packets_sent; | 88 return packets_sent; |
89 } | 89 } |
90 | 90 |
91 // Normal is that TCP acks every other segment. | 91 // Normal is that TCP acks every other segment. |
92 void AckNPackets(int n) { | 92 void AckNPackets(int n) { |
93 sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(60), | 93 sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(60), |
94 QuicTime::Delta::Zero(), clock_.Now()); | 94 QuicTime::Delta::Zero(), clock_.Now()); |
95 SendAlgorithmInterface::CongestionVector acked_packets; | 95 SendAlgorithmInterface::CongestionVector acked_packets; |
96 SendAlgorithmInterface::CongestionVector lost_packets; | 96 SendAlgorithmInterface::CongestionVector lost_packets; |
97 for (int i = 0; i < n; ++i) { | 97 for (int i = 0; i < n; ++i) { |
98 ++acked_packet_number_; | 98 ++acked_packet_number_; |
99 acked_packets.push_back( | 99 acked_packets.push_back( |
100 std::make_pair(acked_packet_number_, kDefaultTCPMSS)); | 100 std::make_pair(acked_packet_number_, kDefaultTCPMSS)); |
101 } | 101 } |
102 sender_->OnCongestionEvent(true, bytes_in_flight_, acked_packets, | 102 sender_->OnCongestionEvent(true, bytes_in_flight_, acked_packets, |
103 lost_packets); | 103 lost_packets); |
104 bytes_in_flight_ -= n * kDefaultTCPMSS; | 104 bytes_in_flight_ -= n * kDefaultTCPMSS; |
105 clock_.AdvanceTime(one_ms_); | 105 clock_.AdvanceTime(one_ms_); |
106 } | 106 } |
107 | 107 |
108 void LoseNPackets(int n) { | 108 void LoseNPackets(int n) { LoseNPackets(n, kDefaultTCPMSS); } |
| 109 |
| 110 void LoseNPackets(int n, QuicPacketLength packet_length) { |
109 SendAlgorithmInterface::CongestionVector acked_packets; | 111 SendAlgorithmInterface::CongestionVector acked_packets; |
110 SendAlgorithmInterface::CongestionVector lost_packets; | 112 SendAlgorithmInterface::CongestionVector lost_packets; |
111 for (int i = 0; i < n; ++i) { | 113 for (int i = 0; i < n; ++i) { |
112 ++acked_packet_number_; | 114 ++acked_packet_number_; |
113 lost_packets.push_back( | 115 lost_packets.push_back( |
114 std::make_pair(acked_packet_number_, kDefaultTCPMSS)); | 116 std::make_pair(acked_packet_number_, packet_length)); |
115 } | 117 } |
116 sender_->OnCongestionEvent(false, bytes_in_flight_, acked_packets, | 118 sender_->OnCongestionEvent(false, bytes_in_flight_, acked_packets, |
117 lost_packets); | 119 lost_packets); |
118 bytes_in_flight_ -= n * kDefaultTCPMSS; | 120 bytes_in_flight_ -= n * packet_length; |
119 } | 121 } |
120 | 122 |
121 // Does not increment acked_packet_number_. | 123 // Does not increment acked_packet_number_. |
122 void LosePacket(QuicPacketNumber packet_number) { | 124 void LosePacket(QuicPacketNumber packet_number) { |
123 SendAlgorithmInterface::CongestionVector acked_packets; | 125 SendAlgorithmInterface::CongestionVector acked_packets; |
124 SendAlgorithmInterface::CongestionVector lost_packets; | 126 SendAlgorithmInterface::CongestionVector lost_packets; |
125 lost_packets.push_back(std::make_pair(packet_number, kDefaultTCPMSS)); | 127 lost_packets.push_back(std::make_pair(packet_number, kDefaultTCPMSS)); |
126 sender_->OnCongestionEvent(false, bytes_in_flight_, acked_packets, | 128 sender_->OnCongestionEvent(false, bytes_in_flight_, acked_packets, |
127 lost_packets); | 129 lost_packets); |
128 bytes_in_flight_ -= kDefaultTCPMSS; | 130 bytes_in_flight_ -= kDefaultTCPMSS; |
129 } | 131 } |
130 | 132 |
131 const QuicTime::Delta one_ms_; | 133 const QuicTime::Delta one_ms_; |
132 MockClock clock_; | 134 MockClock clock_; |
133 scoped_ptr<TcpCubicSenderPacketsPeer> sender_; | 135 scoped_ptr<TcpCubicSenderPacketsPeer> sender_; |
134 QuicPacketNumber packet_number_; | 136 QuicPacketNumber packet_number_; |
135 QuicPacketNumber acked_packet_number_; | 137 QuicPacketNumber acked_packet_number_; |
136 QuicByteCount bytes_in_flight_; | 138 QuicByteCount bytes_in_flight_; |
137 }; | 139 }; |
138 | 140 |
139 TEST_F(TcpCubicSenderPacketsTest, SimpleSender) { | 141 TEST_F(TcpCubicSenderPacketsTest, SimpleSender) { |
140 // At startup make sure we are at the default. | 142 // At startup make sure we are at the default. |
141 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); | 143 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); |
142 // At startup make sure we can send. | 144 // At startup make sure we can send. |
143 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA) | 145 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0).IsZero()); |
144 .IsZero()); | |
145 // Make sure we can send. | 146 // Make sure we can send. |
146 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA) | 147 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0).IsZero()); |
147 .IsZero()); | |
148 // And that window is un-affected. | 148 // And that window is un-affected. |
149 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); | 149 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); |
150 | 150 |
151 // Fill the send window with data, then verify that we can't send. | 151 // Fill the send window with data, then verify that we can't send. |
152 SendAvailableSendWindow(); | 152 SendAvailableSendWindow(); |
153 EXPECT_FALSE(sender_ | 153 EXPECT_FALSE( |
154 ->TimeUntilSend(clock_.Now(), sender_->GetCongestionWindow(), | 154 sender_->TimeUntilSend(clock_.Now(), sender_->GetCongestionWindow()) |
155 HAS_RETRANSMITTABLE_DATA) | 155 .IsZero()); |
156 .IsZero()); | |
157 } | 156 } |
158 | 157 |
159 TEST_F(TcpCubicSenderPacketsTest, ApplicationLimitedSlowStart) { | 158 TEST_F(TcpCubicSenderPacketsTest, ApplicationLimitedSlowStart) { |
160 // Send exactly 10 packets and ensure the CWND ends at 14 packets. | 159 // Send exactly 10 packets and ensure the CWND ends at 14 packets. |
161 const int kNumberOfAcks = 5; | 160 const int kNumberOfAcks = 5; |
162 // At startup make sure we can send. | 161 // At startup make sure we can send. |
163 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA) | 162 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0).IsZero()); |
164 .IsZero()); | |
165 // Make sure we can send. | 163 // Make sure we can send. |
166 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA) | 164 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0).IsZero()); |
167 .IsZero()); | |
168 | 165 |
169 SendAvailableSendWindow(); | 166 SendAvailableSendWindow(); |
170 for (int i = 0; i < kNumberOfAcks; ++i) { | 167 for (int i = 0; i < kNumberOfAcks; ++i) { |
171 AckNPackets(2); | 168 AckNPackets(2); |
172 } | 169 } |
173 QuicByteCount bytes_to_send = sender_->GetCongestionWindow(); | 170 QuicByteCount bytes_to_send = sender_->GetCongestionWindow(); |
174 // It's expected 2 acks will arrive when the bytes_in_flight are greater than | 171 // It's expected 2 acks will arrive when the bytes_in_flight are greater than |
175 // half the CWND. | 172 // half the CWND. |
176 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * 2, bytes_to_send); | 173 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * 2, bytes_to_send); |
177 } | 174 } |
178 | 175 |
179 TEST_F(TcpCubicSenderPacketsTest, ExponentialSlowStart) { | 176 TEST_F(TcpCubicSenderPacketsTest, ExponentialSlowStart) { |
180 const int kNumberOfAcks = 20; | 177 const int kNumberOfAcks = 20; |
181 // At startup make sure we can send. | 178 // At startup make sure we can send. |
182 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA) | 179 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0).IsZero()); |
183 .IsZero()); | |
184 EXPECT_EQ(QuicBandwidth::Zero(), sender_->BandwidthEstimate()); | 180 EXPECT_EQ(QuicBandwidth::Zero(), sender_->BandwidthEstimate()); |
185 // Make sure we can send. | 181 // Make sure we can send. |
186 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA) | 182 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0).IsZero()); |
187 .IsZero()); | |
188 | 183 |
189 for (int i = 0; i < kNumberOfAcks; ++i) { | 184 for (int i = 0; i < kNumberOfAcks; ++i) { |
190 // Send our full send window. | 185 // Send our full send window. |
191 SendAvailableSendWindow(); | 186 SendAvailableSendWindow(); |
192 AckNPackets(2); | 187 AckNPackets(2); |
193 } | 188 } |
194 const QuicByteCount cwnd = sender_->GetCongestionWindow(); | 189 const QuicByteCount cwnd = sender_->GetCongestionWindow(); |
195 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * kNumberOfAcks, cwnd); | 190 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * kNumberOfAcks, cwnd); |
196 EXPECT_EQ(QuicBandwidth::FromBytesAndTimeDelta( | 191 EXPECT_EQ(QuicBandwidth::FromBytesAndTimeDelta( |
197 cwnd, sender_->rtt_stats_.smoothed_rtt()), | 192 cwnd, sender_->rtt_stats_.smoothed_rtt()), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 AckNPackets(1); | 288 AckNPackets(1); |
294 expected_send_window += kDefaultTCPMSS; | 289 expected_send_window += kDefaultTCPMSS; |
295 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 290 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
296 | 291 |
297 // Now RTO and ensure slow start gets reset. | 292 // Now RTO and ensure slow start gets reset. |
298 EXPECT_TRUE(sender_->hybrid_slow_start().started()); | 293 EXPECT_TRUE(sender_->hybrid_slow_start().started()); |
299 sender_->OnRetransmissionTimeout(true); | 294 sender_->OnRetransmissionTimeout(true); |
300 EXPECT_FALSE(sender_->hybrid_slow_start().started()); | 295 EXPECT_FALSE(sender_->hybrid_slow_start().started()); |
301 } | 296 } |
302 | 297 |
| 298 TEST_F(TcpCubicSenderPacketsTest, SlowStartHalfPacketLossWithLargeReduction) { |
| 299 FLAGS_quic_sslr_byte_conservation = true; |
| 300 QuicConfig config; |
| 301 QuicTagVector options; |
| 302 options.push_back(kSSLR); |
| 303 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 304 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 305 |
| 306 sender_->SetNumEmulatedConnections(1); |
| 307 const int kNumberOfAcks = 10; |
| 308 for (int i = 0; i < kNumberOfAcks; ++i) { |
| 309 // Send our full send window in half sized packets. |
| 310 SendAvailableSendWindow(kDefaultTCPMSS / 2); |
| 311 AckNPackets(2); |
| 312 } |
| 313 SendAvailableSendWindow(kDefaultTCPMSS / 2); |
| 314 QuicByteCount expected_send_window = |
| 315 kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks); |
| 316 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 317 |
| 318 // Lose a packet to exit slow start. We should now have fallen out of |
| 319 // slow start with a window reduced by 1. |
| 320 LoseNPackets(1); |
| 321 expected_send_window -= kDefaultTCPMSS; |
| 322 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 323 |
| 324 // Lose 10 packets in recovery and verify that congestion window is reduced |
| 325 // by 5 packets. |
| 326 LoseNPackets(10, kDefaultTCPMSS / 2); |
| 327 expected_send_window -= 5 * kDefaultTCPMSS; |
| 328 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 329 } |
| 330 |
303 TEST_F(TcpCubicSenderPacketsTest, NoPRRWhenLessThanOnePacketInFlight) { | 331 TEST_F(TcpCubicSenderPacketsTest, NoPRRWhenLessThanOnePacketInFlight) { |
304 SendAvailableSendWindow(); | 332 SendAvailableSendWindow(); |
305 LoseNPackets(kInitialCongestionWindowPackets - 1); | 333 LoseNPackets(kInitialCongestionWindowPackets - 1); |
306 AckNPackets(1); | 334 AckNPackets(1); |
307 // PRR will allow 2 packets for every ack during recovery. | 335 // PRR will allow 2 packets for every ack during recovery. |
308 EXPECT_EQ(2, SendAvailableSendWindow()); | 336 EXPECT_EQ(2, SendAvailableSendWindow()); |
309 // Simulate abandoning all packets by supplying a bytes_in_flight of 0. | 337 // Simulate abandoning all packets by supplying a bytes_in_flight of 0. |
310 // PRR should now allow a packet to be sent, even though prr's state | 338 // PRR should now allow a packet to be sent, even though prr's state |
311 // variables believe it has sent enough packets. | 339 // variables believe it has sent enough packets. |
312 EXPECT_EQ(QuicTime::Delta::Zero(), | 340 EXPECT_EQ(QuicTime::Delta::Zero(), sender_->TimeUntilSend(clock_.Now(), 0)); |
313 sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)); | |
314 } | 341 } |
315 | 342 |
316 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossPRR) { | 343 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossPRR) { |
317 sender_->SetNumEmulatedConnections(1); | 344 sender_->SetNumEmulatedConnections(1); |
318 // Test based on the first example in RFC6937. | 345 // Test based on the first example in RFC6937. |
319 // Ack 10 packets in 5 acks to raise the CWND to 20, as in the example. | 346 // Ack 10 packets in 5 acks to raise the CWND to 20, as in the example. |
320 const int kNumberOfAcks = 5; | 347 const int kNumberOfAcks = 5; |
321 for (int i = 0; i < kNumberOfAcks; ++i) { | 348 for (int i = 0; i < kNumberOfAcks; ++i) { |
322 // Send our full send window. | 349 // Send our full send window. |
323 SendAvailableSendWindow(); | 350 SendAvailableSendWindow(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 407 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
381 | 408 |
382 // Lose one more than the congestion window reduction, so that after loss, | 409 // Lose one more than the congestion window reduction, so that after loss, |
383 // bytes_in_flight is lesser than the congestion window. | 410 // bytes_in_flight is lesser than the congestion window. |
384 size_t send_window_after_loss = kRenoBeta * expected_send_window; | 411 size_t send_window_after_loss = kRenoBeta * expected_send_window; |
385 size_t num_packets_to_lose = | 412 size_t num_packets_to_lose = |
386 (expected_send_window - send_window_after_loss) / kDefaultTCPMSS + 1; | 413 (expected_send_window - send_window_after_loss) / kDefaultTCPMSS + 1; |
387 LoseNPackets(num_packets_to_lose); | 414 LoseNPackets(num_packets_to_lose); |
388 // Immediately after the loss, ensure at least one packet can be sent. | 415 // Immediately after the loss, ensure at least one packet can be sent. |
389 // Losses without subsequent acks can occur with timer based loss detection. | 416 // Losses without subsequent acks can occur with timer based loss detection. |
390 EXPECT_TRUE(sender_ | 417 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_).IsZero()); |
391 ->TimeUntilSend(clock_.Now(), bytes_in_flight_, | |
392 HAS_RETRANSMITTABLE_DATA) | |
393 .IsZero()); | |
394 AckNPackets(1); | 418 AckNPackets(1); |
395 | 419 |
396 // We should now have fallen out of slow start with a reduced window. | 420 // We should now have fallen out of slow start with a reduced window. |
397 expected_send_window *= kRenoBeta; | 421 expected_send_window *= kRenoBeta; |
398 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 422 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
399 | 423 |
400 // Only 2 packets should be allowed to be sent, per PRR-SSRB | 424 // Only 2 packets should be allowed to be sent, per PRR-SSRB |
401 EXPECT_EQ(2, SendAvailableSendWindow()); | 425 EXPECT_EQ(2, SendAvailableSendWindow()); |
402 | 426 |
403 // Ack the next packet, which triggers another loss. | 427 // Ack the next packet, which triggers another loss. |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 QuicConfig config; | 861 QuicConfig config; |
838 | 862 |
839 // Verify that kCOPT: kMIN4 forces the min CWND to 1 packet, but allows up | 863 // Verify that kCOPT: kMIN4 forces the min CWND to 1 packet, but allows up |
840 // to 4 to be sent. | 864 // to 4 to be sent. |
841 QuicTagVector options; | 865 QuicTagVector options; |
842 options.push_back(kMIN4); | 866 options.push_back(kMIN4); |
843 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 867 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
844 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 868 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
845 sender_->OnRetransmissionTimeout(true); | 869 sender_->OnRetransmissionTimeout(true); |
846 EXPECT_EQ(1u, sender_->congestion_window()); | 870 EXPECT_EQ(1u, sender_->congestion_window()); |
847 EXPECT_TRUE(sender_ | 871 EXPECT_TRUE( |
848 ->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS, | 872 sender_->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS).IsZero()); |
849 HAS_RETRANSMITTABLE_DATA) | 873 EXPECT_TRUE( |
850 .IsZero()); | 874 sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS).IsZero()); |
851 EXPECT_TRUE(sender_ | 875 EXPECT_TRUE( |
852 ->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS, | 876 sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS).IsZero()); |
853 HAS_RETRANSMITTABLE_DATA) | 877 EXPECT_FALSE( |
854 .IsZero()); | 878 sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS).IsZero()); |
855 EXPECT_TRUE(sender_ | |
856 ->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS, | |
857 HAS_RETRANSMITTABLE_DATA) | |
858 .IsZero()); | |
859 EXPECT_FALSE(sender_ | |
860 ->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS, | |
861 HAS_RETRANSMITTABLE_DATA) | |
862 .IsZero()); | |
863 } | 879 } |
864 | 880 |
865 TEST_F(TcpCubicSenderPacketsTest, ResetAfterConnectionMigration) { | 881 TEST_F(TcpCubicSenderPacketsTest, ResetAfterConnectionMigration) { |
866 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); | 882 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); |
867 EXPECT_EQ(kMaxCongestionWindow, sender_->slowstart_threshold()); | 883 EXPECT_EQ(kMaxCongestionWindow, sender_->slowstart_threshold()); |
868 | 884 |
869 // Starts with slow start. | 885 // Starts with slow start. |
870 sender_->SetNumEmulatedConnections(1); | 886 sender_->SetNumEmulatedConnections(1); |
871 const int kNumberOfAcks = 10; | 887 const int kNumberOfAcks = 10; |
872 for (int i = 0; i < kNumberOfAcks; ++i) { | 888 for (int i = 0; i < kNumberOfAcks; ++i) { |
(...skipping 18 matching lines...) Expand all Loading... |
891 | 907 |
892 // Resets cwnd and slow start threshold on connection migrations. | 908 // Resets cwnd and slow start threshold on connection migrations. |
893 sender_->OnConnectionMigration(); | 909 sender_->OnConnectionMigration(); |
894 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); | 910 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); |
895 EXPECT_EQ(kMaxCongestionWindow, sender_->slowstart_threshold()); | 911 EXPECT_EQ(kMaxCongestionWindow, sender_->slowstart_threshold()); |
896 EXPECT_FALSE(sender_->hybrid_slow_start().started()); | 912 EXPECT_FALSE(sender_->hybrid_slow_start().started()); |
897 } | 913 } |
898 | 914 |
899 } // namespace test | 915 } // namespace test |
900 } // namespace net | 916 } // namespace net |
OLD | NEW |