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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings_test_utils.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings_test_utils.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
11 #include "base/prefs/testing_pref_service.h" | 11 #include "base/prefs/testing_pref_service.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" | 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" |
15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator_test_utils.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator_test_utils.h" |
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | |
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs_test_utils.h" | 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs_test_utils.h" |
19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" | 20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" |
21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
23 | 23 |
24 using testing::_; | 24 using testing::_; |
25 using testing::AnyNumber; | 25 using testing::AnyNumber; |
26 using testing::Return; | 26 using testing::Return; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 ListPrefUpdate original_update(test_context_->pref_service(), | 68 ListPrefUpdate original_update(test_context_->pref_service(), |
69 prefs::kDailyHttpOriginalContentLength); | 69 prefs::kDailyHttpOriginalContentLength); |
70 ListPrefUpdate received_update(test_context_->pref_service(), | 70 ListPrefUpdate received_update(test_context_->pref_service(), |
71 prefs::kDailyHttpReceivedContentLength); | 71 prefs::kDailyHttpReceivedContentLength); |
72 for (int64 i = 0; i < kNumDaysInHistory; i++) { | 72 for (int64 i = 0; i < kNumDaysInHistory; i++) { |
73 original_update->Insert(0, | 73 original_update->Insert(0, |
74 new base::StringValue(base::Int64ToString(2 * i))); | 74 new base::StringValue(base::Int64ToString(2 * i))); |
75 received_update->Insert(0, new base::StringValue(base::Int64ToString(i))); | 75 received_update->Insert(0, new base::StringValue(base::Int64ToString(i))); |
76 } | 76 } |
77 last_update_time_ = base::Time::Now().LocalMidnight(); | 77 last_update_time_ = base::Time::Now().LocalMidnight(); |
78 settings_->data_reduction_proxy_service()->statistics_prefs()->SetInt64( | 78 settings_->data_reduction_proxy_service()->compression_stats()->SetInt64( |
79 prefs::kDailyHttpContentLengthLastUpdateDate, | 79 prefs::kDailyHttpContentLengthLastUpdateDate, |
80 last_update_time_.ToInternalValue()); | 80 last_update_time_.ToInternalValue()); |
81 } | 81 } |
82 | 82 |
83 template <class C> | 83 template <class C> |
84 void DataReductionProxySettingsTestBase::ResetSettings(bool allowed, | 84 void DataReductionProxySettingsTestBase::ResetSettings(bool allowed, |
85 bool fallback_allowed, | 85 bool fallback_allowed, |
86 bool alt_allowed, | 86 bool alt_allowed, |
87 bool promo_allowed, | 87 bool promo_allowed, |
88 bool holdback) { | 88 bool holdback) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 synthetic_field_trials_["SyntheticDataReductionProxySetting"]); | 169 synthetic_field_trials_["SyntheticDataReductionProxySetting"]); |
170 } | 170 } |
171 | 171 |
172 void DataReductionProxySettingsTestBase:: | 172 void DataReductionProxySettingsTestBase:: |
173 CheckDataReductionProxyLoFiSyntheticTrial(bool enabled) { | 173 CheckDataReductionProxyLoFiSyntheticTrial(bool enabled) { |
174 EXPECT_EQ(enabled ? "Enabled" : "Disabled", | 174 EXPECT_EQ(enabled ? "Enabled" : "Disabled", |
175 synthetic_field_trials_["SyntheticDataReductionProxyLoFiSetting"]); | 175 synthetic_field_trials_["SyntheticDataReductionProxyLoFiSetting"]); |
176 } | 176 } |
177 | 177 |
178 } // namespace data_reduction_proxy | 178 } // namespace data_reduction_proxy |
OLD | NEW |