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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc

Issue 2967993002: DRP: Make secure proxy check URL a DRP param (Closed)
Patch Set: megjablon comment Created 3 years, 5 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/core/common/data_reduction_proxy_params_unittest.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
index c61a79bb27a73b6b026a4ac0b357bfdc3b4bf94a..2da780a352a68ffedba463c589e605c113cbbcbf 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
@@ -37,8 +37,7 @@ class DataReductionProxyParamsTest : public testing::Test {
}
void CheckValues(const TestDataReductionProxyParams& params,
const std::string& expected_origin,
- const std::string& expected_fallback_origin,
- const std::string& expected_secure_proxy_check_url) {
+ const std::string& expected_fallback_origin) {
std::vector<net::ProxyServer> expected_proxies;
if (!expected_origin.empty()) {
expected_proxies.push_back(net::ProxyServer::FromURI(
@@ -53,8 +52,6 @@ class DataReductionProxyParamsTest : public testing::Test {
EXPECT_EQ(expected_proxies,
DataReductionProxyServer::ConvertToNetProxyServers(
params.proxies_for_http()));
- EXPECT_EQ(GURL(expected_secure_proxy_check_url),
- params.secure_proxy_check_url());
}
};
@@ -75,8 +72,6 @@ TEST_F(DataReductionProxyParamsTest, EverythingDefined) {
ProxyServer::CORE));
EXPECT_EQ(expected_proxies, params.proxies_for_http());
- EXPECT_EQ(GURL(TestDataReductionProxyParams::DefaultSecureProxyCheckURL()),
- params.secure_proxy_check_url());
}
TEST_F(DataReductionProxyParamsTest, Flags) {
@@ -86,34 +81,10 @@ TEST_F(DataReductionProxyParamsTest, Flags) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kDataReductionProxyFallback,
TestDataReductionProxyParams::FlagFallbackOrigin());
- base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kDataReductionProxySecureProxyCheckURL,
- TestDataReductionProxyParams::FlagSecureProxyCheckURL());
TestDataReductionProxyParams params;
CheckParams(params, true);
CheckValues(params, TestDataReductionProxyParams::FlagOrigin(),
- TestDataReductionProxyParams::FlagFallbackOrigin(),
- TestDataReductionProxyParams::FlagSecureProxyCheckURL());
-}
-
-TEST_F(DataReductionProxyParamsTest, CarrierTestFlag) {
- static const char kCarrierTestOrigin[] =
- "http://o-o.preferred.nttdocomodcp-hnd1.proxy-dev.googlezip.net:80";
- static const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80";
- base::CommandLine::ForCurrentProcess()->InitFromArgv(0, nullptr);
- base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kEnableDataReductionProxyCarrierTest, kCarrierTestOrigin);
- DataReductionProxyParams params;
- std::vector<DataReductionProxyServer> proxies_for_http;
- proxies_for_http.push_back(DataReductionProxyServer(
- net::ProxyServer::FromURI(kCarrierTestOrigin,
- net::ProxyServer::SCHEME_HTTP),
- ProxyServer::CORE));
- proxies_for_http.push_back(DataReductionProxyServer(
- net::ProxyServer::FromURI(kDefaultFallbackOrigin,
- net::ProxyServer::SCHEME_HTTP),
- ProxyServer::CORE));
- EXPECT_EQ(params.proxies_for_http(), proxies_for_http);
+ TestDataReductionProxyParams::FlagFallbackOrigin());
}
TEST_F(DataReductionProxyParamsTest, AndroidOnePromoFieldTrial) {
@@ -604,6 +575,33 @@ TEST_F(DataReductionProxyParamsTest, GetConfigServiceURL) {
}
}
+TEST_F(DataReductionProxyParamsTest, SecureProxyURL) {
+ const struct {
+ std::string test_case;
+ std::string flag_value;
+ GURL expected;
+ } tests[] = {
+ {
+ "Nothing set", "", GURL("http://check.googlezip.net/connect"),
+ },
+ {
+ "Only command line set", "http://example.com/flag",
+ GURL("http://example.com/flag"),
+ },
+ };
+
+ for (const auto& test : tests) {
+ // Reset all flags.
+ base::CommandLine::ForCurrentProcess()->InitFromArgv(0, NULL);
+ if (!test.flag_value.empty()) {
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kDataReductionProxySecureProxyCheckURL, test.flag_value);
+ }
+ EXPECT_EQ(test.expected, params::GetSecureProxyCheckURL())
+ << test.test_case;
+ }
+}
+
TEST(DataReductionProxyParamsStandaloneTest, OverrideProxiesForHttp) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kDataReductionProxyHttpProxies,

Powered by Google App Engine
This is Rietveld 408576698