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

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

Issue 1316863006: Populate EEP estimate in NQE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use EXPECT_TRUE instead of DCHECK 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 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 26d9d10acf3a701fad4dfcfc0f808ee0b1f0ea54..1c80b09315bb3cf35d6676d867fe0a0ff88612dd 100644
--- a/chrome/browser/android/net/external_estimate_provider_android_unittest.cc
+++ b/chrome/browser/android/net/external_estimate_provider_android_unittest.cc
@@ -6,6 +6,7 @@
#include <stdint.h>
+#include "base/test/histogram_tester.h"
#include "base/time/time.h"
#include "net/base/network_quality_estimator.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,7 +42,10 @@ class TestNetworkQualityEstimator : public net::NetworkQualityEstimator {
~TestNetworkQualityEstimator() override {}
- void OnUpdatedEstimateAvailable() override { notified_ = true; }
+ void OnUpdatedEstimateAvailable() override {
+ notified_ = true;
+ net::NetworkQualityEstimator::OnUpdatedEstimateAvailable();
+ }
bool IsNotified() const { return notified_; }
@@ -56,11 +60,18 @@ class TestExternalEstimateProviderAndroid
: chrome::android::ExternalEstimateProviderAndroid() {}
~TestExternalEstimateProviderAndroid() override {}
using ExternalEstimateProviderAndroid::NotifyUpdatedEstimateAvailable;
+
+ bool GetTimeSinceLastUpdate(
+ base::TimeDelta* time_since_last_update) const override {
+ *time_since_last_update = base::TimeDelta::FromMilliseconds(1);
+ return true;
+ }
};
// Tests if the |ExternalEstimateProviderAndroid| notifies
// |NetworkQualityEstimator|.
TEST(ExternalEstimateProviderAndroidTest, DelegateTest) {
+ base::HistogramTester histogram_tester;
scoped_ptr<TestExternalEstimateProviderAndroid> external_estimate_provider;
external_estimate_provider.reset(new TestExternalEstimateProviderAndroid());
@@ -70,6 +81,32 @@ TEST(ExternalEstimateProviderAndroidTest, DelegateTest) {
external_estimate_provider.Pass(), variation_params);
ptr->NotifyUpdatedEstimateAvailable();
DCHECK(network_quality_estimator.IsNotified());
+
+ // EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE
+ histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 0,
+ 0);
+
+ // EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE
+ histogram_tester.ExpectBucketCount("NQE.ExternalEstimateProviderStatus", 1,
+ 1);
+
+ // EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED
+ // Updated once during NetworkQualityEstimator constructor and again,
+ // 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
« no previous file with comments | « chrome/browser/android/net/external_estimate_provider_android.cc ('k') | net/base/external_estimate_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698