| 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" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 pref_service->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, false); | 55 pref_service->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, false); |
| 56 | 56 |
| 57 ResetSettings(nullptr, true, false); | 57 ResetSettings(nullptr, true, false); |
| 58 | 58 |
| 59 ListPrefUpdate original_update(test_context_->pref_service(), | 59 ListPrefUpdate original_update(test_context_->pref_service(), |
| 60 prefs::kDailyHttpOriginalContentLength); | 60 prefs::kDailyHttpOriginalContentLength); |
| 61 ListPrefUpdate received_update(test_context_->pref_service(), | 61 ListPrefUpdate received_update(test_context_->pref_service(), |
| 62 prefs::kDailyHttpReceivedContentLength); | 62 prefs::kDailyHttpReceivedContentLength); |
| 63 for (int64_t i = 0; i < kNumDaysInHistory; i++) { | 63 for (int64_t i = 0; i < kNumDaysInHistory; i++) { |
| 64 original_update->Insert( | 64 original_update->Insert( |
| 65 0, base::MakeUnique<base::StringValue>(base::Int64ToString(2 * i))); | 65 0, base::MakeUnique<base::Value>(base::Int64ToString(2 * i))); |
| 66 received_update->Insert( | 66 received_update->Insert( |
| 67 0, base::MakeUnique<base::StringValue>(base::Int64ToString(i))); | 67 0, base::MakeUnique<base::Value>(base::Int64ToString(i))); |
| 68 } | 68 } |
| 69 last_update_time_ = base::Time::Now().LocalMidnight(); | 69 last_update_time_ = base::Time::Now().LocalMidnight(); |
| 70 pref_service->SetInt64(prefs::kDailyHttpContentLengthLastUpdateDate, | 70 pref_service->SetInt64(prefs::kDailyHttpContentLengthLastUpdateDate, |
| 71 last_update_time_.ToInternalValue()); | 71 last_update_time_.ToInternalValue()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 template <class C> | 74 template <class C> |
| 75 void DataReductionProxySettingsTestBase::ResetSettings( | 75 void DataReductionProxySettingsTestBase::ResetSettings( |
| 76 std::unique_ptr<base::Clock> clock, | 76 std::unique_ptr<base::Clock> clock, |
| 77 bool promo_allowed, | 77 bool promo_allowed, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 test_context_->RunUntilIdle(); | 148 test_context_->RunUntilIdle(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void DataReductionProxySettingsTestBase::CheckDataReductionProxySyntheticTrial( | 151 void DataReductionProxySettingsTestBase::CheckDataReductionProxySyntheticTrial( |
| 152 bool enabled) { | 152 bool enabled) { |
| 153 EXPECT_EQ(enabled ? "Enabled" : "Disabled", | 153 EXPECT_EQ(enabled ? "Enabled" : "Disabled", |
| 154 synthetic_field_trials_["SyntheticDataReductionProxySetting"]); | 154 synthetic_field_trials_["SyntheticDataReductionProxySetting"]); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace data_reduction_proxy | 157 } // namespace data_reduction_proxy |
| OLD | NEW |