Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_params_unittest.cc

Issue 586333003: Disable fallback support for alternative data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2d0dfa0fae9ff0cb212357b0acde19c42682796b..84d245d61be44e85b5a492e408f4bd7334c3323d 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
@@ -119,6 +119,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
bool allowed;
bool fallback_allowed;
bool alternative_allowed;
+ bool alternative_fallback_allowed;
bool promo_allowed;
unsigned int missing_definitions;
bool expected_result;
@@ -127,6 +128,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_NOTHING,
true
@@ -135,6 +137,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_DEV_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN,
@@ -144,6 +147,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ORIGIN,
true
@@ -152,45 +156,65 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN,
false
},
- { true,
+ {
+ true,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN,
false
},
- { true,
+ {
true,
true,
true,
+ false,
+ true,
TestDataReductionProxyParams::HAS_SSL_ORIGIN,
false
},
- { true,
+ {
true,
true,
true,
+ false,
+ true,
TestDataReductionProxyParams::HAS_ALT_ORIGIN,
false
},
- { true,
+ {
+ true,
+ true,
+ true,
+ false,
+ true,
+ TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
+ true
+ },
+ {
+ true,
+ true,
true,
true,
true,
TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
false
},
- { true,
+ {
true,
true,
true,
+ false,
+ true,
TestDataReductionProxyParams::HAS_PROBE_URL,
false
},
@@ -198,6 +222,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_NOTHING,
true
@@ -206,6 +231,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_ORIGIN |
@@ -216,6 +242,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
true
@@ -224,6 +251,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_SSL_ORIGIN,
false
@@ -232,6 +260,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_ORIGIN,
false
@@ -240,6 +269,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
true
@@ -249,14 +279,24 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ true,
+ TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
+ false
+ },
+ {
+ true,
+ false,
+ true,
+ false,
+ true,
TestDataReductionProxyParams::HAS_PROBE_URL,
false
},
-
{
true,
true,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_NOTHING,
true
@@ -265,6 +305,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_ORIGIN |
@@ -275,6 +316,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN,
@@ -284,6 +326,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_SSL_ORIGIN,
true
@@ -292,6 +335,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_ORIGIN,
true
@@ -300,6 +344,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
true,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
true
@@ -309,6 +354,16 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
true,
+ true,
+ TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
+ false
+ },
+ {
+ true,
+ true,
+ false,
+ false,
+ true,
TestDataReductionProxyParams::HAS_PROBE_URL,
false
},
@@ -316,6 +371,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_ORIGIN |
@@ -326,6 +382,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
true
@@ -334,6 +391,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_SSL_ORIGIN,
true
@@ -342,6 +400,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_ORIGIN,
true
@@ -350,6 +409,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
true,
false,
false,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
true
@@ -359,6 +419,16 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
false,
true,
+ true,
+ TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
+ false
+ },
+ {
+ true,
+ false,
+ false,
+ false,
+ true,
TestDataReductionProxyParams::HAS_PROBE_URL,
false
},
@@ -366,6 +436,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_NOTHING,
false
@@ -374,6 +445,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ORIGIN |
TestDataReductionProxyParams::HAS_DEV_ORIGIN |
@@ -384,6 +456,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN,
false
@@ -392,6 +465,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_SSL_ORIGIN,
false
@@ -400,6 +474,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_ALT_ORIGIN,
false
@@ -408,6 +483,16 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
+ true,
+ TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
+ false
+ },
+ {
+ false,
+ true,
+ true,
+ true,
true,
TestDataReductionProxyParams::HAS_ALT_FALLBACK_ORIGIN,
false
@@ -416,6 +501,7 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
false,
true,
true,
+ false,
true,
TestDataReductionProxyParams::HAS_PROBE_URL,
false
@@ -430,6 +516,8 @@ TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
flags |= DataReductionProxyParams::kFallbackAllowed;
if (tests[i].alternative_allowed)
flags |= DataReductionProxyParams::kAlternativeAllowed;
+ if (tests[i].alternative_fallback_allowed)
+ flags |= DataReductionProxyParams::kAlternativeFallbackAllowed;
if (tests[i].promo_allowed)
flags |= DataReductionProxyParams::kPromoAllowed;
TestDataReductionProxyParams params(
@@ -444,6 +532,7 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
const struct {
net::HostPortPair host_port_pair;
bool fallback_allowed;
+ bool alt_fallback_allowed;
bool set_dev_origin;
bool expected_result;
net::HostPortPair expected_first;
@@ -452,9 +541,11 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
bool expected_is_alternative;
bool expected_is_ssl;
} tests[] = {
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultOrigin())),
true,
+ true,
false,
true,
net::HostPortPair::FromURL(GURL(
@@ -465,10 +556,12 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
false,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultOrigin())),
false,
false,
+ false,
true,
net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultOrigin())),
@@ -477,9 +570,11 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
false,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultFallbackOrigin())),
true,
+ true,
false,
true,
net::HostPortPair::FromURL(GURL(
@@ -489,20 +584,24 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
false,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultFallbackOrigin())),
false,
false,
false,
+ false,
net::HostPortPair::FromURL(GURL()),
net::HostPortPair::FromURL(GURL()),
false,
false,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultAltOrigin())),
true,
+ true,
false,
true,
net::HostPortPair::FromURL(GURL(
@@ -513,10 +612,12 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
true,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultAltOrigin())),
false,
false,
+ false,
true,
net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultAltOrigin())),
@@ -525,9 +626,11 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
true,
false
},
- { net::HostPortPair::FromURL(
+ {
+ net::HostPortPair::FromURL(
GURL(TestDataReductionProxyParams::DefaultAltFallbackOrigin())),
true,
+ true,
false,
true,
net::HostPortPair::FromURL(GURL(
@@ -537,20 +640,24 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
true,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultAltFallbackOrigin())),
false,
false,
false,
+ false,
net::HostPortPair::FromURL(GURL()),
net::HostPortPair::FromURL(GURL()),
false,
false,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultSSLOrigin())),
true,
+ true,
false,
true,
net::HostPortPair::FromURL(GURL(
@@ -560,11 +667,13 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
false,
true
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultDevOrigin())),
true,
true,
true,
+ true,
net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultDevOrigin())),
net::HostPortPair::FromURL(GURL(
@@ -573,10 +682,12 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
false,
false
},
- { net::HostPortPair::FromURL(GURL(
+ {
+ net::HostPortPair::FromURL(GURL(
TestDataReductionProxyParams::DefaultOrigin())),
true,
true,
+ true,
false,
net::HostPortPair::FromURL(GURL()),
net::HostPortPair::FromURL(GURL()),
@@ -590,6 +701,8 @@ TEST_F(DataReductionProxyParamsTest, IsDataReductionProxy) {
DataReductionProxyParams::kAlternativeAllowed;
if (tests[i].fallback_allowed)
flags |= DataReductionProxyParams::kFallbackAllowed;
+ if (tests[i].alt_fallback_allowed)
+ flags |= DataReductionProxyParams::kAlternativeFallbackAllowed;
unsigned int has_definitions = TestDataReductionProxyParams::HAS_EVERYTHING;
if (!tests[i].set_dev_origin) {
has_definitions &= ~TestDataReductionProxyParams::HAS_DEV_ORIGIN;

Powered by Google App Engine
This is Rietveld 408576698