Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1732)

Unified Diff: net/quic/congestion_control/tcp_cubic_sender_test.cc

Issue 20227003: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Land Recent QUIC changes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/aes_128_gcm_12_encrypter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/tcp_cubic_sender_test.cc
diff --git a/net/quic/congestion_control/tcp_cubic_sender_test.cc b/net/quic/congestion_control/tcp_cubic_sender_test.cc
index a9e468f9005e5e211e417595082969b9dda45bf3..68a8d6bfadd415fbf464979883c9c73f61b03a01 100644
--- a/net/quic/congestion_control/tcp_cubic_sender_test.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender_test.cc
@@ -17,11 +17,12 @@ const QuicByteCount kNoNBytesInFlight = 0;
class TcpCubicSenderPeer : public TcpCubicSender {
public:
- explicit TcpCubicSenderPeer(const QuicClock* clock, bool reno)
+ TcpCubicSenderPeer(const QuicClock* clock, bool reno)
: TcpCubicSender(clock, reno) {
}
using TcpCubicSender::AvailableCongestionWindow;
using TcpCubicSender::CongestionWindow;
+ using TcpCubicSender::AckAccounting;
};
class TcpCubicSenderTest : public ::testing::Test {
@@ -221,5 +222,33 @@ TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) {
EXPECT_EQ(expected_congestion_window, sender_->CongestionWindow());
}
+TEST_F(TcpCubicSenderTest, RetransmissionDelay) {
+ const int64 kRttMs = 10;
+ const int64 kDeviationMs = 3;
+ EXPECT_EQ(QuicTime::Delta::Zero(), sender_->RetransmissionDelay());
+
+ sender_->AckAccounting(QuicTime::Delta::FromMilliseconds(kRttMs));
+
+ // Initial value is to set the median deviation to half of the initial
+ // rtt, the median in then multiplied by a factor of 4 and finaly the
+ // smoothed rtt is added which is the inital rtt.
+ QuicTime::Delta expected_delay =
+ QuicTime::Delta::FromMilliseconds(kRttMs + kRttMs / 2 * 4);
+ EXPECT_EQ(expected_delay, sender_->RetransmissionDelay());
+
+ for (int i = 0; i < 100; ++i) {
+ // Run to make sure that we converge.
+ sender_->AckAccounting(
+ QuicTime::Delta::FromMilliseconds(kRttMs + kDeviationMs));
+ sender_->AckAccounting(
+ QuicTime::Delta::FromMilliseconds(kRttMs - kDeviationMs));
+ }
+ expected_delay = QuicTime::Delta::FromMilliseconds(kRttMs + kDeviationMs * 4);
+
+ EXPECT_NEAR(kRttMs, sender_->SmoothedRtt().ToMilliseconds(), 1);
+ EXPECT_NEAR(expected_delay.ToMilliseconds(),
+ sender_->RetransmissionDelay().ToMilliseconds(),
+ 1);
+}
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/aes_128_gcm_12_encrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698