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

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

Issue 1335943002: Avoid warnings in NetworkQualityEstimatorTest.TestCaching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 // Entry will be added for (2G, "test1"). 505 // Entry will be added for (2G, "test1").
506 // Also, set the network quality for (2G, "test1") so that it is stored in 506 // Also, set the network quality for (2G, "test1") so that it is stored in
507 // the cache. 507 // the cache.
508 estimator.downstream_throughput_kbps_observations_.AddObservation( 508 estimator.downstream_throughput_kbps_observations_.AddObservation(
509 NetworkQualityEstimator::Observation(1, base::TimeTicks::Now())); 509 NetworkQualityEstimator::Observation(1, base::TimeTicks::Now()));
510 estimator.rtt_msec_observations_.AddObservation( 510 estimator.rtt_msec_observations_.AddObservation(
511 NetworkQualityEstimator::Observation(1000, base::TimeTicks::Now())); 511 NetworkQualityEstimator::Observation(1000, base::TimeTicks::Now()));
512 512
513 estimator.SimulateNetworkChangeTo( 513 estimator.SimulateNetworkChangeTo(
514 NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-1"); 514 NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-1");
515 EXPECT_EQ(++expected_cache_size, estimator.cached_network_qualities_.size()); 515 ++expected_cache_size;
516 EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size());
516 517
517 // Entry will be added for (3G, "test1"). 518 // Entry will be added for (3G, "test1").
518 // Also, set the network quality for (3G, "test1") so that it is stored in 519 // Also, set the network quality for (3G, "test1") so that it is stored in
519 // the cache. 520 // the cache.
520 estimator.downstream_throughput_kbps_observations_.AddObservation( 521 estimator.downstream_throughput_kbps_observations_.AddObservation(
521 NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); 522 NetworkQualityEstimator::Observation(2, base::TimeTicks::Now()));
522 estimator.rtt_msec_observations_.AddObservation( 523 estimator.rtt_msec_observations_.AddObservation(
523 NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); 524 NetworkQualityEstimator::Observation(500, base::TimeTicks::Now()));
524 estimator.SimulateNetworkChangeTo( 525 estimator.SimulateNetworkChangeTo(
525 NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-2"); 526 NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-2");
526 EXPECT_EQ(++expected_cache_size, estimator.cached_network_qualities_.size()); 527 ++expected_cache_size;
528 EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size());
527 529
528 // Entry will not be added for (3G, "test2"). 530 // Entry will not be added for (3G, "test2").
529 estimator.SimulateNetworkChangeTo( 531 estimator.SimulateNetworkChangeTo(
530 NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1"); 532 NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1");
531 EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); 533 EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size());
532 534
533 // Read the network quality for (2G, "test-1"). 535 // Read the network quality for (2G, "test-1").
534 EXPECT_TRUE(estimator.ReadCachedNetworkQualityEstimate()); 536 EXPECT_TRUE(estimator.ReadCachedNetworkQualityEstimate());
535 537
536 base::TimeDelta rtt; 538 base::TimeDelta rtt;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 648
647 int32_t downstream_throughput_kbps; 649 int32_t downstream_throughput_kbps;
648 EXPECT_FALSE(estimator.GetRecentMedianDownlinkThroughputKbps( 650 EXPECT_FALSE(estimator.GetRecentMedianDownlinkThroughputKbps(
649 now + base::TimeDelta::FromSeconds(10), &downstream_throughput_kbps)); 651 now + base::TimeDelta::FromSeconds(10), &downstream_throughput_kbps));
650 EXPECT_TRUE(estimator.GetRecentMedianDownlinkThroughputKbps( 652 EXPECT_TRUE(estimator.GetRecentMedianDownlinkThroughputKbps(
651 now, &downstream_throughput_kbps)); 653 now, &downstream_throughput_kbps));
652 EXPECT_EQ(100, downstream_throughput_kbps); 654 EXPECT_EQ(100, downstream_throughput_kbps);
653 } 655 }
654 656
655 } // namespace net 657 } // 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