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

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

Issue 188333003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error - added NET_EXPORT_PRIVATE to QuicFixedUint32 Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/net.gyp ('k') | net/quic/congestion_control/fix_rate_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "net/quic/congestion_control/cubic.h" 7 #include "net/quic/congestion_control/cubic.h"
8 #include "net/quic/quic_connection_stats.h" 8 #include "net/quic/quic_connection_stats.h"
9 #include "net/quic/test_tools/mock_clock.h" 9 #include "net/quic/test_tools/mock_clock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 for (uint32 n = 1; n < current_cwnd; ++n) { 59 for (uint32 n = 1; n < current_cwnd; ++n) {
60 // Call once per ACK. 60 // Call once per ACK.
61 EXPECT_EQ(current_cwnd, 61 EXPECT_EQ(current_cwnd,
62 cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min)); 62 cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min));
63 } 63 }
64 clock_.AdvanceTime(hundred_ms_); 64 clock_.AdvanceTime(hundred_ms_);
65 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min); 65 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
66 } 66 }
67 // Total time elapsed so far; add min_rtt (0.1s) here as well. 67 // Total time elapsed so far; add min_rtt (0.1s) here as well.
68 float elapsed_time_s = 10.0f + 0.1f; 68 float elapsed_time_s = 10.0f + 0.1f;
69 // expected_cwnd is initial value of cwnd + K * t^3, where K = 0.4. 69 // |expected_cwnd| is initial value of cwnd + K * t^3, where K = 0.4.
70 expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410) 70 expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410)
71 / 1024; 71 / 1024;
72 EXPECT_EQ(expected_cwnd, current_cwnd); 72 EXPECT_EQ(expected_cwnd, current_cwnd);
73 } 73 }
74 74
75 TEST_F(CubicTest, CwndIncreaseStatsDuringConvexRegion) { 75 TEST_F(CubicTest, CwndIncreaseStatsDuringConvexRegion) {
76 const QuicTime::Delta rtt_min = hundred_ms_; 76 const QuicTime::Delta rtt_min = hundred_ms_;
77 uint32 current_cwnd = 10; 77 uint32 current_cwnd = 10;
78 uint32 expected_cwnd = current_cwnd + 1; 78 uint32 expected_cwnd = current_cwnd + 1;
79 // Initialize controller state. 79 // Initialize controller state.
(...skipping 21 matching lines...) Expand all
101 for (int i = 0; i < 52; ++i) { 101 for (int i = 0; i < 52; ++i) {
102 for (uint32 n = 1; n < current_cwnd; ++n) { 102 for (uint32 n = 1; n < current_cwnd; ++n) {
103 // Call once per ACK. 103 // Call once per ACK.
104 cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min); 104 cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
105 } 105 }
106 clock_.AdvanceTime(hundred_ms_); 106 clock_.AdvanceTime(hundred_ms_);
107 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min); 107 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
108 } 108 }
109 // Total time elapsed so far; add min_rtt (0.1s) here as well. 109 // Total time elapsed so far; add min_rtt (0.1s) here as well.
110 float elapsed_time_s = 10.0f + 0.1f; 110 float elapsed_time_s = 10.0f + 0.1f;
111 // expected_cwnd is initial value of cwnd + K * t^3, where K = 0.4. 111 // |expected_cwnd| is initial value of cwnd + K * t^3, where K = 0.4.
112 expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410) 112 expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410)
113 / 1024; 113 / 1024;
114 EXPECT_EQ(expected_cwnd - old_cwnd, stats_.cwnd_increase_cubic_mode); 114 EXPECT_EQ(expected_cwnd - old_cwnd, stats_.cwnd_increase_cubic_mode);
115 EXPECT_EQ(0u, stats_.cwnd_increase_reno_mode); 115 EXPECT_EQ(0u, stats_.cwnd_increase_reno_mode);
116 } 116 }
117 117
118 118
119 TEST_F(CubicTest, LossEvents) { 119 TEST_F(CubicTest, LossEvents) {
120 const QuicTime::Delta rtt_min = hundred_ms_; 120 const QuicTime::Delta rtt_min = hundred_ms_;
121 uint32 current_cwnd = 422; 121 uint32 current_cwnd = 422;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min); 156 current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
157 } 157 }
158 expected_cwnd = 422; 158 expected_cwnd = 422;
159 EXPECT_EQ(expected_cwnd, current_cwnd); 159 EXPECT_EQ(expected_cwnd, current_cwnd);
160 EXPECT_EQ(expected_cwnd - old_cwnd, stats_.cwnd_increase_cubic_mode); 160 EXPECT_EQ(expected_cwnd - old_cwnd, stats_.cwnd_increase_cubic_mode);
161 EXPECT_EQ(0u, stats_.cwnd_increase_reno_mode); 161 EXPECT_EQ(0u, stats_.cwnd_increase_reno_mode);
162 } 162 }
163 163
164 } // namespace test 164 } // namespace test
165 } // namespace net 165 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/quic/congestion_control/fix_rate_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698