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

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

Issue 2546273002: Record DRP histogram on how long back savings were cleared (Closed)
Patch Set: Rebased Created 4 years 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 52566c0d2b2c30addc3a1e8f0d50f2d458f30ff8..dd162d19880e03c3ddf0f24d4ca3de348707a031 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
@@ -731,6 +731,32 @@ TEST_F(DataReductionProxySettingsTest, TestDaysSinceEnabledExistingUser) {
prefs::kDataReductionProxyLastEnabledTime));
}
+TEST_F(DataReductionProxySettingsTest, TestDaysSinceSavingsCleared) {
+ std::unique_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock());
+ base::SimpleTestClock* clock_ptr = clock.get();
+ clock_ptr->Advance(base::TimeDelta::FromDays(1));
+ ResetSettings(std::move(clock), true, true, false, false);
+
+ InitPrefMembers();
+ base::HistogramTester histogram_tester;
+ test_context_->pref_service()->SetInt64(
+ prefs::kDataReductionProxySavingsClearedNegativeSystemClock,
+ clock_ptr->Now().ToInternalValue());
+
+ settings_->data_reduction_proxy_service_->SetIOData(
+ test_context_->io_data()->GetWeakPtr());
+ test_context_->RunUntilIdle();
+
+ clock_ptr->Advance(base::TimeDelta::FromDays(100));
+
+ // Simulate Chromium startup with data reduction proxy already enabled.
+ settings_->spdy_proxy_auth_enabled_.SetValue(true);
+ settings_->MaybeActivateDataReductionProxy(true /* at_startup */);
+ test_context_->RunUntilIdle();
+ histogram_tester.ExpectUniqueSample(
+ "DataReductionProxy.DaysSinceSavingsCleared.NegativeSystemClock", 100, 1);
+}
+
TEST_F(DataReductionProxySettingsTest, TestGetDailyContentLengths) {
ContentLengthList result =
settings_->GetDailyContentLengths(prefs::kDailyHttpOriginalContentLength);

Powered by Google App Engine
This is Rietveld 408576698