| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
|
| index 071dc4ff90eb5facb1f158bad585a37e292c8289..4c97d2f6c3dfa03f7886a6fb5a5ba1108a976a87 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
|
| @@ -595,20 +595,42 @@ TEST_F(DataReductionProxyCompressionStatsTest, TotalLengths) {
|
| kReceivedLength, kOriginalLength, IsDataReductionProxyEnabled(),
|
| UNKNOWN_TYPE, nullptr, std::string());
|
|
|
| EXPECT_EQ(kReceivedLength * 2,
|
| GetInt64(data_reduction_proxy::prefs::kHttpReceivedContentLength));
|
| EXPECT_FALSE(IsDataReductionProxyEnabled());
|
| EXPECT_EQ(kOriginalLength * 2,
|
| GetInt64(data_reduction_proxy::prefs::kHttpOriginalContentLength));
|
| }
|
|
|
| +TEST_F(DataReductionProxyCompressionStatsTest, TotalLengthsUpdate) {
|
| + const int64_t kOriginalLength = 200;
|
| + const int64_t kReceivedLength = 100;
|
| +
|
| + compression_stats()->UpdateDataSavings(std::string(), kReceivedLength,
|
| + kOriginalLength);
|
| +
|
| + EXPECT_EQ(0,
|
| + GetInt64(data_reduction_proxy::prefs::kHttpReceivedContentLength));
|
| + EXPECT_EQ(kOriginalLength - kReceivedLength,
|
| + GetInt64(data_reduction_proxy::prefs::kHttpOriginalContentLength));
|
| +
|
| + // Record the same numbers again, and total lengths should be doubled.
|
| + compression_stats()->UpdateDataSavings(std::string(), kReceivedLength,
|
| + kOriginalLength);
|
| +
|
| + EXPECT_EQ(0,
|
| + GetInt64(data_reduction_proxy::prefs::kHttpReceivedContentLength));
|
| + EXPECT_EQ(kOriginalLength * 2 - kReceivedLength * 2,
|
| + GetInt64(data_reduction_proxy::prefs::kHttpOriginalContentLength));
|
| +}
|
| +
|
| TEST_F(DataReductionProxyCompressionStatsTest, OneResponse) {
|
| const int64_t kOriginalLength = 200;
|
| const int64_t kReceivedLength = 100;
|
| int64_t original[] = {kOriginalLength};
|
| int64_t received[] = {kReceivedLength};
|
|
|
| RecordContentLengthPrefs(
|
| kReceivedLength, kOriginalLength, true, VIA_DATA_REDUCTION_PROXY,
|
| FakeNow());
|
|
|
|
|