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

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

Issue 411823002: Land Recent QUIC Changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase TOT Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/congestion_control/rtt_stats.h" 5 #include "net/quic/congestion_control/rtt_stats.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 // Update once with a 20ms RTT. 166 // Update once with a 20ms RTT.
167 QuicTime::Delta doubled_rtt = initial_rtt.Multiply(2); 167 QuicTime::Delta doubled_rtt = initial_rtt.Multiply(2);
168 rtt_stats_.UpdateRtt(doubled_rtt, QuicTime::Delta::Zero(), QuicTime::Zero()); 168 rtt_stats_.UpdateRtt(doubled_rtt, QuicTime::Delta::Zero(), QuicTime::Zero());
169 EXPECT_EQ(initial_rtt.Multiply(1.125), rtt_stats_.SmoothedRtt()); 169 EXPECT_EQ(initial_rtt.Multiply(1.125), rtt_stats_.SmoothedRtt());
170 170
171 // Expire the smoothed metrics, increasing smoothed rtt and mean deviation. 171 // Expire the smoothed metrics, increasing smoothed rtt and mean deviation.
172 rtt_stats_.ExpireSmoothedMetrics(); 172 rtt_stats_.ExpireSmoothedMetrics();
173 EXPECT_EQ(doubled_rtt, rtt_stats_.SmoothedRtt()); 173 EXPECT_EQ(doubled_rtt, rtt_stats_.SmoothedRtt());
174 EXPECT_EQ(initial_rtt.Multiply(0.875), rtt_stats_.mean_deviation()); 174 EXPECT_EQ(initial_rtt.Multiply(0.875), rtt_stats_.mean_deviation());
175
176 // Now go back down to 5ms and expire the smoothed metrics, and ensure the
177 // mean deviation increases to 15ms.
178 QuicTime::Delta half_rtt = initial_rtt.Multiply(0.5);
179 rtt_stats_.UpdateRtt(half_rtt, QuicTime::Delta::Zero(), QuicTime::Zero());
180 EXPECT_GT(doubled_rtt, rtt_stats_.SmoothedRtt());
181 EXPECT_LT(initial_rtt, rtt_stats_.mean_deviation());
175 } 182 }
176 183
177 } // namespace test 184 } // namespace test
178 } // namespace net 185 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/rtt_stats.cc ('k') | net/quic/congestion_control/send_algorithm_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698