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

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

Issue 893003002: Data Reduction Proxy class ownership updates and Settings cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sgurun CR comments 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_network_delegate_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
index 721574ba48eb62f70d3c153707cbd6521c401683..d78f797e1600b21a860237c20ca0b1fadf0e4a85 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -86,11 +86,11 @@ class DataReductionProxyNetworkDelegateTest : public testing::Test {
TestDataReductionProxyParams::HAS_EVERYTHING &
~TestDataReductionProxyParams::HAS_DEV_ORIGIN &
~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN,
- DataReductionProxyTestContext::SKIP_SETTINGS_INITIALIZATION));
+ DataReductionProxyTestContext::DEFAULT_TEST_CONTEXT_OPTIONS));
request_options_.reset(
new DataReductionProxyRequestOptions(
- kClient, params(), test_context_->task_runner()));
+ kClient, params(), test_context_->task_runner()));
data_reduction_proxy_network_delegate_.reset(
new DataReductionProxyNetworkDelegate(
@@ -140,12 +140,16 @@ class DataReductionProxyNetworkDelegateTest : public testing::Test {
return test_context_->config()->test_params();
}
+ TestDataReductionProxyIOData* io_data() const {
+ return test_context_->io_data();
+ }
+
TestingPrefServiceSimple* pref_service() const {
return test_context_->pref_service();
}
- scoped_ptr<DataReductionProxyStatisticsPrefs> CreateStatisticsPrefs() {
- return test_context_->CreateStatisticsPrefs().Pass();
+ DataReductionProxyStatisticsPrefs* statistics_prefs() const {
+ return test_context_->data_reduction_proxy_service()->statistics_prefs();
}
scoped_ptr<DataReductionProxyRequestOptions> request_options_;
@@ -410,14 +414,11 @@ TEST_F(DataReductionProxyNetworkDelegateTest, TotalLengths) {
const int64 kOriginalLength = 200;
const int64 kReceivedLength = 100;
- scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs =
- CreateStatisticsPrefs();
PrefRegistrySimple* registry = pref_service()->registry();
data_reduction_proxy::RegisterSimpleProfilePrefs(registry);
- data_reduction_proxy_network_delegate_->
- data_reduction_proxy_statistics_prefs_ =
- statistics_prefs->GetWeakPtr();
+ data_reduction_proxy_network_delegate_->data_reduction_proxy_io_data_ =
+ io_data();
data_reduction_proxy_network_delegate_->UpdateContentLengthPrefs(
kReceivedLength, kOriginalLength,
@@ -426,12 +427,12 @@ TEST_F(DataReductionProxyNetworkDelegateTest, TotalLengths) {
UNKNOWN_TYPE);
EXPECT_EQ(kReceivedLength,
- statistics_prefs->GetInt64(
+ statistics_prefs()->GetInt64(
data_reduction_proxy::prefs::kHttpReceivedContentLength));
EXPECT_FALSE(pref_service()->GetBoolean(
data_reduction_proxy::prefs::kDataReductionProxyEnabled));
EXPECT_EQ(kOriginalLength,
- statistics_prefs->GetInt64(
+ statistics_prefs()->GetInt64(
data_reduction_proxy::prefs::kHttpOriginalContentLength));
// Record the same numbers again, and total lengths should be doubled.
@@ -442,12 +443,12 @@ TEST_F(DataReductionProxyNetworkDelegateTest, TotalLengths) {
UNKNOWN_TYPE);
EXPECT_EQ(kReceivedLength * 2,
- statistics_prefs->GetInt64(
+ statistics_prefs()->GetInt64(
data_reduction_proxy::prefs::kHttpReceivedContentLength));
EXPECT_FALSE(pref_service()->GetBoolean(
data_reduction_proxy::prefs::kDataReductionProxyEnabled));
EXPECT_EQ(kOriginalLength * 2,
- statistics_prefs->GetInt64(
+ statistics_prefs()->GetInt64(
data_reduction_proxy::prefs::kHttpOriginalContentLength));
}

Powered by Google App Engine
This is Rietveld 408576698