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

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

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 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/cubic_bytes.cc ('k') | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/cubic_bytes_test.cc
diff --git a/net/quic/congestion_control/cubic_bytes_test.cc b/net/quic/congestion_control/cubic_bytes_test.cc
deleted file mode 100644
index 02504b3f98e3b7a85ed9d6a16a528ceca94a2a0d..0000000000000000000000000000000000000000
--- a/net/quic/congestion_control/cubic_bytes_test.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/quic/congestion_control/cubic_bytes.h"
-
-#include "base/logging.h"
-#include "net/quic/test_tools/mock_clock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-namespace test {
-
-const float kBeta = 0.7f; // Default Cubic backoff factor.
-const uint32_t kNumConnections = 2;
-const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections;
-const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections *
- (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
-
-class CubicBytesTest : public ::testing::Test {
- protected:
- CubicBytesTest()
- : one_ms_(QuicTime::Delta::FromMilliseconds(1)),
- hundred_ms_(QuicTime::Delta::FromMilliseconds(100)),
- cubic_(&clock_) {}
- const QuicTime::Delta one_ms_;
- const QuicTime::Delta hundred_ms_;
- MockClock clock_;
- CubicBytes cubic_;
-};
-
-TEST_F(CubicBytesTest, AboveOrigin) {
- // Convex growth.
- const QuicTime::Delta rtt_min = hundred_ms_;
- QuicByteCount current_cwnd = 10 * kDefaultTCPMSS;
- QuicByteCount expected_cwnd = current_cwnd + kDefaultTCPMSS;
- // Initialize the state.
- clock_.AdvanceTime(one_ms_);
- EXPECT_EQ(expected_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
- current_cwnd = expected_cwnd;
- // Normal TCP phase.
- for (int i = 0; i < 48; ++i) {
- for (QuicPacketCount n = 1;
- n < current_cwnd / kDefaultTCPMSS / kNConnectionAlpha; ++n) {
- // Call once per ACK.
- EXPECT_NEAR(current_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min),
- kDefaultTCPMSS);
- }
- clock_.AdvanceTime(hundred_ms_);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
- EXPECT_NEAR(expected_cwnd, current_cwnd, kDefaultTCPMSS);
- expected_cwnd += kDefaultTCPMSS;
- }
- // Cubic phase.
- for (int i = 0; i < 52; ++i) {
- for (QuicPacketCount n = 1; n < current_cwnd / kDefaultTCPMSS; ++n) {
- // Call once per ACK.
- EXPECT_NEAR(current_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min),
- kDefaultTCPMSS);
- }
- clock_.AdvanceTime(hundred_ms_);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
- }
- // 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;
- EXPECT_EQ(expected_cwnd, current_cwnd / kDefaultTCPMSS);
-}
-
-TEST_F(CubicBytesTest, LossEvents) {
- const QuicTime::Delta rtt_min = hundred_ms_;
- QuicByteCount current_cwnd = 422 * kDefaultTCPMSS;
- QuicPacketCount expected_cwnd = current_cwnd + kDefaultTCPMSS;
- // Initialize the state.
- clock_.AdvanceTime(one_ms_);
- EXPECT_EQ(expected_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
- expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
- EXPECT_EQ(expected_cwnd,
- cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
- expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
- EXPECT_EQ(expected_cwnd,
- cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
-}
-
-TEST_F(CubicBytesTest, BelowOrigin) {
- // Concave growth.
- const QuicTime::Delta rtt_min = hundred_ms_;
- QuicByteCount current_cwnd = 422 * kDefaultTCPMSS;
- QuicPacketCount expected_cwnd = current_cwnd + kDefaultTCPMSS;
- // Initialize the state.
- clock_.AdvanceTime(one_ms_);
- EXPECT_EQ(expected_cwnd, cubic_.CongestionWindowAfterAck(
- kDefaultTCPMSS, current_cwnd, rtt_min));
- 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(kDefaultTCPMSS, current_cwnd, rtt_min);
- // Cubic phase.
- for (int i = 0; i < 40; ++i) {
- clock_.AdvanceTime(hundred_ms_);
- current_cwnd =
- cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd, rtt_min);
- }
- expected_cwnd = 422 * kDefaultTCPMSS;
- EXPECT_EQ(expected_cwnd, current_cwnd);
-}
-
-} // namespace test
-} // namespace net
« no previous file with comments | « net/quic/congestion_control/cubic_bytes.cc ('k') | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698