| 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.
|
|
|