| Index: net/quic/congestion_control/cubic_test.cc
|
| diff --git a/net/quic/congestion_control/cubic_test.cc b/net/quic/congestion_control/cubic_test.cc
|
| index 915274a13d371934a408e189f4d5f2c09c8008ba..88572467c8f7599f2ae4ce880ac69c16e3884124 100644
|
| --- a/net/quic/congestion_control/cubic_test.cc
|
| +++ b/net/quic/congestion_control/cubic_test.cc
|
| @@ -16,15 +16,14 @@ const float kBeta = 0.7f; // Default Cubic backoff factor.
|
| const uint32 kNumConnections = 2;
|
| const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections;
|
| const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections *
|
| - (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
|
| + (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
|
|
|
| class CubicTest : public ::testing::Test {
|
| protected:
|
| CubicTest()
|
| : one_ms_(QuicTime::Delta::FromMilliseconds(1)),
|
| hundred_ms_(QuicTime::Delta::FromMilliseconds(100)),
|
| - cubic_(&clock_, &stats_) {
|
| - }
|
| + cubic_(&clock_, &stats_) {}
|
| const QuicTime::Delta one_ms_;
|
| const QuicTime::Delta hundred_ms_;
|
| MockClock clock_;
|
| @@ -47,7 +46,8 @@ TEST_F(CubicTest, AboveOrigin) {
|
| for (uint32 n = 1; n < current_cwnd / kNConnectionAlpha; ++n) {
|
| // Call once per ACK.
|
| EXPECT_NEAR(current_cwnd,
|
| - cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min), 1);
|
| + cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min),
|
| + 1);
|
| }
|
| clock_.AdvanceTime(hundred_ms_);
|
| current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
|
| @@ -67,8 +67,8 @@ TEST_F(CubicTest, AboveOrigin) {
|
| // Total time elapsed so far; add min_rtt (0.1s) here as well.
|
| float elapsed_time_s = 10.0f + 0.1f;
|
| // |expected_cwnd| is initial value of cwnd + K * t^3, where K = 0.4.
|
| - expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410)
|
| - / 1024;
|
| + expected_cwnd =
|
| + 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410) / 1024;
|
| EXPECT_EQ(expected_cwnd, current_cwnd);
|
| }
|
|
|
| @@ -89,8 +89,8 @@ TEST_F(CubicTest, CwndIncreaseStatsDuringConvexRegion) {
|
| // Advance current time so that cwnd update is allowed to happen by Cubic.
|
| clock_.AdvanceTime(hundred_ms_);
|
| current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
|
| - EXPECT_NEAR(expected_cwnd - 10, stats_.cwnd_increase_congestion_avoidance,
|
| - 1);
|
| + EXPECT_NEAR(
|
| + expected_cwnd - 10, stats_.cwnd_increase_congestion_avoidance, 1);
|
| EXPECT_NEAR(1u, stats_.cwnd_increase_cubic_mode, 1);
|
| expected_cwnd++;
|
| }
|
| @@ -110,14 +110,13 @@ TEST_F(CubicTest, CwndIncreaseStatsDuringConvexRegion) {
|
| // Total time elapsed so far; add min_rtt (0.1s) here as well.
|
| float elapsed_time_s = 10.0f + 0.1f;
|
| // |expected_cwnd| is initial value of cwnd + K * t^3, where K = 0.4.
|
| - expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410)
|
| - / 1024;
|
| + expected_cwnd =
|
| + 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410) / 1024;
|
| EXPECT_EQ(expected_cwnd - old_cwnd, stats_.cwnd_increase_cubic_mode);
|
| EXPECT_EQ(expected_cwnd - old_cwnd,
|
| stats_.cwnd_increase_congestion_avoidance);
|
| }
|
|
|
| -
|
| TEST_F(CubicTest, LossEvents) {
|
| const QuicTime::Delta rtt_min = hundred_ms_;
|
| uint32 current_cwnd = 422;
|
| @@ -149,11 +148,11 @@ TEST_F(CubicTest, BelowOrigin) {
|
| current_cwnd = expected_cwnd;
|
| // First update after loss to initialize the epoch.
|
| current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
|
| - uint32 old_cwnd = current_cwnd;
|
| + uint32 old_cwnd = current_cwnd;
|
| // Cubic phase.
|
| stats_.cwnd_increase_cubic_mode = 0;
|
| stats_.cwnd_increase_congestion_avoidance = 0;
|
| - for (int i = 0; i < 40 ; ++i) {
|
| + for (int i = 0; i < 40; ++i) {
|
| clock_.AdvanceTime(hundred_ms_);
|
| current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
|
| }
|
|
|