| Index: components/data_reduction_proxy/browser/data_reduction_proxy_params_unittest.cc
|
| diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_params_unittest.cc
|
| index fac9d2d866eae11d63e6b8dc72651ab21ba70065..58a3d53fe64a60c2d10fdf8aacf108e9c7ff4175 100644
|
| --- a/components/data_reduction_proxy/browser/data_reduction_proxy_params_unittest.cc
|
| +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_params_unittest.cc
|
| @@ -6,104 +6,11 @@
|
|
|
| #include "base/command_line.h"
|
| #include "base/logging.h"
|
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_params_test_utils.h"
|
| #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -namespace {
|
| -// Test values to replacethe values specified in preprocessor defines.
|
| -static const char kDefaultKey[] = "test-key";
|
| -static const char kDefaultDevOrigin[] = "https://dev.net:443/";
|
| -static const char kDefaultOrigin[] = "https://origin.net:443/";
|
| -static const char kDefaultFallbackOrigin[] = "http://fallback.net:80/";
|
| -static const char kDefaultSSLOrigin[] = "http://ssl.net:1080/";
|
| -static const char kDefaultAltOrigin[] = "https://alt.net:443/";
|
| -static const char kDefaultAltFallbackOrigin[] = "http://altfallback.net:80/";
|
| -static const char kDefaultProbeURL[] = "http://probe.net/";
|
| -
|
| -static const char kFlagKey[] = "test-flag-key";
|
| -static const char kFlagOrigin[] = "https://origin.org:443/";
|
| -static const char kFlagFallbackOrigin[] = "http://fallback.org:80/";
|
| -static const char kFlagSSLOrigin[] = "http://ssl.org:1080/";
|
| -static const char kFlagAltOrigin[] = "https://alt.org:443/";
|
| -static const char kFlagAltFallbackOrigin[] = "http://altfallback.org:80/";
|
| -static const char kFlagProbeURL[] = "http://probe.org/";
|
| -
|
| -// Used to emulate having constants defined by the preprocessor.
|
| -static const unsigned int HAS_NOTHING = 0x0;
|
| -static const unsigned int HAS_KEY = 0x1;
|
| -static const unsigned int HAS_DEV_ORIGIN = 0x2;
|
| -static const unsigned int HAS_ORIGIN = 0x4;
|
| -static const unsigned int HAS_FALLBACK_ORIGIN = 0x8;
|
| -static const unsigned int HAS_SSL_ORIGIN = 0x10;
|
| -static const unsigned int HAS_ALT_ORIGIN = 0x20;
|
| -static const unsigned int HAS_ALT_FALLBACK_ORIGIN = 0x40;
|
| -static const unsigned int HAS_PROBE_URL = 0x80;
|
| -static const unsigned int HAS_EVERYTHING = 0xff;
|
| -} // namespace
|
| -
|
| namespace data_reduction_proxy {
|
| -namespace {
|
| -class TestDataReductionProxyParams : public DataReductionProxyParams {
|
| - public:
|
| -
|
| - TestDataReductionProxyParams(int flags,
|
| - unsigned int has_definitions)
|
| - : DataReductionProxyParams(flags,
|
| - false),
|
| - has_definitions_(has_definitions) {
|
| - init_result_ = Init(flags & DataReductionProxyParams::kAllowed,
|
| - flags & DataReductionProxyParams::kFallbackAllowed,
|
| - flags & DataReductionProxyParams::kAlternativeAllowed);
|
| - }
|
| -
|
| - bool init_result() const {
|
| - return init_result_;
|
| - }
|
| -
|
| - protected:
|
| - virtual std::string GetDefaultKey() const OVERRIDE {
|
| - return GetDefinition(HAS_KEY, kDefaultKey);
|
| - }
|
| -
|
| - virtual std::string GetDefaultDevOrigin() const OVERRIDE {
|
| - return GetDefinition(HAS_DEV_ORIGIN, kDefaultDevOrigin);
|
| - }
|
| -
|
| - virtual std::string GetDefaultOrigin() const OVERRIDE {
|
| - return GetDefinition(HAS_ORIGIN, kDefaultOrigin);
|
| - }
|
| -
|
| - virtual std::string GetDefaultFallbackOrigin() const OVERRIDE {
|
| - return GetDefinition(HAS_FALLBACK_ORIGIN, kDefaultFallbackOrigin);
|
| - }
|
| -
|
| - virtual std::string GetDefaultSSLOrigin() const OVERRIDE {
|
| - return GetDefinition(HAS_SSL_ORIGIN, kDefaultSSLOrigin);
|
| - }
|
| -
|
| - virtual std::string GetDefaultAltOrigin() const OVERRIDE {
|
| - return GetDefinition(HAS_ALT_ORIGIN, kDefaultAltOrigin);
|
| - }
|
| -
|
| - virtual std::string GetDefaultAltFallbackOrigin() const OVERRIDE {
|
| - return GetDefinition(HAS_ALT_FALLBACK_ORIGIN, kDefaultAltFallbackOrigin);
|
| - }
|
| -
|
| - virtual std::string GetDefaultProbeURL() const OVERRIDE {
|
| - return GetDefinition(HAS_PROBE_URL, kDefaultProbeURL);
|
| - }
|
| -
|
| - private:
|
| - std::string GetDefinition(unsigned int has_def,
|
| - const std::string& definition) const {
|
| - return ((has_definitions_ & has_def) ? definition : std::string());
|
| - }
|
| -
|
| - unsigned int has_definitions_;
|
| - bool init_result_;
|
| -};
|
| -} // namespace
|
| -
|
| class DataReductionProxyParamsTest : public testing::Test {
|
| public:
|
| void CheckParams(const TestDataReductionProxyParams& params,
|
| @@ -119,14 +26,12 @@ class DataReductionProxyParamsTest : public testing::Test {
|
| EXPECT_EQ(expected_promo_allowed, params.promo_allowed());
|
| }
|
| void CheckValues(const TestDataReductionProxyParams& params,
|
| - const std::string expected_key,
|
| const std::string& expected_origin,
|
| const std::string& expected_fallback_origin,
|
| const std::string& expected_ssl_origin,
|
| const std::string& expected_alt_origin,
|
| const std::string& expected_alt_fallback_origin,
|
| const std::string& expected_probe_url) {
|
| - EXPECT_EQ(expected_key, params.key());
|
| EXPECT_EQ(GURL(expected_origin), params.origin());
|
| EXPECT_EQ(GURL(expected_fallback_origin), params.fallback_origin());
|
| EXPECT_EQ(GURL(expected_ssl_origin), params.ssl_origin());
|
| @@ -140,16 +45,16 @@ TEST_F(DataReductionProxyParamsTest, EverythingDefined) {
|
| TestDataReductionProxyParams params(
|
| DataReductionProxyParams::kAllowed |
|
| DataReductionProxyParams::kFallbackAllowed |
|
| - DataReductionProxyParams::kPromoAllowed, HAS_EVERYTHING);
|
| + DataReductionProxyParams::kPromoAllowed,
|
| + TestDataReductionProxyParams::HAS_EVERYTHING);
|
| CheckParams(params, true, true, true, false, true);
|
| CheckValues(params,
|
| - kDefaultKey,
|
| - kDefaultDevOrigin,
|
| - kDefaultFallbackOrigin,
|
| - kDefaultSSLOrigin,
|
| - kDefaultAltOrigin,
|
| - kDefaultAltFallbackOrigin,
|
| - kDefaultProbeURL);
|
| + TestDataReductionProxyParams::DefaultDevOrigin(),
|
| + TestDataReductionProxyParams::DefaultFallbackOrigin(),
|
| + TestDataReductionProxyParams::DefaultSSLOrigin(),
|
| + TestDataReductionProxyParams::DefaultAltOrigin(),
|
| + TestDataReductionProxyParams::DefaultAltFallbackOrigin(),
|
| + TestDataReductionProxyParams::DefaultProbeURL());
|
| }
|
|
|
| TEST_F(DataReductionProxyParamsTest, NoDevOrigin) {
|
| @@ -157,47 +62,51 @@ TEST_F(DataReductionProxyParamsTest, NoDevOrigin) {
|
| DataReductionProxyParams::kAllowed |
|
| DataReductionProxyParams::kFallbackAllowed |
|
| DataReductionProxyParams::kPromoAllowed,
|
| - HAS_EVERYTHING & ~HAS_DEV_ORIGIN);
|
| + TestDataReductionProxyParams::HAS_EVERYTHING &
|
| + ~TestDataReductionProxyParams::HAS_DEV_ORIGIN);
|
| CheckParams(params, true, true, true, false, true);
|
| CheckValues(params,
|
| - kDefaultKey,
|
| - kDefaultOrigin,
|
| - kDefaultFallbackOrigin,
|
| - kDefaultSSLOrigin,
|
| - kDefaultAltOrigin,
|
| - kDefaultAltFallbackOrigin,
|
| - kDefaultProbeURL);
|
| + TestDataReductionProxyParams::DefaultOrigin(),
|
| + TestDataReductionProxyParams::DefaultFallbackOrigin(),
|
| + TestDataReductionProxyParams::DefaultSSLOrigin(),
|
| + TestDataReductionProxyParams::DefaultAltOrigin(),
|
| + TestDataReductionProxyParams::DefaultAltFallbackOrigin(),
|
| + TestDataReductionProxyParams::DefaultProbeURL());
|
| }
|
|
|
| TEST_F(DataReductionProxyParamsTest, Flags) {
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyKey, kFlagKey);
|
| - CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxy, kFlagOrigin);
|
| + switches::kDataReductionProxy,
|
| + TestDataReductionProxyParams::FlagOrigin());
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyFallback, kFlagFallbackOrigin);
|
| + switches::kDataReductionProxyFallback,
|
| + TestDataReductionProxyParams::FlagFallbackOrigin());
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionSSLProxy, kFlagSSLOrigin);
|
| + switches::kDataReductionSSLProxy,
|
| + TestDataReductionProxyParams::FlagSSLOrigin());
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyAlt, kFlagAltOrigin);
|
| + switches::kDataReductionProxyAlt,
|
| + TestDataReductionProxyParams::FlagAltOrigin());
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyAltFallback, kFlagAltFallbackOrigin);
|
| + switches::kDataReductionProxyAltFallback,
|
| + TestDataReductionProxyParams::FlagAltFallbackOrigin());
|
| CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyProbeURL, kFlagProbeURL);
|
| + switches::kDataReductionProxyProbeURL,
|
| + TestDataReductionProxyParams::FlagProbeURL());
|
| TestDataReductionProxyParams params(
|
| DataReductionProxyParams::kAllowed |
|
| DataReductionProxyParams::kFallbackAllowed |
|
| DataReductionProxyParams::kAlternativeAllowed |
|
| - DataReductionProxyParams::kPromoAllowed, HAS_EVERYTHING);
|
| + DataReductionProxyParams::kPromoAllowed,
|
| + TestDataReductionProxyParams::HAS_EVERYTHING);
|
| CheckParams(params, true, true, true, true, true);
|
| CheckValues(params,
|
| - kFlagKey,
|
| - kFlagOrigin,
|
| - kFlagFallbackOrigin,
|
| - kFlagSSLOrigin,
|
| - kFlagAltOrigin,
|
| - kFlagAltFallbackOrigin,
|
| - kFlagProbeURL);
|
| + TestDataReductionProxyParams::FlagOrigin(),
|
| + TestDataReductionProxyParams::FlagFallbackOrigin(),
|
| + TestDataReductionProxyParams::FlagSSLOrigin(),
|
| + TestDataReductionProxyParams::FlagAltOrigin(),
|
| + TestDataReductionProxyParams::FlagAltFallbackOrigin(),
|
| + TestDataReductionProxyParams::FlagProbeURL());
|
| }
|
|
|
| TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
|
| @@ -209,51 +118,295 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
|
| unsigned int missing_definitions;
|
| bool expected_result;
|
| } tests[] = {
|
| - { true, true, true, true, HAS_NOTHING, true },
|
| - { true, true, true, true, HAS_KEY, true },
|
| - { true, true, true, true, HAS_DEV_ORIGIN, true },
|
| - { true, true, true, true, HAS_ORIGIN, true },
|
| - { true, true, true, true, HAS_ORIGIN | HAS_DEV_ORIGIN, false },
|
| - { true, true, true, true, HAS_FALLBACK_ORIGIN, false },
|
| - { true, true, true, true, HAS_SSL_ORIGIN, false },
|
| - { true, true, true, true, HAS_ALT_ORIGIN, false },
|
| - { true, true, true, true, HAS_ALT_FALLBACK_ORIGIN, false },
|
| - { true, true, true, true, HAS_PROBE_URL, false },
|
| -
|
| - { true, false, true, true, HAS_NOTHING, true },
|
| - { true, false, true, true, HAS_KEY, true },
|
| - { true, false, true, true, HAS_ORIGIN | HAS_DEV_ORIGIN, false },
|
| - { true, false, true, true, HAS_FALLBACK_ORIGIN, true },
|
| - { true, false, true, true, HAS_SSL_ORIGIN, false },
|
| - { true, false, true, true, HAS_ALT_ORIGIN, false },
|
| - { true, false, true, true, HAS_ALT_FALLBACK_ORIGIN, true },
|
| - { true, false, true, true, HAS_PROBE_URL, false },
|
| -
|
| - { true, true, false, true, HAS_NOTHING, true },
|
| - { true, true, false, true, HAS_KEY, true },
|
| - { true, true, false, true, HAS_ORIGIN | HAS_DEV_ORIGIN, false },
|
| - { true, true, false, true, HAS_FALLBACK_ORIGIN, false },
|
| - { true, true, false, true, HAS_SSL_ORIGIN, true },
|
| - { true, true, false, true, HAS_ALT_ORIGIN, true },
|
| - { true, true, false, true, HAS_ALT_FALLBACK_ORIGIN, true },
|
| - { true, true, false, true, HAS_PROBE_URL, false },
|
| + {
|
| + true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_NOTHING,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_DEV_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ORIGIN |
|
| + TestDataReductionProxyParams::HAS_DEV_ORIGIN,
|
| + false
|
| + },
|
| + { true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
|
| + false
|
| + },
|
| + { true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_SSL_ORIGIN,
|
| + false
|
| + },
|
| + { true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_ORIGIN,
|
| + false
|
| + },
|
| + { true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
|
| + false
|
| + },
|
| + { true,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_PROBE_URL,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_NOTHING,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ORIGIN |
|
| + TestDataReductionProxyParams::HAS_DEV_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_SSL_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_PROBE_URL,
|
| + false
|
| + },
|
|
|
| - { true, false, false, true, HAS_KEY, true },
|
| - { true, false, false, true, HAS_ORIGIN | HAS_DEV_ORIGIN, false },
|
| - { true, false, false, true, HAS_FALLBACK_ORIGIN, true },
|
| - { true, false, false, true, HAS_SSL_ORIGIN, true },
|
| - { true, false, false, true, HAS_ALT_ORIGIN, true },
|
| - { true, false, false, true, HAS_ALT_FALLBACK_ORIGIN, true },
|
| - { true, false, false, true, HAS_PROBE_URL, false },
|
| -
|
| - { false, true, true, true, HAS_NOTHING, false },
|
| - { false, true, true, true, HAS_KEY, false },
|
| - { false, true, true, true, HAS_ORIGIN | HAS_DEV_ORIGIN, false },
|
| - { false, true, true, true, HAS_FALLBACK_ORIGIN, false },
|
| - { false, true, true, true, HAS_SSL_ORIGIN, false },
|
| - { false, true, true, true, HAS_ALT_ORIGIN, false },
|
| - { false, true, true, true, HAS_ALT_FALLBACK_ORIGIN, false },
|
| - { false, true, true, true, HAS_PROBE_URL, false },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_NOTHING,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ORIGIN |
|
| + TestDataReductionProxyParams::HAS_DEV_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_SSL_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + true,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_PROBE_URL,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ORIGIN |
|
| + TestDataReductionProxyParams::HAS_DEV_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_SSL_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
|
| + true
|
| + },
|
| + {
|
| + true,
|
| + false,
|
| + false,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_PROBE_URL,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_NOTHING,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ORIGIN |
|
| + TestDataReductionProxyParams::HAS_DEV_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_SSL_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
|
| + false
|
| + },
|
| + {
|
| + false,
|
| + true,
|
| + true,
|
| + true,
|
| + TestDataReductionProxyParams::HAS_PROBE_URL,
|
| + false
|
| + },
|
| };
|
|
|
| for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
|
| @@ -268,7 +421,8 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
|
| flags |= DataReductionProxyParams::kPromoAllowed;
|
| TestDataReductionProxyParams params(
|
| flags,
|
| - HAS_EVERYTHING & ~(tests[i].missing_definitions));
|
| + TestDataReductionProxyParams::HAS_EVERYTHING &
|
| + ~(tests[i].missing_definitions));
|
| EXPECT_EQ(tests[i].expected_result, params.init_result());
|
| }
|
| }
|
| @@ -281,58 +435,76 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
|
| net::HostPortPair expected_first;
|
| net::HostPortPair expected_second;
|
| } tests[] = {
|
| - { net::HostPortPair::FromURL(GURL(kDefaultOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultOrigin())),
|
| true,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultOrigin)),
|
| - net::HostPortPair::FromURL(GURL(kDefaultFallbackOrigin))
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultOrigin())),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultFallbackOrigin()))
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultOrigin())),
|
| false,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultOrigin)),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultOrigin())),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultFallbackOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultFallbackOrigin())),
|
| true,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultFallbackOrigin)),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultFallbackOrigin())),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultFallbackOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultFallbackOrigin())),
|
| false,
|
| false,
|
| net::HostPortPair::FromURL(GURL()),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultAltOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltOrigin())),
|
| true,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultAltOrigin)),
|
| - net::HostPortPair::FromURL(GURL(kDefaultAltFallbackOrigin))
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltOrigin())),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltFallbackOrigin()))
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultAltOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltOrigin())),
|
| false,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultAltOrigin)),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltOrigin())),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultAltFallbackOrigin)),
|
| + { net::HostPortPair::FromURL(
|
| + GURL(TestDataReductionProxyParams::DefaultAltFallbackOrigin())),
|
| true,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultAltFallbackOrigin)),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltFallbackOrigin())),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultAltFallbackOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultAltFallbackOrigin())),
|
| false,
|
| false,
|
| net::HostPortPair::FromURL(GURL()),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| - { net::HostPortPair::FromURL(GURL(kDefaultSSLOrigin)),
|
| + { net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultSSLOrigin())),
|
| true,
|
| true,
|
| - net::HostPortPair::FromURL(GURL(kDefaultSSLOrigin)),
|
| + net::HostPortPair::FromURL(GURL(
|
| + TestDataReductionProxyParams::DefaultSSLOrigin())),
|
| net::HostPortPair::FromURL(GURL())
|
| },
|
| };
|
| @@ -341,8 +513,10 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
|
| DataReductionProxyParams::kAlternativeAllowed;
|
| if (tests[i].fallback_allowed)
|
| flags |= DataReductionProxyParams::kFallbackAllowed;
|
| - TestDataReductionProxyParams params(flags,
|
| - HAS_EVERYTHING & ~HAS_DEV_ORIGIN);
|
| + TestDataReductionProxyParams params(
|
| + flags,
|
| + TestDataReductionProxyParams::HAS_EVERYTHING &
|
| + ~TestDataReductionProxyParams::HAS_DEV_ORIGIN);
|
| std::pair<GURL, GURL> proxy_servers;
|
| EXPECT_EQ(tests[i].expected_result,
|
| params.IsDataReductionProxy(
|
| @@ -353,5 +527,4 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
|
| net::HostPortPair::FromURL(proxy_servers.second)));
|
| }
|
| }
|
| -
|
| } // namespace data_reduction_proxy
|
|
|