| Index: components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
|
| diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
|
| index d6dd412ec93eacd95bac606df33b0842c2f8edbd..79c5f275c989d66a91b8c90f2c29aa9318d1e552 100644
|
| --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
|
| +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc
|
| @@ -27,7 +27,13 @@ namespace data_reduction_proxy {
|
| TestDataReductionProxyParams::TestDataReductionProxyParams(
|
| int flags, unsigned int has_definitions)
|
| : DataReductionProxyParams(flags, false),
|
| - has_definitions_(has_definitions) {
|
| + has_definitions_(has_definitions),
|
| + mock_is_data_reduction_proxy_(false),
|
| + mock_is_bypassed_by_data_reduction_proxy_local_rules_(false),
|
| + mock_are_data_reduction_proxies_bypassed_(false),
|
| + is_data_reduction_proxy_return_value_(false),
|
| + is_bypassed_by_data_reduction_proxy_local_rules_return_value_(false),
|
| + are_data_reduction_proxies_bypassed_return_value_(false) {
|
| init_result_ = Init(
|
| flags & DataReductionProxyParams::kAllowed,
|
| flags & DataReductionProxyParams::kFallbackAllowed,
|
| @@ -39,6 +45,51 @@ bool TestDataReductionProxyParams::init_result() const {
|
| return init_result_;
|
| }
|
|
|
| +bool TestDataReductionProxyParams::IsDataReductionProxy(
|
| + const net::HostPortPair& host_port_pair,
|
| + DataReductionProxyTypeInfo* proxy_info) const {
|
| + if (mock_is_data_reduction_proxy_)
|
| + return is_data_reduction_proxy_return_value_;
|
| + return DataReductionProxyParams::IsDataReductionProxy(host_port_pair,
|
| + proxy_info);
|
| +}
|
| +
|
| +bool TestDataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
|
| + const net::URLRequest& request,
|
| + const net::ProxyConfig& data_reduction_proxy_config) const {
|
| + if (mock_is_bypassed_by_data_reduction_proxy_local_rules_)
|
| + return is_bypassed_by_data_reduction_proxy_local_rules_return_value_;
|
| + return DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
|
| + request, data_reduction_proxy_config);
|
| +}
|
| +
|
| +bool TestDataReductionProxyParams::AreDataReductionProxiesBypassed(
|
| + const net::URLRequest& request,
|
| + base::TimeDelta* min_retry_delay) const {
|
| + if (mock_are_data_reduction_proxies_bypassed_)
|
| + return are_data_reduction_proxies_bypassed_return_value_;
|
| + return DataReductionProxyParams::AreDataReductionProxiesBypassed(
|
| + request, min_retry_delay);
|
| +}
|
| +
|
| +void TestDataReductionProxyParams::MockAreDataReductionProxiesBypassed(
|
| + bool return_value) {
|
| + mock_are_data_reduction_proxies_bypassed_ = true;
|
| + are_data_reduction_proxies_bypassed_return_value_ = return_value;
|
| +}
|
| +
|
| +void
|
| +TestDataReductionProxyParams::MockIsBypassedByDataReductionProxyLocalRules(
|
| + bool return_value) {
|
| + mock_is_bypassed_by_data_reduction_proxy_local_rules_ = true;
|
| + is_bypassed_by_data_reduction_proxy_local_rules_return_value_ = return_value;
|
| +}
|
| +
|
| +void TestDataReductionProxyParams::MockIsDataReductionProxy(bool return_value) {
|
| + mock_is_data_reduction_proxy_ = true;
|
| + is_data_reduction_proxy_return_value_ = return_value;
|
| +}
|
| +
|
| // Test values to replace the values specified in preprocessor defines.
|
| std::string TestDataReductionProxyParams::DefaultDevOrigin() {
|
| return kDefaultDevOrigin;
|
|
|