| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_conf
ig_test_utils.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
| 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_muta
ble_config_values.h" | 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_muta
ble_config_values.h" |
| 15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" | 15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" |
| 16 #include "net/url_request/test_url_fetcher_factory.h" | 16 #include "net/url_request/test_url_fetcher_factory.h" |
| 17 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 19 | 19 |
| 20 using testing::_; | 20 using testing::_; |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 class NetworkQualityEstimator; | 23 class NetworkQualityEstimator; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace data_reduction_proxy { | 26 namespace data_reduction_proxy { |
| 27 | 27 |
| 28 TestDataReductionProxyConfig::TestDataReductionProxyConfig( | 28 TestDataReductionProxyConfig::TestDataReductionProxyConfig( |
| 29 int params_flags, | |
| 30 unsigned int params_definitions, | |
| 31 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 29 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 32 net::NetLog* net_log, | 30 net::NetLog* net_log, |
| 33 DataReductionProxyConfigurator* configurator, | 31 DataReductionProxyConfigurator* configurator, |
| 34 DataReductionProxyEventCreator* event_creator) | 32 DataReductionProxyEventCreator* event_creator) |
| 35 : TestDataReductionProxyConfig( | 33 : TestDataReductionProxyConfig( |
| 36 base::MakeUnique<TestDataReductionProxyParams>(params_flags, | 34 base::MakeUnique<TestDataReductionProxyParams>(), |
| 37 params_definitions), | |
| 38 io_task_runner, | 35 io_task_runner, |
| 39 net_log, | 36 net_log, |
| 40 configurator, | 37 configurator, |
| 41 event_creator) {} | 38 event_creator) {} |
| 42 | 39 |
| 43 TestDataReductionProxyConfig::TestDataReductionProxyConfig( | 40 TestDataReductionProxyConfig::TestDataReductionProxyConfig( |
| 44 std::unique_ptr<DataReductionProxyConfigValues> config_values, | 41 std::unique_ptr<DataReductionProxyConfigValues> config_values, |
| 45 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 46 net::NetLog* net_log, | 43 net::NetLog* net_log, |
| 47 DataReductionProxyConfigurator* configurator, | 44 DataReductionProxyConfigurator* configurator, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 network_quality_estimator); | 67 network_quality_estimator); |
| 71 } | 68 } |
| 72 | 69 |
| 73 void TestDataReductionProxyConfig::GetNetworkList( | 70 void TestDataReductionProxyConfig::GetNetworkList( |
| 74 net::NetworkInterfaceList* interfaces, | 71 net::NetworkInterfaceList* interfaces, |
| 75 int policy) { | 72 int policy) { |
| 76 for (size_t i = 0; i < network_interfaces_->size(); ++i) | 73 for (size_t i = 0; i < network_interfaces_->size(); ++i) |
| 77 interfaces->push_back(network_interfaces_->at(i)); | 74 interfaces->push_back(network_interfaces_->at(i)); |
| 78 } | 75 } |
| 79 | 76 |
| 80 void TestDataReductionProxyConfig::ResetParamFlagsForTest(int flags) { | 77 void TestDataReductionProxyConfig::ResetParamFlagsForTest() { |
| 81 config_values_ = base::MakeUnique<TestDataReductionProxyParams>( | 78 config_values_ = base::MakeUnique<TestDataReductionProxyParams>(); |
| 82 flags, TestDataReductionProxyParams::HAS_EVERYTHING); | |
| 83 } | 79 } |
| 84 | 80 |
| 85 TestDataReductionProxyParams* TestDataReductionProxyConfig::test_params() { | 81 TestDataReductionProxyParams* TestDataReductionProxyConfig::test_params() { |
| 86 return static_cast<TestDataReductionProxyParams*>(config_values_.get()); | 82 return static_cast<TestDataReductionProxyParams*>(config_values_.get()); |
| 87 } | 83 } |
| 88 | 84 |
| 89 DataReductionProxyConfigValues* TestDataReductionProxyConfig::config_values() { | 85 DataReductionProxyConfigValues* TestDataReductionProxyConfig::config_values() { |
| 90 return config_values_.get(); | 86 return config_values_.get(); |
| 91 } | 87 } |
| 92 | 88 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 event_creator) {} | 168 event_creator) {} |
| 173 | 169 |
| 174 MockDataReductionProxyConfig::~MockDataReductionProxyConfig() { | 170 MockDataReductionProxyConfig::~MockDataReductionProxyConfig() { |
| 175 } | 171 } |
| 176 | 172 |
| 177 void MockDataReductionProxyConfig::ResetLoFiStatusForTest() { | 173 void MockDataReductionProxyConfig::ResetLoFiStatusForTest() { |
| 178 lofi_off_ = false; | 174 lofi_off_ = false; |
| 179 } | 175 } |
| 180 | 176 |
| 181 } // namespace data_reduction_proxy | 177 } // namespace data_reduction_proxy |
| OLD | NEW |