| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 void AddFakeTimeDeltaInHours(int hours) { | 123 void AddFakeTimeDeltaInHours(int hours) { |
| 124 now_delta_ += base::TimeDelta::FromHours(hours); | 124 now_delta_ += base::TimeDelta::FromHours(hours); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Create daily pref list of |kNumDaysInHistory| zero values. | 127 // Create daily pref list of |kNumDaysInHistory| zero values. |
| 128 void CreatePrefList(const char* pref) { | 128 void CreatePrefList(const char* pref) { |
| 129 ListPrefUpdate update(&pref_service_, pref); | 129 ListPrefUpdate update(&pref_service_, pref); |
| 130 update->Clear(); | 130 update->Clear(); |
| 131 for (size_t i = 0; i < kNumDaysInHistory; ++i) { | 131 for (size_t i = 0; i < kNumDaysInHistory; ++i) { |
| 132 update->Insert(0, new StringValue(base::Int64ToString(0))); | 132 update->Insert(0, new base::StringValue(base::Int64ToString(0))); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Verify the pref list values are equal to the given values. | 136 // Verify the pref list values are equal to the given values. |
| 137 // If the count of values is less than kNumDaysInHistory, zeros are assumed | 137 // If the count of values is less than kNumDaysInHistory, zeros are assumed |
| 138 // at the beginning. | 138 // at the beginning. |
| 139 void VerifyPrefList(const char* pref, const int64* values, size_t count) { | 139 void VerifyPrefList(const char* pref, const int64* values, size_t count) { |
| 140 ASSERT_GE(kNumDaysInHistory, count); | 140 ASSERT_GE(kNumDaysInHistory, count); |
| 141 ListPrefUpdate update(&pref_service_, pref); | 141 ListPrefUpdate update(&pref_service_, pref); |
| 142 ASSERT_EQ(kNumDaysInHistory, update->GetSize()) << "Pref: " << pref; | 142 ASSERT_EQ(kNumDaysInHistory, update->GetSize()) << "Pref: " << pref; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 true, spdyproxy::VIA_DATA_REDUCTION_PROXY, | 642 true, spdyproxy::VIA_DATA_REDUCTION_PROXY, |
| 643 FakeNow(), &pref_service_); | 643 FakeNow(), &pref_service_); |
| 644 VerifyDailyDataSavingContentLengthPrefLists( | 644 VerifyDailyDataSavingContentLengthPrefLists( |
| 645 original, 1, received, 1, | 645 original, 1, received, 1, |
| 646 original, 1, received, 1, | 646 original, 1, received, 1, |
| 647 original, 1, received, 1); | 647 original, 1, received, 1); |
| 648 } | 648 } |
| 649 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 649 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 650 | 650 |
| 651 } // namespace | 651 } // namespace |
| OLD | NEW |