OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/core/congestion_control/cubic_bytes.h" | 5 #include "net/quic/core/congestion_control/cubic_bytes.h" |
6 | 6 |
7 #include <cstdint> | 7 #include <cstdint> |
8 | 8 |
9 #include "net/quic/platform/api/quic_flags.h" | 9 #include "net/quic/platform/api/quic_flags.h" |
10 #include "net/quic/platform/api/quic_str_cat.h" | 10 #include "net/quic/platform/api/quic_str_cat.h" |
| 11 #include "net/quic/platform/api/quic_test.h" |
11 #include "net/quic/test_tools/mock_clock.h" | 12 #include "net/quic/test_tools/mock_clock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | |
13 | 13 |
14 using std::string; | 14 using std::string; |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 namespace test { | 17 namespace test { |
18 namespace { | 18 namespace { |
19 | 19 |
20 const float kBeta = 0.7f; // Default Cubic backoff factor. | 20 const float kBeta = 0.7f; // Default Cubic backoff factor. |
21 const float kBetaLastMax = 0.85f; // Default Cubic backoff factor. | 21 const float kBetaLastMax = 0.85f; // Default Cubic backoff factor. |
22 const uint32_t kNumConnections = 2; | 22 const uint32_t kNumConnections = 2; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 params.push_back(param); | 85 params.push_back(param); |
86 } | 86 } |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
90 return params; | 90 return params; |
91 } | 91 } |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 class CubicBytesTest : public ::testing::TestWithParam<TestParams> { | 95 class CubicBytesTest : public QuicTestWithParam<TestParams> { |
96 protected: | 96 protected: |
97 CubicBytesTest() | 97 CubicBytesTest() |
98 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), | 98 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), |
99 hundred_ms_(QuicTime::Delta::FromMilliseconds(100)), | 99 hundred_ms_(QuicTime::Delta::FromMilliseconds(100)), |
100 cubic_(&clock_) { | 100 cubic_(&clock_) { |
101 cubic_.SetFixConvexMode(GetParam().fix_convex_mode); | 101 cubic_.SetFixConvexMode(GetParam().fix_convex_mode); |
102 cubic_.SetFixCubicQuantization(GetParam().fix_cubic_quantization); | 102 cubic_.SetFixCubicQuantization(GetParam().fix_cubic_quantization); |
103 cubic_.SetFixBetaLastMax(GetParam().fix_beta_last_max); | 103 cubic_.SetFixBetaLastMax(GetParam().fix_beta_last_max); |
104 cubic_.SetAllowPerAckUpdates(GetParam().allow_per_ack_updates); | 104 cubic_.SetAllowPerAckUpdates(GetParam().allow_per_ack_updates); |
105 } | 105 } |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 clock_.AdvanceTime(hundred_ms_); | 544 clock_.AdvanceTime(hundred_ms_); |
545 current_cwnd = cubic_.CongestionWindowAfterAck( | 545 current_cwnd = cubic_.CongestionWindowAfterAck( |
546 kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow()); | 546 kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow()); |
547 } | 547 } |
548 expected_cwnd = 553632; | 548 expected_cwnd = 553632; |
549 EXPECT_EQ(expected_cwnd, current_cwnd); | 549 EXPECT_EQ(expected_cwnd, current_cwnd); |
550 } | 550 } |
551 | 551 |
552 } // namespace test | 552 } // namespace test |
553 } // namespace net | 553 } // namespace net |
OLD | NEW |