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

Side by Side Diff: net/base/network_quality_estimator_unittest.cc

Issue 1841693003: Remove TimeTicks::UnixEpoch from net_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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/base/network_quality_estimator.h" 5 #include "net/base/network_quality_estimator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 // Verifies that the percentiles are correctly computed. Observations have 368 // Verifies that the percentiles are correctly computed. Observations have
369 // different timestamps with half the observations being very old and the rest 369 // different timestamps with half the observations being very old and the rest
370 // of them being very recent. Percentiles should factor in recent observations 370 // of them being very recent. Percentiles should factor in recent observations
371 // much more heavily than older samples. Kbps percentiles must be in decreasing 371 // much more heavily than older samples. Kbps percentiles must be in decreasing
372 // order. RTT percentiles must be in increasing order. 372 // order. RTT percentiles must be in increasing order.
373 TEST(NetworkQualityEstimatorTest, PercentileDifferentTimestamps) { 373 TEST(NetworkQualityEstimatorTest, PercentileDifferentTimestamps) {
374 std::map<std::string, std::string> variation_params; 374 std::map<std::string, std::string> variation_params;
375 TestNetworkQualityEstimator estimator(variation_params); 375 TestNetworkQualityEstimator estimator(variation_params);
376 base::TimeTicks now = base::TimeTicks::Now(); 376 base::TimeTicks now = base::TimeTicks::Now();
377 base::TimeTicks very_old = base::TimeTicks::UnixEpoch(); 377 base::TimeTicks very_old = now - base::TimeDelta::FromDays(365);
378 378
379 // First 50 samples have very old timestamp. 379 // First 50 samples have very old timestamp.
380 for (int i = 1; i <= 50; ++i) { 380 for (int i = 1; i <= 50; ++i) {
381 estimator.downstream_throughput_kbps_observations_.AddObservation( 381 estimator.downstream_throughput_kbps_observations_.AddObservation(
382 NetworkQualityEstimator::ThroughputObservation( 382 NetworkQualityEstimator::ThroughputObservation(
383 i, very_old, NetworkQualityEstimator::URL_REQUEST)); 383 i, very_old, NetworkQualityEstimator::URL_REQUEST));
384 estimator.rtt_observations_.AddObservation( 384 estimator.rtt_observations_.AddObservation(
385 NetworkQualityEstimator::RttObservation( 385 NetworkQualityEstimator::RttObservation(
386 base::TimeDelta::FromMilliseconds(i), very_old, 386 base::TimeDelta::FromMilliseconds(i), very_old,
387 NetworkQualityEstimator::URL_REQUEST)); 387 NetworkQualityEstimator::URL_REQUEST));
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1105
1106 EXPECT_EQ(4U, rtt_observer.observations().size()); 1106 EXPECT_EQ(4U, rtt_observer.observations().size());
1107 EXPECT_EQ(2U, throughput_observer.observations().size()); 1107 EXPECT_EQ(2U, throughput_observer.observations().size());
1108 1108
1109 EXPECT_EQ(tcp_rtt.InMilliseconds(), rtt_observer.observations().at(2).rtt_ms); 1109 EXPECT_EQ(tcp_rtt.InMilliseconds(), rtt_observer.observations().at(2).rtt_ms);
1110 EXPECT_EQ(quic_rtt.InMilliseconds(), 1110 EXPECT_EQ(quic_rtt.InMilliseconds(),
1111 rtt_observer.observations().at(3).rtt_ms); 1111 rtt_observer.observations().at(3).rtt_ms);
1112 } 1112 }
1113 1113
1114 } // namespace net 1114 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698