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

Side by Side Diff: net/quic/core/congestion_control/cubic_test.cc

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "net/quic/core/congestion_control/cubic.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 } 77 }
78 } 78 }
79 return params; 79 return params;
80 } 80 }
81 81
82 } // namespace 82 } // namespace
83 83
84 // TODO(jokulik): Once we've rolled out the cubic convex fix, we will 84 // TODO(jokulik): Once we've rolled out the cubic convex fix, we will
85 // no longer need a parameterized test. 85 // no longer need a parameterized test.
86 class CubicTest : public ::testing::TestWithParam<TestParams> { 86 class CubicTest : public QuicTestWithParam<TestParams> {
87 protected: 87 protected:
88 CubicTest() 88 CubicTest()
89 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), 89 : one_ms_(QuicTime::Delta::FromMilliseconds(1)),
90 hundred_ms_(QuicTime::Delta::FromMilliseconds(100)), 90 hundred_ms_(QuicTime::Delta::FromMilliseconds(100)),
91 cubic_(&clock_) { 91 cubic_(&clock_) {
92 cubic_.SetFixConvexMode(GetParam().fix_convex_mode); 92 cubic_.SetFixConvexMode(GetParam().fix_convex_mode);
93 cubic_.SetFixBetaLastMax(GetParam().fix_beta_last_max); 93 cubic_.SetFixBetaLastMax(GetParam().fix_beta_last_max);
94 cubic_.SetAllowPerAckUpdates(GetParam().allow_per_ack_updates); 94 cubic_.SetAllowPerAckUpdates(GetParam().allow_per_ack_updates);
95 } 95 }
96 96
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 clock_.AdvanceTime(hundred_ms_); 370 clock_.AdvanceTime(hundred_ms_);
371 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min, 371 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
372 clock_.ApproximateNow()); 372 clock_.ApproximateNow());
373 } 373 }
374 expected_cwnd = 399; 374 expected_cwnd = 399;
375 EXPECT_EQ(expected_cwnd, current_cwnd); 375 EXPECT_EQ(expected_cwnd, current_cwnd);
376 } 376 }
377 377
378 } // namespace test 378 } // namespace test
379 } // namespace net 379 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes_test.cc ('k') | net/quic/core/congestion_control/general_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698