| 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/common/data_reduction_proxy_param
s_test_utils.h" | 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" |
| 6 | 6 |
| 7 namespace { | 7 namespace { |
| 8 // Test values to replace the values specified in preprocessor defines. | 8 // Test values to replace the values specified in preprocessor defines. |
| 9 static const char kDefaultOrigin[] = "origin.net:80"; | 9 static const char kDefaultOrigin[] = "origin.net:80"; |
| 10 static const char kDefaultFallbackOrigin[] = "fallback.net:80"; | 10 static const char kDefaultFallbackOrigin[] = "fallback.net:80"; |
| 11 static const char kDefaultSecureProxyCheckURL[] = "http://proxycheck.net/"; | 11 static const char kDefaultSecureProxyCheckURL[] = "http://proxycheck.net/"; |
| 12 | 12 |
| 13 static const char kFlagOrigin[] = "https://origin.org:443"; | 13 static const char kFlagOrigin[] = "https://origin.org:443"; |
| 14 static const char kFlagFallbackOrigin[] = "fallback.org:80"; | 14 static const char kFlagFallbackOrigin[] = "fallback.org:80"; |
| 15 static const char kFlagSecureProxyCheckURL[] = "http://proxycheck.org/"; | 15 static const char kFlagSecureProxyCheckURL[] = "http://proxycheck.org/"; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace data_reduction_proxy { | 18 namespace data_reduction_proxy { |
| 19 TestDataReductionProxyParams::TestDataReductionProxyParams( | 19 TestDataReductionProxyParams::TestDataReductionProxyParams() |
| 20 int flags, unsigned int has_definitions) | 20 : DataReductionProxyParams(false) { |
| 21 : DataReductionProxyParams(flags, false), | |
| 22 has_definitions_(has_definitions) { | |
| 23 init_result_ = Init(); | 21 init_result_ = Init(); |
| 24 } | 22 } |
| 25 | 23 |
| 26 bool TestDataReductionProxyParams::init_result() const { | 24 bool TestDataReductionProxyParams::init_result() const { |
| 27 return init_result_; | 25 return init_result_; |
| 28 } | 26 } |
| 29 | 27 |
| 30 void TestDataReductionProxyParams::SetProxiesForHttp( | 28 void TestDataReductionProxyParams::SetProxiesForHttp( |
| 31 const std::vector<DataReductionProxyServer>& proxies) { | 29 const std::vector<DataReductionProxyServer>& proxies) { |
| 32 SetProxiesForHttpForTesting(proxies); | 30 SetProxiesForHttpForTesting(proxies); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 50 | 48 |
| 51 std::string TestDataReductionProxyParams::FlagFallbackOrigin() { | 49 std::string TestDataReductionProxyParams::FlagFallbackOrigin() { |
| 52 return kFlagFallbackOrigin; | 50 return kFlagFallbackOrigin; |
| 53 } | 51 } |
| 54 | 52 |
| 55 std::string TestDataReductionProxyParams::FlagSecureProxyCheckURL() { | 53 std::string TestDataReductionProxyParams::FlagSecureProxyCheckURL() { |
| 56 return kFlagSecureProxyCheckURL; | 54 return kFlagSecureProxyCheckURL; |
| 57 } | 55 } |
| 58 | 56 |
| 59 std::string TestDataReductionProxyParams::GetDefaultOrigin() const { | 57 std::string TestDataReductionProxyParams::GetDefaultOrigin() const { |
| 60 return GetDefinition( | 58 return kDefaultOrigin; |
| 61 TestDataReductionProxyParams::HAS_ORIGIN, kDefaultOrigin); | |
| 62 } | 59 } |
| 63 | 60 |
| 64 std::string TestDataReductionProxyParams::GetDefaultFallbackOrigin() const { | 61 std::string TestDataReductionProxyParams::GetDefaultFallbackOrigin() const { |
| 65 return GetDefinition( | 62 return kDefaultFallbackOrigin; |
| 66 TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN, | |
| 67 kDefaultFallbackOrigin); | |
| 68 } | 63 } |
| 69 | 64 |
| 70 std::string TestDataReductionProxyParams::GetDefaultSecureProxyCheckURL() | 65 std::string TestDataReductionProxyParams::GetDefaultSecureProxyCheckURL() |
| 71 const { | 66 const { |
| 72 return GetDefinition( | 67 return kDefaultSecureProxyCheckURL; |
| 73 TestDataReductionProxyParams::HAS_SECURE_PROXY_CHECK_URL, | |
| 74 kDefaultSecureProxyCheckURL); | |
| 75 } | 68 } |
| 76 | 69 |
| 77 std::string TestDataReductionProxyParams::GetDefinition( | |
| 78 unsigned int has_def, | |
| 79 const std::string& definition) const { | |
| 80 return ((has_definitions_ & has_def) ? definition : std::string()); | |
| 81 } | |
| 82 } // namespace data_reduction_proxy | 70 } // namespace data_reduction_proxy |
| OLD | NEW |