OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 namespace data_reduction_proxy { | 36 namespace data_reduction_proxy { |
37 | 37 |
38 // Test UpdateContentLengthPrefs. | 38 // Test UpdateContentLengthPrefs. |
39 class ChromeNetworkDataSavingMetricsTest : public testing::Test { | 39 class ChromeNetworkDataSavingMetricsTest : public testing::Test { |
40 protected: | 40 protected: |
41 ChromeNetworkDataSavingMetricsTest() {} | 41 ChromeNetworkDataSavingMetricsTest() {} |
42 | 42 |
43 virtual void SetUp() override { | 43 void SetUp() override { |
44 statistics_prefs_.reset(new DataReductionProxyStatisticsPrefs( | 44 statistics_prefs_.reset(new DataReductionProxyStatisticsPrefs( |
45 &pref_service_, | 45 &pref_service_, |
46 scoped_refptr<base::TestSimpleTaskRunner>( | 46 scoped_refptr<base::TestSimpleTaskRunner>( |
47 new base::TestSimpleTaskRunner()), | 47 new base::TestSimpleTaskRunner()), |
48 base::TimeDelta())); | 48 base::TimeDelta())); |
49 PrefRegistrySimple* registry = pref_service_.registry(); | 49 PrefRegistrySimple* registry = pref_service_.registry(); |
50 registry->RegisterInt64Pref( | 50 registry->RegisterInt64Pref( |
51 data_reduction_proxy::prefs::kHttpReceivedContentLength, 0); | 51 data_reduction_proxy::prefs::kHttpReceivedContentLength, 0); |
52 registry->RegisterInt64Pref( | 52 registry->RegisterInt64Pref( |
53 data_reduction_proxy::prefs::kHttpOriginalContentLength, 0); | 53 data_reduction_proxy::prefs::kHttpOriginalContentLength, 0); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // base::Time::FromString below. | 129 // base::Time::FromString below. |
130 const char kLastUpdateTime[] = "Wed, 18 Sep 2013 03:45:26"; | 130 const char kLastUpdateTime[] = "Wed, 18 Sep 2013 03:45:26"; |
131 | 131 |
132 class ChromeNetworkDailyDataSavingMetricsTest | 132 class ChromeNetworkDailyDataSavingMetricsTest |
133 : public ChromeNetworkDataSavingMetricsTest { | 133 : public ChromeNetworkDataSavingMetricsTest { |
134 protected: | 134 protected: |
135 ChromeNetworkDailyDataSavingMetricsTest() { | 135 ChromeNetworkDailyDataSavingMetricsTest() { |
136 base::Time::FromString(kLastUpdateTime, &now_); | 136 base::Time::FromString(kLastUpdateTime, &now_); |
137 } | 137 } |
138 | 138 |
139 virtual void SetUp() override { | 139 void SetUp() override { |
140 ChromeNetworkDataSavingMetricsTest::SetUp(); | 140 ChromeNetworkDataSavingMetricsTest::SetUp(); |
141 | 141 |
142 // Only create two lists in Setup to test that adding new lists is fine. | 142 // Only create two lists in Setup to test that adding new lists is fine. |
143 CreatePrefList( | 143 CreatePrefList( |
144 data_reduction_proxy::prefs::kDailyHttpOriginalContentLength); | 144 data_reduction_proxy::prefs::kDailyHttpOriginalContentLength); |
145 CreatePrefList( | 145 CreatePrefList( |
146 data_reduction_proxy::prefs::kDailyHttpReceivedContentLength); | 146 data_reduction_proxy::prefs::kDailyHttpReceivedContentLength); |
147 } | 147 } |
148 | 148 |
149 base::Time FakeNow() const { | 149 base::Time FakeNow() const { |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 kReceivedLength, kOriginalLength, | 685 kReceivedLength, kOriginalLength, |
686 true, VIA_DATA_REDUCTION_PROXY, | 686 true, VIA_DATA_REDUCTION_PROXY, |
687 FakeNow(), statistics_prefs_.get()); | 687 FakeNow(), statistics_prefs_.get()); |
688 VerifyDailyDataSavingContentLengthPrefLists( | 688 VerifyDailyDataSavingContentLengthPrefLists( |
689 original, 1, received, 1, | 689 original, 1, received, 1, |
690 original, 1, received, 1, | 690 original, 1, received, 1, |
691 original, 1, received, 1); | 691 original, 1, received, 1); |
692 } | 692 } |
693 | 693 |
694 } // namespace data_reduction_proxy | 694 } // namespace data_reduction_proxy |
OLD | NEW |