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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc

Issue 473723002: Update data reduction proxy statistics prefs less often on desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tooManyWritesPatch
Patch Set: Created 6 years, 4 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/browser/data_reduction_proxy_settings_test_utils.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc
index ccd3c2dd2b4211d804a2e2053456120998a8b854..128c64de56d6cb64aeb9f2da919bb6be35f9948c 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc
@@ -10,6 +10,8 @@
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/string_number_conversions.h"
+#include "base/test/test_simple_task_runner.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_delayed_pref_service.h"
#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h"
#include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h"
@@ -83,6 +85,11 @@ DataReductionProxySettingsTestBase::~DataReductionProxySettingsTestBase() {}
// testing::Test implementation:
void DataReductionProxySettingsTestBase::SetUp() {
+ delayed_pref_service_ = new DataReductionProxyDelayedPrefService(
+ &pref_service_,
+ scoped_refptr<base::TestSimpleTaskRunner>(
+ new base::TestSimpleTaskRunner()),
+ base::TimeDelta());
PrefRegistrySimple* registry = pref_service_.registry();
registry->RegisterListPref(prefs::kDailyHttpOriginalContentLength);
registry->RegisterListPref(prefs::kDailyHttpReceivedContentLength);
@@ -106,7 +113,7 @@ void DataReductionProxySettingsTestBase::SetUp() {
received_update->Insert(0, new base::StringValue(base::Int64ToString(i)));
}
last_update_time_ = base::Time::Now().LocalMidnight();
- pref_service_.SetInt64(
+ delayed_pref_service_->SetInt64(
prefs::kDailyHttpContentLengthLastUpdateDate,
last_update_time_.ToInternalValue());
expected_params_.reset(new TestDataReductionProxyParams(
@@ -146,6 +153,8 @@ void DataReductionProxySettingsTestBase::ResetSettings(bool allowed,
EXPECT_CALL(*settings, GetURLFetcherForWarmup()).Times(0);
EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0);
settings_.reset(settings);
+ settings_->SetDataReductionProxyDelayedPrefService(
+ delayed_pref_service_->AsWeakPtr());
settings_->configurator_.reset(new TestDataReductionProxyConfig());
}
@@ -303,7 +312,6 @@ void DataReductionProxySettingsTestBase::CheckInitDataReductionProxy(
settings_->InitDataReductionProxySettings(
&pref_service_,
- &pref_service_,
request_context.get());
settings_->SetOnDataReductionEnabledCallback(
base::Bind(&DataReductionProxySettingsTestBase::

Powered by Google App Engine
This is Rietveld 408576698