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

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

Issue 355573007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added NET_EXPORT_PRIVATE for ContainsQuicTag Created 6 years, 6 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/crypto_handshake.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 c5d991a2a302a24279e0598afebc05a6f86445af..8409f97283302b4ba39081187c822057406ab875 100644
--- a/net/quic/congestion_control/tcp_cubic_sender_test.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender_test.cc
@@ -37,6 +37,10 @@ class TcpCubicSenderPeer : public TcpCubicSender {
return congestion_window_;
}
+ QuicTcpCongestionWindow slowstart_threshold() {
+ return slowstart_threshold_;
+ }
+
const HybridSlowStart& hybrid_slow_start() const {
return hybrid_slow_start_;
}
@@ -236,11 +240,20 @@ TEST_F(TcpCubicSenderTest, SlowStartAckTrain) {
AckNPackets(2);
expected_send_window += kDefaultTCPMSS;
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
+ EXPECT_EQ(140u, sender_->slowstart_threshold());
// Now RTO and ensure slow start gets reset.
EXPECT_TRUE(sender_->hybrid_slow_start().started());
sender_->OnRetransmissionTimeout(true);
EXPECT_FALSE(sender_->hybrid_slow_start().started());
+ EXPECT_EQ(2 * kDefaultTCPMSS, sender_->GetCongestionWindow());
+ EXPECT_EQ(expected_send_window / 2 / kDefaultTCPMSS,
+ sender_->slowstart_threshold());
+
+ // Now revert the RTO and ensure the CWND and slowstart threshold revert.
+ sender_->RevertRetransmissionTimeout();
+ EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
+ EXPECT_EQ(140u, sender_->slowstart_threshold());
}
TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) {
@@ -421,12 +434,20 @@ TEST_F(TcpCubicSenderTest, SlowStartBurstPacketLossPRR) {
}
}
-TEST_F(TcpCubicSenderTest, RTOCongestionWindow) {
+TEST_F(TcpCubicSenderTest, RTOCongestionWindowAndRevert) {
EXPECT_EQ(kDefaultWindowTCP, sender_->SendWindow());
+ EXPECT_EQ(10000u, sender_->slowstart_threshold());
- // Expect the window to decrease to the minimum once the RTO fires.
+ // Expect the window to decrease to the minimum once the RTO fires
+ // and slow start threshold to be set to 1/2 of the CWND.
sender_->OnRetransmissionTimeout(true);
EXPECT_EQ(2 * kDefaultTCPMSS, sender_->SendWindow());
+ EXPECT_EQ(5u, sender_->slowstart_threshold());
+
+ // Now repair the RTO and ensure the slowstart threshold reverts.
+ sender_->RevertRetransmissionTimeout();
+ EXPECT_EQ(kDefaultWindowTCP, sender_->SendWindow());
+ EXPECT_EQ(10000u, sender_->slowstart_threshold());
}
TEST_F(TcpCubicSenderTest, RTOCongestionWindowNoRetransmission) {
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/crypto_handshake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698