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

Unified Diff: net/quic/core/congestion_control/cubic_test.cc

Issue 2571643002: relnote: Use event_time instead of ApproximateNow() in QUIC cubic code. Protected by --quic_use_eve… (Closed)
Patch Set: Created 4 years 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
Index: net/quic/core/congestion_control/cubic_test.cc
diff --git a/net/quic/core/congestion_control/cubic_test.cc b/net/quic/core/congestion_control/cubic_test.cc
index c9342c0af6fd4adba003e3a784ecac2674c12411..5eef447bc37a1145c28cd0414addaeeaba3611d3 100644
--- a/net/quic/core/congestion_control/cubic_test.cc
+++ b/net/quic/core/congestion_control/cubic_test.cc
@@ -51,7 +51,8 @@ TEST_P(CubicTest, AboveOrigin) {
// Initialize the state.
clock_.AdvanceTime(one_ms_);
const QuicTime initial_time = clock_.ApproximateNow();
- current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
+ current_cwnd =
+ cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min, initial_time);
ASSERT_EQ(expected_cwnd, current_cwnd);
const QuicPacketCount initial_cwnd = current_cwnd;
// Normal TCP phase.
@@ -64,12 +65,13 @@ TEST_P(CubicTest, AboveOrigin) {
const QuicByteCount max_per_ack_cwnd = current_cwnd;
for (QuicPacketCount n = 1; n < max_per_ack_cwnd / kNConnectionAlpha; ++n) {
// Call once per ACK.
- const QuicByteCount next_cwnd =
- cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
+ const QuicByteCount next_cwnd = cubic_.CongestionWindowAfterAck(
+ current_cwnd, rtt_min, clock_.ApproximateNow());
ASSERT_EQ(current_cwnd, next_cwnd);
}
clock_.AdvanceTime(hundred_ms_);
- current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow());
if (fix_convex_mode_) {
// When we fix convex mode and the uint64 arithmetic, we
// increase the expected_cwnd only after after the first 100ms,
@@ -86,10 +88,12 @@ TEST_P(CubicTest, AboveOrigin) {
for (QuicPacketCount n = 1; n < current_cwnd; ++n) {
// Call once per ACK.
ASSERT_EQ(current_cwnd,
- cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min));
+ cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow()));
}
clock_.AdvanceTime(hundred_ms_);
- current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow());
}
// Total time elapsed so far; add min_rtt (0.1s) here as well.
const float elapsed_time_ms =
@@ -113,7 +117,8 @@ TEST_P(CubicTest, LossEvents) {
// Initialize the state.
clock_.AdvanceTime(one_ms_);
EXPECT_EQ(expected_cwnd,
- cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min));
+ cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow()));
expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
@@ -133,17 +138,20 @@ TEST_P(CubicTest, BelowOrigin) {
// Initialize the state.
clock_.AdvanceTime(one_ms_);
EXPECT_EQ(expected_cwnd,
- cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min));
+ cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow()));
expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
current_cwnd = expected_cwnd;
// First update after loss to initialize the epoch.
- current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow());
// Cubic phase.
for (int i = 0; i < 40; ++i) {
clock_.AdvanceTime(hundred_ms_);
- current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
+ current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
+ clock_.ApproximateNow());
}
expected_cwnd = 399;
EXPECT_EQ(expected_cwnd, current_cwnd);
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes_test.cc ('k') | net/quic/core/congestion_control/tcp_cubic_sender_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698