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

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: Undo BUILD.gn and fix aw_browser_context 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 7cf609a139d3d4a123d0900208a2c563bde4c266..26882a8767a9b0a87005d2ff06714e0e29d97226 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_statistics_prefs.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() {
+ statistics_prefs_ = new DataReductionProxyStatisticsPrefs(
bengr 2014/08/27 04:53:25 This is a memory leak
megjablon 2014/08/28 20:44:07 Done.
+ &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(
+ statistics_prefs_->SetInt64(
prefs::kDailyHttpContentLengthLastUpdateDate,
last_update_time_.ToInternalValue());
expected_params_.reset(new TestDataReductionProxyParams(
@@ -148,6 +155,8 @@ void DataReductionProxySettingsTestBase::ResetSettings(bool allowed,
settings_.reset(settings);
configurator_.reset(new TestDataReductionProxyConfig());
settings_->configurator_ = configurator_.get();
+ settings_->SetDataReductionProxyStatisticsPrefs(
+ statistics_prefs_);
}
// Explicitly generate required instantiations.
@@ -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