| OLD | NEW | 
|---|
| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 217   // Network quality should be unavailable when no observations are available. | 217   // Network quality should be unavailable when no observations are available. | 
| 218   base::TimeDelta rtt; | 218   base::TimeDelta rtt; | 
| 219   EXPECT_FALSE(estimator.GetRTTEstimate(&rtt)); | 219   EXPECT_FALSE(estimator.GetRTTEstimate(&rtt)); | 
| 220   int32_t kbps; | 220   int32_t kbps; | 
| 221   EXPECT_FALSE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); | 221   EXPECT_FALSE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); | 
| 222 | 222 | 
| 223   // Insert samples from {1,2,3,..., 100}. First insert odd samples, then even | 223   // Insert samples from {1,2,3,..., 100}. First insert odd samples, then even | 
| 224   // samples. This helps in verifying that the order of samples does not matter. | 224   // samples. This helps in verifying that the order of samples does not matter. | 
| 225   for (int i = 1; i <= 99; i += 2) { | 225   for (int i = 1; i <= 99; i += 2) { | 
| 226     estimator.downstream_throughput_kbps_observations_.AddObservation( | 226     estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 227         NetworkQualityEstimator::Observation(i, now)); | 227         NetworkQualityEstimator::Observation( | 
|  | 228             i, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 228     estimator.rtt_msec_observations_.AddObservation( | 229     estimator.rtt_msec_observations_.AddObservation( | 
| 229         NetworkQualityEstimator::Observation(i, now)); | 230         NetworkQualityEstimator::Observation( | 
|  | 231             i, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 230     EXPECT_TRUE(estimator.GetRTTEstimate(&rtt)); | 232     EXPECT_TRUE(estimator.GetRTTEstimate(&rtt)); | 
| 231     EXPECT_TRUE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); | 233     EXPECT_TRUE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); | 
| 232   } | 234   } | 
| 233 | 235 | 
| 234   for (int i = 2; i <= 100; i += 2) { | 236   for (int i = 2; i <= 100; i += 2) { | 
| 235     estimator.downstream_throughput_kbps_observations_.AddObservation( | 237     estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 236         NetworkQualityEstimator::Observation(i, now)); | 238         NetworkQualityEstimator::Observation( | 
|  | 239             i, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 237     estimator.rtt_msec_observations_.AddObservation( | 240     estimator.rtt_msec_observations_.AddObservation( | 
| 238         NetworkQualityEstimator::Observation(i, now)); | 241         NetworkQualityEstimator::Observation( | 
|  | 242             i, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 239     EXPECT_TRUE(estimator.GetRTTEstimate(&rtt)); | 243     EXPECT_TRUE(estimator.GetRTTEstimate(&rtt)); | 
| 240     EXPECT_TRUE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); | 244     EXPECT_TRUE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps)); | 
| 241   } | 245   } | 
| 242 | 246 | 
| 243   for (int i = 0; i <= 100; ++i) { | 247   for (int i = 0; i <= 100; ++i) { | 
| 244     // Checks if the difference between the two integers is less than 1. This is | 248     // Checks if the difference between the two integers is less than 1. This is | 
| 245     // required because computed percentiles may be slightly different from | 249     // required because computed percentiles may be slightly different from | 
| 246     // what is expected due to floating point computation errors and integer | 250     // what is expected due to floating point computation errors and integer | 
| 247     // rounding off errors. | 251     // rounding off errors. | 
| 248     EXPECT_NEAR(estimator.GetDownlinkThroughputKbpsEstimateInternal( | 252     EXPECT_NEAR(estimator.GetDownlinkThroughputKbpsEstimateInternal( | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 269 // order. RTT percentiles must be in increasing order. | 273 // order. RTT percentiles must be in increasing order. | 
| 270 TEST(NetworkQualityEstimatorTest, PercentileDifferentTimestamps) { | 274 TEST(NetworkQualityEstimatorTest, PercentileDifferentTimestamps) { | 
| 271   std::map<std::string, std::string> variation_params; | 275   std::map<std::string, std::string> variation_params; | 
| 272   TestNetworkQualityEstimator estimator(variation_params); | 276   TestNetworkQualityEstimator estimator(variation_params); | 
| 273   base::TimeTicks now = base::TimeTicks::Now(); | 277   base::TimeTicks now = base::TimeTicks::Now(); | 
| 274   base::TimeTicks very_old = base::TimeTicks::UnixEpoch(); | 278   base::TimeTicks very_old = base::TimeTicks::UnixEpoch(); | 
| 275 | 279 | 
| 276   // First 50 samples have very old timestamp. | 280   // First 50 samples have very old timestamp. | 
| 277   for (int i = 1; i <= 50; ++i) { | 281   for (int i = 1; i <= 50; ++i) { | 
| 278     estimator.downstream_throughput_kbps_observations_.AddObservation( | 282     estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 279         NetworkQualityEstimator::Observation(i, very_old)); | 283         NetworkQualityEstimator::Observation( | 
|  | 284             i, very_old, | 
|  | 285             NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 280     estimator.rtt_msec_observations_.AddObservation( | 286     estimator.rtt_msec_observations_.AddObservation( | 
| 281         NetworkQualityEstimator::Observation(i, very_old)); | 287         NetworkQualityEstimator::Observation( | 
|  | 288             i, very_old, | 
|  | 289             NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 282   } | 290   } | 
| 283 | 291 | 
| 284   // Next 50 (i.e., from 51 to 100) have recent timestamp. | 292   // Next 50 (i.e., from 51 to 100) have recent timestamp. | 
| 285   for (int i = 51; i <= 100; ++i) { | 293   for (int i = 51; i <= 100; ++i) { | 
| 286     estimator.downstream_throughput_kbps_observations_.AddObservation( | 294     estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 287         NetworkQualityEstimator::Observation(i, now)); | 295         NetworkQualityEstimator::Observation( | 
|  | 296             i, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 288     estimator.rtt_msec_observations_.AddObservation( | 297     estimator.rtt_msec_observations_.AddObservation( | 
| 289         NetworkQualityEstimator::Observation(i, now)); | 298         NetworkQualityEstimator::Observation( | 
|  | 299             i, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 290   } | 300   } | 
| 291 | 301 | 
| 292   // Older samples have very little weight. So, all percentiles are >= 51 | 302   // Older samples have very little weight. So, all percentiles are >= 51 | 
| 293   // (lowest value among recent observations). | 303   // (lowest value among recent observations). | 
| 294   for (int i = 1; i < 100; ++i) { | 304   for (int i = 1; i < 100; ++i) { | 
| 295     // Checks if the difference between the two integers is less than 1. This is | 305     // Checks if the difference between the two integers is less than 1. This is | 
| 296     // required because computed percentiles may be slightly different from | 306     // required because computed percentiles may be slightly different from | 
| 297     // what is expected due to floating point computation errors and integer | 307     // what is expected due to floating point computation errors and integer | 
| 298     // rounding off errors. | 308     // rounding off errors. | 
| 299     EXPECT_NEAR(estimator.GetDownlinkThroughputKbpsEstimateInternal( | 309     EXPECT_NEAR(estimator.GetDownlinkThroughputKbpsEstimateInternal( | 
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 488 // Test if the network estimates are cached when network change notification | 498 // Test if the network estimates are cached when network change notification | 
| 489 // is invoked. | 499 // is invoked. | 
| 490 TEST(NetworkQualityEstimatorTest, TestCaching) { | 500 TEST(NetworkQualityEstimatorTest, TestCaching) { | 
| 491   std::map<std::string, std::string> variation_params; | 501   std::map<std::string, std::string> variation_params; | 
| 492   TestNetworkQualityEstimator estimator(variation_params); | 502   TestNetworkQualityEstimator estimator(variation_params); | 
| 493   size_t expected_cache_size = 0; | 503   size_t expected_cache_size = 0; | 
| 494   EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); | 504   EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); | 
| 495 | 505 | 
| 496   // Cache entry will not be added for (NONE, ""). | 506   // Cache entry will not be added for (NONE, ""). | 
| 497   estimator.downstream_throughput_kbps_observations_.AddObservation( | 507   estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 498       NetworkQualityEstimator::Observation(1, base::TimeTicks::Now())); | 508       NetworkQualityEstimator::Observation( | 
|  | 509           1, base::TimeTicks::Now(), | 
|  | 510           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 499   estimator.rtt_msec_observations_.AddObservation( | 511   estimator.rtt_msec_observations_.AddObservation( | 
| 500       NetworkQualityEstimator::Observation(1000, base::TimeTicks::Now())); | 512       NetworkQualityEstimator::Observation( | 
|  | 513           1000, base::TimeTicks::Now(), | 
|  | 514           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 501   estimator.SimulateNetworkChangeTo( | 515   estimator.SimulateNetworkChangeTo( | 
| 502       NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1"); | 516       NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1"); | 
| 503   EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); | 517   EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); | 
| 504 | 518 | 
| 505   // Entry will be added for (2G, "test1"). | 519   // Entry will be added for (2G, "test1"). | 
| 506   // Also, set the network quality for (2G, "test1") so that it is stored in | 520   // Also, set the network quality for (2G, "test1") so that it is stored in | 
| 507   // the cache. | 521   // the cache. | 
| 508   estimator.downstream_throughput_kbps_observations_.AddObservation( | 522   estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 509       NetworkQualityEstimator::Observation(1, base::TimeTicks::Now())); | 523       NetworkQualityEstimator::Observation( | 
|  | 524           1, base::TimeTicks::Now(), | 
|  | 525           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 510   estimator.rtt_msec_observations_.AddObservation( | 526   estimator.rtt_msec_observations_.AddObservation( | 
| 511       NetworkQualityEstimator::Observation(1000, base::TimeTicks::Now())); | 527       NetworkQualityEstimator::Observation( | 
|  | 528           1000, base::TimeTicks::Now(), | 
|  | 529           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 512 | 530 | 
| 513   estimator.SimulateNetworkChangeTo( | 531   estimator.SimulateNetworkChangeTo( | 
| 514       NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-1"); | 532       NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-1"); | 
| 515   EXPECT_EQ(++expected_cache_size, estimator.cached_network_qualities_.size()); | 533   EXPECT_EQ(++expected_cache_size, estimator.cached_network_qualities_.size()); | 
| 516 | 534 | 
| 517   // Entry will be added for (3G, "test1"). | 535   // Entry will be added for (3G, "test1"). | 
| 518   // Also, set the network quality for (3G, "test1") so that it is stored in | 536   // Also, set the network quality for (3G, "test1") so that it is stored in | 
| 519   // the cache. | 537   // the cache. | 
| 520   estimator.downstream_throughput_kbps_observations_.AddObservation( | 538   estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 521       NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); | 539       NetworkQualityEstimator::Observation( | 
|  | 540           2, base::TimeTicks::Now(), | 
|  | 541           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 522   estimator.rtt_msec_observations_.AddObservation( | 542   estimator.rtt_msec_observations_.AddObservation( | 
| 523       NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); | 543       NetworkQualityEstimator::Observation( | 
|  | 544           500, base::TimeTicks::Now(), | 
|  | 545           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 524   estimator.SimulateNetworkChangeTo( | 546   estimator.SimulateNetworkChangeTo( | 
| 525       NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-2"); | 547       NetworkChangeNotifier::ConnectionType::CONNECTION_3G, "test-2"); | 
| 526   EXPECT_EQ(++expected_cache_size, estimator.cached_network_qualities_.size()); | 548   EXPECT_EQ(++expected_cache_size, estimator.cached_network_qualities_.size()); | 
| 527 | 549 | 
| 528   // Entry will not be added for (3G, "test2"). | 550   // Entry will not be added for (3G, "test2"). | 
| 529   estimator.SimulateNetworkChangeTo( | 551   estimator.SimulateNetworkChangeTo( | 
| 530       NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1"); | 552       NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test-1"); | 
| 531   EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); | 553   EXPECT_EQ(expected_cache_size, estimator.cached_network_qualities_.size()); | 
| 532 | 554 | 
| 533   // Read the network quality for (2G, "test-1"). | 555   // Read the network quality for (2G, "test-1"). | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 576       std::string()); | 598       std::string()); | 
| 577   EXPECT_EQ(0U, estimator.cached_network_qualities_.size()); | 599   EXPECT_EQ(0U, estimator.cached_network_qualities_.size()); | 
| 578 | 600 | 
| 579   // Add 100 more networks than the maximum size of the cache. | 601   // Add 100 more networks than the maximum size of the cache. | 
| 580   size_t network_count = | 602   size_t network_count = | 
| 581       NetworkQualityEstimator::kMaximumNetworkQualityCacheSize + 100; | 603       NetworkQualityEstimator::kMaximumNetworkQualityCacheSize + 100; | 
| 582 | 604 | 
| 583   base::TimeTicks update_time_of_network_100; | 605   base::TimeTicks update_time_of_network_100; | 
| 584   for (size_t i = 0; i < network_count; ++i) { | 606   for (size_t i = 0; i < network_count; ++i) { | 
| 585     estimator.downstream_throughput_kbps_observations_.AddObservation( | 607     estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 586         NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); | 608         NetworkQualityEstimator::Observation( | 
|  | 609             2, base::TimeTicks::Now(), | 
|  | 610             NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 587     estimator.rtt_msec_observations_.AddObservation( | 611     estimator.rtt_msec_observations_.AddObservation( | 
| 588         NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); | 612         NetworkQualityEstimator::Observation( | 
|  | 613             500, base::TimeTicks::Now(), | 
|  | 614             NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 589 | 615 | 
| 590     if (i == 100) | 616     if (i == 100) | 
| 591       update_time_of_network_100 = base::TimeTicks::Now(); | 617       update_time_of_network_100 = base::TimeTicks::Now(); | 
| 592 | 618 | 
| 593     estimator.SimulateNetworkChangeTo( | 619     estimator.SimulateNetworkChangeTo( | 
| 594         net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, | 620         net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, | 
| 595         base::IntToString(i)); | 621         base::IntToString(i)); | 
| 596     if (i < NetworkQualityEstimator::kMaximumNetworkQualityCacheSize) | 622     if (i < NetworkQualityEstimator::kMaximumNetworkQualityCacheSize) | 
| 597       EXPECT_EQ(i, estimator.cached_network_qualities_.size()); | 623       EXPECT_EQ(i, estimator.cached_network_qualities_.size()); | 
| 598     EXPECT_LE(estimator.cached_network_qualities_.size(), | 624     EXPECT_LE(estimator.cached_network_qualities_.size(), | 
| 599               static_cast<size_t>( | 625               static_cast<size_t>( | 
| 600                   NetworkQualityEstimator::kMaximumNetworkQualityCacheSize)); | 626                   NetworkQualityEstimator::kMaximumNetworkQualityCacheSize)); | 
| 601   } | 627   } | 
| 602   // One more call so that the last network is also written to cache. | 628   // One more call so that the last network is also written to cache. | 
| 603   estimator.downstream_throughput_kbps_observations_.AddObservation( | 629   estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 604       NetworkQualityEstimator::Observation(2, base::TimeTicks::Now())); | 630       NetworkQualityEstimator::Observation( | 
|  | 631           2, base::TimeTicks::Now(), | 
|  | 632           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 605   estimator.rtt_msec_observations_.AddObservation( | 633   estimator.rtt_msec_observations_.AddObservation( | 
| 606       NetworkQualityEstimator::Observation(500, base::TimeTicks::Now())); | 634       NetworkQualityEstimator::Observation( | 
|  | 635           500, base::TimeTicks::Now(), | 
|  | 636           NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 607   estimator.SimulateNetworkChangeTo( | 637   estimator.SimulateNetworkChangeTo( | 
| 608       net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, | 638       net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, | 
| 609       base::IntToString(network_count - 1)); | 639       base::IntToString(network_count - 1)); | 
| 610   EXPECT_EQ(static_cast<size_t>( | 640   EXPECT_EQ(static_cast<size_t>( | 
| 611                 NetworkQualityEstimator::kMaximumNetworkQualityCacheSize), | 641                 NetworkQualityEstimator::kMaximumNetworkQualityCacheSize), | 
| 612             estimator.cached_network_qualities_.size()); | 642             estimator.cached_network_qualities_.size()); | 
| 613 | 643 | 
| 614   // Test that the cache is LRU by examining its contents. Networks in cache | 644   // Test that the cache is LRU by examining its contents. Networks in cache | 
| 615   // must all be newer than the 100th network. | 645   // must all be newer than the 100th network. | 
| 616   for (NetworkQualityEstimator::CachedNetworkQualities::iterator it = | 646   for (NetworkQualityEstimator::CachedNetworkQualities::iterator it = | 
| 617            estimator.cached_network_qualities_.begin(); | 647            estimator.cached_network_qualities_.begin(); | 
| 618        it != estimator.cached_network_qualities_.end(); ++it) { | 648        it != estimator.cached_network_qualities_.end(); ++it) { | 
| 619     EXPECT_GE((it->second).last_update_time_, update_time_of_network_100); | 649     EXPECT_GE((it->second).last_update_time_, update_time_of_network_100); | 
| 620   } | 650   } | 
| 621 } | 651 } | 
| 622 | 652 | 
| 623 TEST(NetworkQualityEstimatorTest, TestGetMedianRTTSince) { | 653 TEST(NetworkQualityEstimatorTest, TestGetMedianRTTSince) { | 
| 624   std::map<std::string, std::string> variation_params; | 654   std::map<std::string, std::string> variation_params; | 
| 625   TestNetworkQualityEstimator estimator(variation_params); | 655   TestNetworkQualityEstimator estimator(variation_params); | 
| 626   base::TimeTicks now = base::TimeTicks::Now(); | 656   base::TimeTicks now = base::TimeTicks::Now(); | 
| 627   base::TimeTicks old = | 657   base::TimeTicks old = | 
| 628       base::TimeTicks::Now() - base::TimeDelta::FromMilliseconds(1); | 658       base::TimeTicks::Now() - base::TimeDelta::FromMilliseconds(1); | 
| 629 | 659 | 
| 630   // First sample has very old timestamp. | 660   // First sample has very old timestamp. | 
| 631   estimator.downstream_throughput_kbps_observations_.AddObservation( | 661   estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 632       NetworkQualityEstimator::Observation(1, old)); | 662       NetworkQualityEstimator::Observation( | 
|  | 663           1, old, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 633   estimator.rtt_msec_observations_.AddObservation( | 664   estimator.rtt_msec_observations_.AddObservation( | 
| 634       NetworkQualityEstimator::Observation(1, old)); | 665       NetworkQualityEstimator::Observation( | 
|  | 666           1, old, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 635 | 667 | 
| 636   estimator.downstream_throughput_kbps_observations_.AddObservation( | 668   estimator.downstream_throughput_kbps_observations_.AddObservation( | 
| 637       NetworkQualityEstimator::Observation(100, now)); | 669       NetworkQualityEstimator::Observation( | 
|  | 670           100, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 638   estimator.rtt_msec_observations_.AddObservation( | 671   estimator.rtt_msec_observations_.AddObservation( | 
| 639       NetworkQualityEstimator::Observation(100, now)); | 672       NetworkQualityEstimator::Observation( | 
|  | 673           100, now, NetworkQualityEstimator::OBSERVATION_SOURCE_URL_REQUEST)); | 
| 640 | 674 | 
| 641   base::TimeDelta rtt; | 675   base::TimeDelta rtt; | 
| 642   EXPECT_FALSE(estimator.GetRecentMedianRTT( | 676   EXPECT_FALSE(estimator.GetRecentMedianRTT( | 
| 643       now + base::TimeDelta::FromSeconds(10), &rtt)); | 677       now + base::TimeDelta::FromSeconds(10), &rtt)); | 
| 644   EXPECT_TRUE(estimator.GetRecentMedianRTT(now, &rtt)); | 678   EXPECT_TRUE(estimator.GetRecentMedianRTT(now, &rtt)); | 
| 645   EXPECT_EQ(100, rtt.InMilliseconds()); | 679   EXPECT_EQ(100, rtt.InMilliseconds()); | 
| 646 | 680 | 
| 647   int32_t downstream_throughput_kbps; | 681   int32_t downstream_throughput_kbps; | 
| 648   EXPECT_FALSE(estimator.GetRecentMedianDownlinkThroughputKbps( | 682   EXPECT_FALSE(estimator.GetRecentMedianDownlinkThroughputKbps( | 
| 649       now + base::TimeDelta::FromSeconds(10), &downstream_throughput_kbps)); | 683       now + base::TimeDelta::FromSeconds(10), &downstream_throughput_kbps)); | 
| 650   EXPECT_TRUE(estimator.GetRecentMedianDownlinkThroughputKbps( | 684   EXPECT_TRUE(estimator.GetRecentMedianDownlinkThroughputKbps( | 
| 651       now, &downstream_throughput_kbps)); | 685       now, &downstream_throughput_kbps)); | 
| 652   EXPECT_EQ(100, downstream_throughput_kbps); | 686   EXPECT_EQ(100, downstream_throughput_kbps); | 
| 653 } | 687 } | 
| 654 | 688 | 
| 655 }  // namespace net | 689 }  // namespace net | 
| OLD | NEW | 
|---|