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

Unified Diff: net/quic/core/congestion_control/rtt_stats_test.cc

Issue 2309603002: Round results of multiplying QuicBandwidth and QuicTime::Delta rather than truncating. No behavior… (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | net/quic/core/quic_bandwidth.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/congestion_control/rtt_stats_test.cc
diff --git a/net/quic/core/congestion_control/rtt_stats_test.cc b/net/quic/core/congestion_control/rtt_stats_test.cc
index 6848e9b8f31b2f4b8c2b0629272a9e34c52ce516..d894bebd0bedf1d79f900e8dc6a64ac51504e3c2 100644
--- a/net/quic/core/congestion_control/rtt_stats_test.cc
+++ b/net/quic/core/congestion_control/rtt_stats_test.cc
@@ -4,6 +4,7 @@
#include "net/quic/core/congestion_control/rtt_stats.h"
+#include <cmath>
#include <vector>
#include "base/logging.h"
@@ -53,6 +54,20 @@ TEST_F(RttStatsTest, SmoothedRtt) {
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(200), rtt_stats_.smoothed_rtt());
}
+// Ensure that the potential rounding artifacts in EWMA calculation do not cause
+// the SRTT to drift too far from the exact value.
+TEST_F(RttStatsTest, SmoothedRttStability) {
+ for (size_t time = 3; time < 20000; time++) {
+ RttStats stats;
+ for (size_t i = 0; i < 100; i++) {
+ stats.UpdateRtt(QuicTime::Delta::FromMicroseconds(time),
+ QuicTime::Delta::FromMilliseconds(0), QuicTime::Zero());
+ int64_t time_delta_us = stats.smoothed_rtt().ToMicroseconds() - time;
+ ASSERT_LE(std::abs(time_delta_us), 1);
+ }
+ }
+}
+
TEST_F(RttStatsTest, PreviousSmoothedRtt) {
// Verify that ack_delay is corrected for in Smoothed RTT.
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(300),
« no previous file with comments | « no previous file | net/quic/core/quic_bandwidth.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698