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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/prefs/pref_registry_simple.h" | 6 #include "base/prefs/pref_registry_simple.h" |
7 #include "base/prefs/testing_pref_service.h" | 7 #include "base/prefs/testing_pref_service.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 namespace data_reduction_proxy { | 34 namespace data_reduction_proxy { |
35 | 35 |
36 class DataReductionProxyStatisticsPrefsTest : public testing::Test { | 36 class DataReductionProxyStatisticsPrefsTest : public testing::Test { |
37 protected: | 37 protected: |
38 DataReductionProxyStatisticsPrefsTest() | 38 DataReductionProxyStatisticsPrefsTest() |
39 : task_runner_(scoped_refptr<base::TestSimpleTaskRunner>( | 39 : task_runner_(scoped_refptr<base::TestSimpleTaskRunner>( |
40 new base::TestSimpleTaskRunner())) {} | 40 new base::TestSimpleTaskRunner())) {} |
41 | 41 |
42 virtual void SetUp() override { | 42 void SetUp() override { RegisterPrefs(simple_pref_service_.registry()); } |
43 RegisterPrefs(simple_pref_service_.registry()); | |
44 } | |
45 | 43 |
46 // Create daily pref list of |kNumDaysInHistory| zero values. | 44 // Create daily pref list of |kNumDaysInHistory| zero values. |
47 void CreatePrefList(const char* pref) { | 45 void CreatePrefList(const char* pref) { |
48 base::ListValue* update = statistics_prefs_->GetList(pref); | 46 base::ListValue* update = statistics_prefs_->GetList(pref); |
49 update->Clear(); | 47 update->Clear(); |
50 for (size_t i = 0; i < kNumDaysInHistory; ++i) { | 48 for (size_t i = 0; i < kNumDaysInHistory; ++i) { |
51 update->Insert(0, new base::StringValue(base::Int64ToString(0))); | 49 update->Insert(0, new base::StringValue(base::Int64ToString(0))); |
52 } | 50 } |
53 } | 51 } |
54 | 52 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 211 |
214 VerifyPrefWasWritten(data_reduction_proxy::prefs::kHttpOriginalContentLength); | 212 VerifyPrefWasWritten(data_reduction_proxy::prefs::kHttpOriginalContentLength); |
215 VerifyPrefWasWritten(data_reduction_proxy::prefs::kHttpReceivedContentLength); | 213 VerifyPrefWasWritten(data_reduction_proxy::prefs::kHttpReceivedContentLength); |
216 VerifyPrefListWasWritten( | 214 VerifyPrefListWasWritten( |
217 data_reduction_proxy::prefs::kDailyHttpOriginalContentLength); | 215 data_reduction_proxy::prefs::kDailyHttpOriginalContentLength); |
218 VerifyPrefListWasWritten( | 216 VerifyPrefListWasWritten( |
219 data_reduction_proxy::prefs::kDailyHttpReceivedContentLength); | 217 data_reduction_proxy::prefs::kDailyHttpReceivedContentLength); |
220 } | 218 } |
221 | 219 |
222 } // namespace data_reduction_proxy | 220 } // namespace data_reduction_proxy |
OLD | NEW |