| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_bytes_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 EXPECT_NEAR(kRttMs, sender_->rtt_stats_.smoothed_rtt().ToMilliseconds(), 1); | 395 EXPECT_NEAR(kRttMs, sender_->rtt_stats_.smoothed_rtt().ToMilliseconds(), 1); |
| 396 EXPECT_NEAR(expected_delay.ToMilliseconds(), | 396 EXPECT_NEAR(expected_delay.ToMilliseconds(), |
| 397 sender_->RetransmissionDelay().ToMilliseconds(), 1); | 397 sender_->RetransmissionDelay().ToMilliseconds(), 1); |
| 398 EXPECT_EQ( | 398 EXPECT_EQ( |
| 399 static_cast<int64>(sender_->GetCongestionWindow() * kNumMicrosPerSecond / | 399 static_cast<int64>(sender_->GetCongestionWindow() * kNumMicrosPerSecond / |
| 400 sender_->rtt_stats_.smoothed_rtt().ToMicroseconds()), | 400 sender_->rtt_stats_.smoothed_rtt().ToMicroseconds()), |
| 401 sender_->BandwidthEstimate().ToBytesPerSecond()); | 401 sender_->BandwidthEstimate().ToBytesPerSecond()); |
| 402 } | 402 } |
| 403 | 403 |
| 404 TEST_F(TcpCubicBytesSenderTest, TcpCubicResetEpochOnQuiescence) { | 404 TEST_F(TcpCubicBytesSenderTest, TcpCubicResetEpochOnQuiescence) { |
| 405 ValueRestore<bool> old_flag(&FLAGS_reset_cubic_epoch_when_app_limited, true); | |
| 406 const int kMaxCongestionWindow = 50; | 405 const int kMaxCongestionWindow = 50; |
| 407 const QuicByteCount kMaxCongestionWindowBytes = | 406 const QuicByteCount kMaxCongestionWindowBytes = |
| 408 kMaxCongestionWindow * kDefaultTCPMSS; | 407 kMaxCongestionWindow * kDefaultTCPMSS; |
| 409 int num_sent = SendAvailableSendWindow(); | 408 int num_sent = SendAvailableSendWindow(); |
| 410 | 409 |
| 411 // Make sure we fall out of slow start. | 410 // Make sure we fall out of slow start. |
| 412 QuicByteCount saved_cwnd = sender_->GetCongestionWindow(); | 411 QuicByteCount saved_cwnd = sender_->GetCongestionWindow(); |
| 413 LoseNPackets(1); | 412 LoseNPackets(1); |
| 414 EXPECT_GT(saved_cwnd, sender_->GetCongestionWindow()); | 413 EXPECT_GT(saved_cwnd, sender_->GetCongestionWindow()); |
| 415 | 414 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS, | 638 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS, |
| 640 HAS_RETRANSMITTABLE_DATA).IsZero()); | 639 HAS_RETRANSMITTABLE_DATA).IsZero()); |
| 641 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS, | 640 EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS, |
| 642 HAS_RETRANSMITTABLE_DATA).IsZero()); | 641 HAS_RETRANSMITTABLE_DATA).IsZero()); |
| 643 EXPECT_FALSE(sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS, | 642 EXPECT_FALSE(sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS, |
| 644 HAS_RETRANSMITTABLE_DATA).IsZero()); | 643 HAS_RETRANSMITTABLE_DATA).IsZero()); |
| 645 } | 644 } |
| 646 | 645 |
| 647 } // namespace test | 646 } // namespace test |
| 648 } // namespace net | 647 } // namespace net |
| OLD | NEW |