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

Unified Diff: net/proxy/proxy_config_unittest.cc

Issue 149191: Whenever proxy configurations contain socks and http/https/ftp proxies, socks... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « net/proxy/proxy_config_service_win_unittest.cc ('k') | net/proxy/proxy_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_config_unittest.cc
===================================================================
--- net/proxy/proxy_config_unittest.cc (revision 20472)
+++ net/proxy/proxy_config_unittest.cc (working copy)
@@ -49,18 +49,21 @@
// Test |ProxyConfig::proxy_rules|.
config2.proxy_rules.type = net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY;
- config2.proxy_rules.single_proxy = net::ProxyServer::FromURI("myproxy:80");
+ config2.proxy_rules.single_proxy =
+ net::ProxyServer::FromURI("myproxy:80", net::ProxyServer::SCHEME_HTTP);
EXPECT_FALSE(config1.Equals(config2));
EXPECT_FALSE(config2.Equals(config1));
config1.proxy_rules.type = net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY;
- config1.proxy_rules.single_proxy = net::ProxyServer::FromURI("myproxy:100");
+ config1.proxy_rules.single_proxy =
+ net::ProxyServer::FromURI("myproxy:100", net::ProxyServer::SCHEME_HTTP);
EXPECT_FALSE(config1.Equals(config2));
EXPECT_FALSE(config2.Equals(config1));
- config1.proxy_rules.single_proxy = net::ProxyServer::FromURI("myproxy");
+ config1.proxy_rules.single_proxy =
+ net::ProxyServer::FromURI("myproxy", net::ProxyServer::SCHEME_HTTP);
EXPECT_TRUE(config1.Equals(config2));
EXPECT_TRUE(config2.Equals(config1));
@@ -99,6 +102,7 @@
const char* proxy_for_http;
const char* proxy_for_https;
const char* proxy_for_ftp;
+ const char* socks_proxy;
} tests[] = {
// One HTTP proxy for all schemes.
{
@@ -109,6 +113,7 @@
NULL,
NULL,
NULL,
+ NULL,
},
// Only specify a proxy server for "http://" urls.
@@ -120,6 +125,7 @@
"myproxy:80",
NULL,
NULL,
+ NULL,
},
// Specify an HTTP proxy for "ftp://" and a SOCKS proxy for "https://" urls.
@@ -131,6 +137,7 @@
NULL,
"socks4://foopy:1080",
"ftp-proxy:80",
+ NULL,
},
// Give a scheme-specific proxy as well as a non-scheme specific.
@@ -144,6 +151,7 @@
NULL,
NULL,
NULL,
+ NULL,
},
// Give a scheme-specific proxy as well as a non-scheme specific.
@@ -157,6 +165,7 @@
NULL,
NULL,
"ftp-proxy:80",
+ NULL,
},
// Include duplicate entries -- last one wins.
@@ -168,19 +177,46 @@
NULL,
NULL,
"ftp3:80",
+ NULL,
},
- // Only socks proxy present, others being blank.
- { // NOLINT
+ // Only SOCKS proxy present, others being blank.
+ {
"socks=foopy",
- net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
- "socks4://foopy:1080",
+ net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
NULL,
NULL,
NULL,
+ NULL,
+ "socks4://foopy:1080",
+ },
+
+ // SOCKS proxy present along with other proxies too
+ {
+ "http=httpproxy ; https=httpsproxy ; ftp=ftpproxy ; socks=foopy ",
+
+ net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
+ NULL,
+ "httpproxy:80",
+ "httpsproxy:80",
+ "ftpproxy:80",
+ "socks4://foopy:1080",
},
+ // SOCKS proxy (with modifier) present along with some proxies
+ // (FTP being blank)
+ {
+ "http=httpproxy ; https=httpsproxy ; socks=socks5://foopy ",
+
+ net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
+ NULL,
+ "httpproxy:80",
+ "httpsproxy:80",
+ NULL,
+ "socks5://foopy:1080",
+ },
+
// Include unsupported schemes -- they are discarded.
{
"crazy=foopy ; foo=bar ; https=myhttpsproxy",
@@ -190,6 +226,7 @@
NULL,
"myhttpsproxy:80",
NULL,
+ NULL,
},
};
@@ -207,6 +244,8 @@
config.proxy_rules.proxy_for_https);
ExpectProxyServerEquals(tests[i].proxy_for_ftp,
config.proxy_rules.proxy_for_ftp);
+ ExpectProxyServerEquals(tests[i].socks_proxy,
+ config.proxy_rules.socks_proxy);
}
}
« no previous file with comments | « net/proxy/proxy_config_service_win_unittest.cc ('k') | net/proxy/proxy_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698