| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #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_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_test
_utils.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
| 16 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs_test_utils.h" | 17 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs_test_utils.h" |
| 17 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | 19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
| 19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" | 20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc
hes.h" |
| 20 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 pref_service->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, false); | 56 pref_service->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, false); |
| 56 | 57 |
| 57 //AddProxyToCommandLine(); | 58 //AddProxyToCommandLine(); |
| 58 ResetSettings(true, true, true, false); | 59 ResetSettings(true, true, true, false); |
| 59 | 60 |
| 60 ListPrefUpdate original_update(test_context_->pref_service(), | 61 ListPrefUpdate original_update(test_context_->pref_service(), |
| 61 prefs::kDailyHttpOriginalContentLength); | 62 prefs::kDailyHttpOriginalContentLength); |
| 62 ListPrefUpdate received_update(test_context_->pref_service(), | 63 ListPrefUpdate received_update(test_context_->pref_service(), |
| 63 prefs::kDailyHttpReceivedContentLength); | 64 prefs::kDailyHttpReceivedContentLength); |
| 64 for (int64_t i = 0; i < kNumDaysInHistory; i++) { | 65 for (int64_t i = 0; i < kNumDaysInHistory; i++) { |
| 65 original_update->Insert(0, | 66 original_update->Insert( |
| 66 new base::StringValue(base::Int64ToString(2 * i))); | 67 0, base::MakeUnique<base::StringValue>(base::Int64ToString(2 * i))); |
| 67 received_update->Insert(0, new base::StringValue(base::Int64ToString(i))); | 68 received_update->Insert( |
| 69 0, base::MakeUnique<base::StringValue>(base::Int64ToString(i))); |
| 68 } | 70 } |
| 69 last_update_time_ = base::Time::Now().LocalMidnight(); | 71 last_update_time_ = base::Time::Now().LocalMidnight(); |
| 70 pref_service->SetInt64(prefs::kDailyHttpContentLengthLastUpdateDate, | 72 pref_service->SetInt64(prefs::kDailyHttpContentLengthLastUpdateDate, |
| 71 last_update_time_.ToInternalValue()); | 73 last_update_time_.ToInternalValue()); |
| 72 } | 74 } |
| 73 | 75 |
| 74 template <class C> | 76 template <class C> |
| 75 void DataReductionProxySettingsTestBase::ResetSettings(bool allowed, | 77 void DataReductionProxySettingsTestBase::ResetSettings(bool allowed, |
| 76 bool fallback_allowed, | 78 bool fallback_allowed, |
| 77 bool promo_allowed, | 79 bool promo_allowed, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 test_context_->RunUntilIdle(); | 154 test_context_->RunUntilIdle(); |
| 153 } | 155 } |
| 154 | 156 |
| 155 void DataReductionProxySettingsTestBase::CheckDataReductionProxySyntheticTrial( | 157 void DataReductionProxySettingsTestBase::CheckDataReductionProxySyntheticTrial( |
| 156 bool enabled) { | 158 bool enabled) { |
| 157 EXPECT_EQ(enabled ? "Enabled" : "Disabled", | 159 EXPECT_EQ(enabled ? "Enabled" : "Disabled", |
| 158 synthetic_field_trials_["SyntheticDataReductionProxySetting"]); | 160 synthetic_field_trials_["SyntheticDataReductionProxySetting"]); |
| 159 } | 161 } |
| 160 | 162 |
| 161 } // namespace data_reduction_proxy | 163 } // namespace data_reduction_proxy |
| OLD | NEW |