| 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 42f93fb5c84f0bc9b405bdd219d52446c9d457c5..f69a5fc44704d459d03f727759a03749beb101db 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
|
| @@ -11,7 +11,6 @@
|
| #include "base/prefs/pref_service.h"
|
| #include "base/prefs/testing_pref_service.h"
|
| #include "base/strings/string_number_conversions.h"
|
| -#include "base/test/histogram_tester.h"
|
| #include "base/test/test_simple_task_runner.h"
|
| #include "base/time/time.h"
|
| #include "base/values.h"
|
| @@ -169,18 +168,14 @@
|
| ASSERT_EQ(kNumDaysInHistory, update->GetSize()) << "Pref: " << pref;
|
|
|
| for (size_t i = 0; i < count; ++i) {
|
| - EXPECT_EQ(values[i],
|
| - GetListPrefInt64Value(*update, kNumDaysInHistory - count + i))
|
| - << pref << "; index=" << (kNumDaysInHistory - count + i);
|
| + EXPECT_EQ(
|
| + values[i],
|
| + GetListPrefInt64Value(*update, kNumDaysInHistory - count + i))
|
| + << "index=" << (kNumDaysInHistory - count + i);
|
| }
|
| for (size_t i = 0; i < kNumDaysInHistory - count; ++i) {
|
| EXPECT_EQ(0, GetListPrefInt64Value(*update, i)) << "index=" << i;
|
| }
|
| - }
|
| -
|
| - // Verify that the pref value is equal to given value.
|
| - void VerifyPrefInt64(const char* pref, const int64 value) {
|
| - EXPECT_EQ(value, compression_stats_->GetInt64(pref));
|
| }
|
|
|
| // Verify all daily data saving pref list values.
|
| @@ -219,42 +214,6 @@
|
| kDailyContentLengthViaDataReductionProxy,
|
| received_via_data_reduction_proxy_values,
|
| received_via_data_reduction_proxy_count);
|
| -
|
| - VerifyPrefInt64(
|
| - data_reduction_proxy::prefs::kDailyHttpOriginalContentLengthApplication,
|
| - original_values ? original_values[original_count - 1] : 0);
|
| - VerifyPrefInt64(
|
| - data_reduction_proxy::prefs::kDailyHttpReceivedContentLengthApplication,
|
| - received_values ? received_values[received_count - 1] : 0);
|
| -
|
| - VerifyPrefInt64(
|
| - data_reduction_proxy::prefs::
|
| - kDailyOriginalContentLengthWithDataReductionProxyEnabledApplication,
|
| - original_with_data_reduction_proxy_enabled_values
|
| - ? original_with_data_reduction_proxy_enabled_values
|
| - [original_with_data_reduction_proxy_enabled_count - 1]
|
| - : 0);
|
| - VerifyPrefInt64(
|
| - data_reduction_proxy::prefs::
|
| - kDailyContentLengthWithDataReductionProxyEnabledApplication,
|
| - received_with_data_reduction_proxy_enabled_values
|
| - ? received_with_data_reduction_proxy_enabled_values
|
| - [received_with_data_reduction_proxy_count - 1]
|
| - : 0);
|
| -
|
| - VerifyPrefInt64(
|
| - data_reduction_proxy::prefs::
|
| - kDailyOriginalContentLengthViaDataReductionProxyApplication,
|
| - original_via_data_reduction_proxy_values
|
| - ? original_via_data_reduction_proxy_values
|
| - [original_via_data_reduction_proxy_count - 1]
|
| - : 0);
|
| - VerifyPrefInt64(data_reduction_proxy::prefs::
|
| - kDailyContentLengthViaDataReductionProxyApplication,
|
| - received_via_data_reduction_proxy_values
|
| - ? received_via_data_reduction_proxy_values
|
| - [received_via_data_reduction_proxy_count - 1]
|
| - : 0);
|
| }
|
|
|
| // Verify daily data saving pref for request types.
|
| @@ -325,21 +284,10 @@
|
| int64 original_content_length,
|
| bool with_data_reduction_proxy_enabled,
|
| DataReductionProxyRequestType request_type,
|
| - const std::string& mime_type,
|
| base::Time now) {
|
| compression_stats_->RecordRequestSizePrefs(
|
| received_content_length, original_content_length,
|
| - with_data_reduction_proxy_enabled, request_type, mime_type, now);
|
| - }
|
| -
|
| - void RecordContentLengthPrefs(int64 received_content_length,
|
| - int64 original_content_length,
|
| - bool with_data_reduction_proxy_enabled,
|
| - DataReductionProxyRequestType request_type,
|
| - base::Time now) {
|
| - RecordContentLengthPrefs(received_content_length, original_content_length,
|
| - with_data_reduction_proxy_enabled, request_type,
|
| - "application/octet-stream", now);
|
| + with_data_reduction_proxy_enabled, request_type, std::string(), now);
|
| }
|
|
|
| DataReductionProxyCompressionStats* compression_stats() {
|
| @@ -523,7 +471,6 @@
|
| RecordContentLengthPrefs(
|
| kReceivedLength, kOriginalLength, true, VIA_DATA_REDUCTION_PROXY,
|
| FakeNow());
|
| -
|
| VerifyDailyDataSavingContentLengthPrefLists(
|
| original, 1, received, 1,
|
| original, 1, received, 1,
|
| @@ -912,61 +859,4 @@
|
| EXPECT_EQ("http.www.co.in", NormalizeHostname("http://http.www.co.in"));
|
| }
|
|
|
| -TEST_F(DataReductionProxyCompressionStatsTest, RecordUma) {
|
| - const int64 kOriginalLength = 15000;
|
| - const int64 kReceivedLength = 10000;
|
| - base::HistogramTester tester;
|
| -
|
| - RecordContentLengthPrefs(kReceivedLength, kOriginalLength, true,
|
| - VIA_DATA_REDUCTION_PROXY, FakeNow());
|
| -
|
| - // Forward one day.
|
| - SetFakeTimeDeltaInHours(24);
|
| -
|
| - // Proxy not enabled. Not via proxy.
|
| - RecordContentLengthPrefs(kReceivedLength, kOriginalLength, false,
|
| - UNKNOWN_TYPE, FakeNow());
|
| -
|
| - // 15000 falls into the 12 KB bucket
|
| - tester.ExpectUniqueSample("Net.DailyOriginalContentLength", 12, 1);
|
| - tester.ExpectUniqueSample("Net.DailyOriginalContentLength_Application", 12,
|
| - 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyOriginalContentLength_DataReductionProxyEnabled", 12, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyOriginalContentLength_DataReductionProxyEnabled_Application",
|
| - 12, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyOriginalContentLength_ViaDataReductionProxy", 12, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyOriginalContentLength_ViaDataReductionProxy_Application", 12,
|
| - 1);
|
| -
|
| - // 10000 falls into the 9 KB bucket
|
| - tester.ExpectUniqueSample("Net.DailyContentLength", 9, 1);
|
| - tester.ExpectUniqueSample("Net.DailyReceivedContentLength_Application", 9, 1);
|
| - tester.ExpectUniqueSample("Net.DailyContentLength_DataReductionProxyEnabled",
|
| - 9, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyContentLength_DataReductionProxyEnabled_Application", 9, 1);
|
| - tester.ExpectUniqueSample("Net.DailyContentLength_ViaDataReductionProxy", 9,
|
| - 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyContentLength_ViaDataReductionProxy_Application", 9, 1);
|
| -
|
| - // floor((15000 - 10000) * 100) = 33.
|
| - tester.ExpectUniqueSample("Net.DailyContentSavingPercent", 33, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyContentSavingPercent_DataReductionProxyEnabled", 33, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyContentSavingPercent_ViaDataReductionProxy", 33, 1);
|
| -
|
| - tester.ExpectUniqueSample("Net.DailyContentPercent_DataReductionProxyEnabled",
|
| - 100, 1);
|
| - tester.ExpectUniqueSample("Net.DailyContentPercent_ViaDataReductionProxy",
|
| - 100, 1);
|
| - tester.ExpectUniqueSample(
|
| - "Net.DailyContentPercent_DataReductionProxyEnabled_Unknown", 0, 1);
|
| -}
|
| -
|
| } // namespace data_reduction_proxy
|
|
|