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

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

Issue 896713003: Revert of DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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_test_utils.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc
index bab1889904b9ef5ccfbefdacf6b0aa12205e6e55..053b0bcde26d9b861fc3f4e7fd025b37dc17c6ab 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc
@@ -68,6 +68,11 @@
registry->RegisterBooleanPref(prefs::kDataReductionProxyWasEnabledBefore,
false);
+ statistics_prefs_.reset(new DataReductionProxyStatisticsPrefs(
+ &pref_service_,
+ scoped_refptr<base::TestSimpleTaskRunner>(
+ new base::TestSimpleTaskRunner()),
+ base::TimeDelta()));
event_store_.reset(new DataReductionProxyEventStore(
scoped_refptr<base::TestSimpleTaskRunner>(
new base::TestSimpleTaskRunner())));
@@ -85,17 +90,9 @@
received_update->Insert(0, new base::StringValue(base::Int64ToString(i)));
}
last_update_time_ = base::Time::Now().LocalMidnight();
- scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs(
- new DataReductionProxyStatisticsPrefs(
- &pref_service_,
- scoped_refptr<base::TestSimpleTaskRunner>(
- new base::TestSimpleTaskRunner()),
- base::TimeDelta()));
- statistics_prefs->SetInt64(
+ statistics_prefs_->SetInt64(
prefs::kDailyHttpContentLengthLastUpdateDate,
last_update_time_.ToInternalValue());
- settings_->SetDataReductionProxyStatisticsPrefs(
- statistics_prefs.Pass());
expected_params_.reset(new TestDataReductionProxyParams(
DataReductionProxyParams::kAllowed |
DataReductionProxyParams::kFallbackAllowed |
@@ -137,6 +134,7 @@
scoped_refptr<base::TestSimpleTaskRunner>(
new base::TestSimpleTaskRunner()), &net_log_, event_store_.get()));
settings_->configurator_ = configurator_.get();
+ settings_->SetDataReductionProxyStatisticsPrefs(statistics_prefs_.get());
}
// Explicitly generate required instantiations.
@@ -271,13 +269,8 @@
scoped_refptr<net::TestURLRequestContextGetter> request_context =
new net::TestURLRequestContextGetter(base::MessageLoopProxy::current());
- // Delete statistics prefs, otherwise the DCHECK in
- // InitDataReductionProxySettings fails.
- settings_->SetDataReductionProxyStatisticsPrefs(
- scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>());
settings_->InitDataReductionProxySettings(
&pref_service_,
- scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
request_context.get(),
&net_log_,
event_store_.get());

Powered by Google App Engine
This is Rietveld 408576698