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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.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_metrics_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
index 4584d6c605524220360b98bd7d570a75fe5314a5..64b0ed12d67ddc786613a378f069fa1496a7962f 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics_unittest.cc
@@ -90,6 +90,42 @@
TestingPrefServiceSimple pref_service_;
scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs_;
};
+
+TEST_F(ChromeNetworkDataSavingMetricsTest, TotalLengths) {
+ const int64 kOriginalLength = 200;
+ const int64 kReceivedLength = 100;
+
+ UpdateContentLengthPrefs(
+ kReceivedLength, kOriginalLength,
+ pref_service_.GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled),
+ UNKNOWN_TYPE, statistics_prefs_.get());
+
+ EXPECT_EQ(kReceivedLength,
+ statistics_prefs_->GetInt64(
+ data_reduction_proxy::prefs::kHttpReceivedContentLength));
+ EXPECT_FALSE(pref_service_.GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled));
+ EXPECT_EQ(kOriginalLength,
+ statistics_prefs_->GetInt64(
+ data_reduction_proxy::prefs::kHttpOriginalContentLength));
+
+ // Record the same numbers again, and total lengths should be doubled.
+ UpdateContentLengthPrefs(
+ kReceivedLength, kOriginalLength,
+ pref_service_.GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled),
+ UNKNOWN_TYPE, statistics_prefs_.get());
+
+ EXPECT_EQ(kReceivedLength * 2,
+ 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(
+ data_reduction_proxy::prefs::kHttpOriginalContentLength));
+}
// The initial last update time used in test. There is no leap second a few
// days around this time used in the test.

Powered by Google App Engine
This is Rietveld 408576698