Chromium Code Reviews| 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); |