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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc

Issue 1400903002: Data reduction proxy enabled/disabled UMA for all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for trybot components_unittests failure Created 5 years, 2 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
index 2c1b10dec2625e40c6eef9189980e3a012843875..19658bb5a898aee4e55374aab9ba396a1236223e 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
@@ -628,6 +628,35 @@ TEST_F(DataReductionProxySettingsTest, TestLoFiSessionStateHistograms) {
kUMALoFiSessionState, settings_->lo_fi_consecutive_session_disables_ + 3);
}
+TEST_F(DataReductionProxySettingsTest, TestSettingsEnabledStateHistograms) {
+ const char kUMAEnabledState[] = "DataReductionProxy.EnabledState";
+ base::HistogramTester histogram_tester;
+
+ settings_->InitPrefMembers();
+ settings_->data_reduction_proxy_service_->SetIOData(
+ test_context_->io_data()->GetWeakPtr());
+
+ // No settings state histograms should be recorded during startup
+ test_context_->RunUntilIdle();
+ scoped_ptr<base::HistogramSamples> samples(
+ histogram_tester.GetHistogramSamplesSinceCreation(kUMAEnabledState));
+ EXPECT_EQ(0, samples->TotalCount());
sclittle 2015/10/09 20:52:48 Could this be replaced with: histogram_tester.Exp
Raj 2015/10/10 01:51:47 Done.
+
+ settings_->SetDataReductionProxyEnabled(true);
+ test_context_->RunUntilIdle();
+ histogram_tester.ExpectBucketCount(
+ kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON, 1);
+ histogram_tester.ExpectBucketCount(
+ kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF, 0);
+
+ settings_->SetDataReductionProxyEnabled(false);
+ test_context_->RunUntilIdle();
+ histogram_tester.ExpectBucketCount(
+ kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON, 1);
+ histogram_tester.ExpectBucketCount(
+ kUMAEnabledState, DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF, 1);
+}
+
TEST_F(DataReductionProxySettingsTest, TestGetDailyContentLengths) {
ContentLengthList result =
settings_->GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);

Powered by Google App Engine
This is Rietveld 408576698