| Index: net/quic/congestion_control/tcp_loss_algorithm_test.cc
|
| diff --git a/net/quic/congestion_control/tcp_loss_algorithm_test.cc b/net/quic/congestion_control/tcp_loss_algorithm_test.cc
|
| index 2540bc72d7196967f4d52f1f2cf1eb3e6ad3ac2e..9a42d364a22ba94e6a6bdb1f33b7c4a0bcd8707f 100644
|
| --- a/net/quic/congestion_control/tcp_loss_algorithm_test.cc
|
| +++ b/net/quic/congestion_control/tcp_loss_algorithm_test.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/stl_util.h"
|
| +#include "net/quic/congestion_control/rtt_stats.h"
|
| #include "net/quic/quic_unacked_packet_map.h"
|
| #include "net/quic/test_tools/mock_clock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -19,8 +20,10 @@ namespace {
|
| class TcpLossAlgorithmTest : public ::testing::Test {
|
| protected:
|
| TcpLossAlgorithmTest()
|
| - : unacked_packets_(),
|
| - srtt_(QuicTime::Delta::FromMilliseconds(100)) { }
|
| + : unacked_packets_() {
|
| + rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
|
| + QuicTime::Delta::Zero());
|
| + }
|
|
|
| void SendDataPacket(QuicPacketSequenceNumber sequence_number) {
|
| SerializedPacket packet(sequence_number, PACKET_1BYTE_SEQUENCE_NUMBER,
|
| @@ -34,7 +37,7 @@ class TcpLossAlgorithmTest : public ::testing::Test {
|
| size_t num_losses) {
|
| SequenceNumberSet lost_packets =
|
| loss_algorithm_.DetectLostPackets(
|
| - unacked_packets_, clock_.Now(), largest_observed, srtt_, srtt_);
|
| + unacked_packets_, clock_.Now(), largest_observed, rtt_stats_);
|
| EXPECT_EQ(num_losses, lost_packets.size());
|
| for (size_t i = 0; i < num_losses; ++i) {
|
| EXPECT_TRUE(ContainsKey(lost_packets, losses_expected[i]));
|
| @@ -43,7 +46,7 @@ class TcpLossAlgorithmTest : public ::testing::Test {
|
|
|
| QuicUnackedPacketMap unacked_packets_;
|
| TCPLossAlgorithm loss_algorithm_;
|
| - QuicTime::Delta srtt_;
|
| + RttStats rtt_stats_;
|
| MockClock clock_;
|
| };
|
|
|
| @@ -116,10 +119,10 @@ TEST_F(TcpLossAlgorithmTest, EarlyRetransmit1Packet) {
|
| unacked_packets_.SetNotPending(2);
|
| unacked_packets_.NackPacket(1, 1);
|
| VerifyLosses(2, NULL, 0);
|
| - EXPECT_EQ(clock_.Now().Add(srtt_.Multiply(1.25)),
|
| + EXPECT_EQ(clock_.Now().Add(rtt_stats_.SmoothedRtt().Multiply(1.25)),
|
| loss_algorithm_.GetLossTimeout());
|
|
|
| - clock_.AdvanceTime(srtt_.Multiply(1.25));
|
| + clock_.AdvanceTime(rtt_stats_.latest_rtt().Multiply(1.25));
|
| QuicPacketSequenceNumber lost[] = { 1 };
|
| VerifyLosses(2, lost, arraysize(lost));
|
| EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
|
| @@ -131,7 +134,7 @@ TEST_F(TcpLossAlgorithmTest, EarlyRetransmitAllPackets) {
|
| SendDataPacket(i);
|
| // Advance the time 1/4 RTT between 3 and 4.
|
| if (i == 3) {
|
| - clock_.AdvanceTime(srtt_.Multiply(0.25));
|
| + clock_.AdvanceTime(rtt_stats_.SmoothedRtt().Multiply(0.25));
|
| }
|
| }
|
|
|
| @@ -146,15 +149,15 @@ TEST_F(TcpLossAlgorithmTest, EarlyRetransmitAllPackets) {
|
| VerifyLosses(kNumSentPackets, lost, arraysize(lost));
|
| // The time has already advanced 1/4 an RTT, so ensure the timeout is set
|
| // 1.25 RTTs after the earliest pending packet(3), not the last(4).
|
| - EXPECT_EQ(clock_.Now().Add(srtt_),
|
| + EXPECT_EQ(clock_.Now().Add(rtt_stats_.SmoothedRtt()),
|
| loss_algorithm_.GetLossTimeout());
|
|
|
| - clock_.AdvanceTime(srtt_);
|
| + clock_.AdvanceTime(rtt_stats_.SmoothedRtt());
|
| QuicPacketSequenceNumber lost2[] = { 1, 2, 3 };
|
| VerifyLosses(kNumSentPackets, lost2, arraysize(lost2));
|
| - EXPECT_EQ(clock_.Now().Add(srtt_.Multiply(0.25)),
|
| + EXPECT_EQ(clock_.Now().Add(rtt_stats_.SmoothedRtt().Multiply(0.25)),
|
| loss_algorithm_.GetLossTimeout());
|
| - clock_.AdvanceTime(srtt_.Multiply(0.25));
|
| + clock_.AdvanceTime(rtt_stats_.SmoothedRtt().Multiply(0.25));
|
| QuicPacketSequenceNumber lost3[] = { 1, 2, 3, 4 };
|
| VerifyLosses(kNumSentPackets, lost3, arraysize(lost3));
|
| EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
|
|
|