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

Unified Diff: chrome/browser/android/net/external_estimate_provider_android_unittest.cc

Issue 2010003002: Reduce the number of calls to external estimate provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: chrome/browser/android/net/external_estimate_provider_android_unittest.cc
diff --git a/chrome/browser/android/net/external_estimate_provider_android_unittest.cc b/chrome/browser/android/net/external_estimate_provider_android_unittest.cc
index 1af0fe9fa19dbfa6937dd7acc63a592db79b21f4..bdaadca498eda42d1f4debd4168d34c6c4ae04ea 100644
--- a/chrome/browser/android/net/external_estimate_provider_android_unittest.cc
+++ b/chrome/browser/android/net/external_estimate_provider_android_unittest.cc
@@ -46,12 +46,18 @@ class TestNetworkQualityEstimator : public net::NetworkQualityEstimator {
~TestNetworkQualityEstimator() override {}
- void OnUpdatedEstimateAvailable() override {
+ void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt,
+ int32_t downstream_throughput_kbps,
+ int32_t upstream_throughput_kbps) override {
+ EXPECT_EQ(base::TimeDelta(), rtt);
+ EXPECT_EQ(-1, downstream_throughput_kbps);
+ EXPECT_EQ(-1, upstream_throughput_kbps);
notified_ = true;
- net::NetworkQualityEstimator::OnUpdatedEstimateAvailable();
+ net::NetworkQualityEstimator::OnUpdatedEstimateAvailable(
+ rtt, downstream_throughput_kbps, upstream_throughput_kbps);
}
- bool IsNotified() const { return notified_; }
+ bool notified() const { return notified_; }
private:
bool notified_;
@@ -67,7 +73,7 @@ class TestExternalEstimateProviderAndroid
bool GetTimeSinceLastUpdate(
base::TimeDelta* time_since_last_update) const override {
- *time_since_last_update = base::TimeDelta::FromMilliseconds(1);
+ *time_since_last_update = base::TimeDelta::FromMilliseconds(0);
return true;
}
};
@@ -89,33 +95,17 @@ TEST(ExternalEstimateProviderAndroidTest, DelegateTest) {
TestNetworkQualityEstimator network_quality_estimator(
std::move(external_estimate_provider), variation_params);
ptr->NotifyUpdatedEstimateAvailable();
- DCHECK(network_quality_estimator.IsNotified());
+ EXPECT_TRUE(network_quality_estimator.notified());
- // EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE
- histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 0,
- 0);
+ histogram_tester.ExpectTotalCount("NQE.ExternalEstimateProviderStatus", 2);
// EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE
histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 1,
1);
- // EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED
- // Updated once during NetworkQualityEstimator constructor and again,
bengr 2016/05/27 19:58:42 Why is this no longer needed? (lines 94-118)
tbansal1 2016/05/27 23:39:14 The previous logic was complicated. It was queryin
- // when |OnUpdatedEstimateAvailable| is called.
- histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 2,
- 2);
-
- // EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL
- // Updated once during NetworkQualityEstimator constructor and again,
- // when |OnUpdatedEstimateAvailable| is called.
- histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 3,
- 2);
-
// EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK
histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 4,
1);
-
- histogram_tester.ExpectTotalCount("NQE.ExternalEstimateProviderStatus", 6);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698