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

Unified Diff: net/proxy/proxy_config_unittest.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: net/proxy/proxy_config_unittest.cc
diff --git a/net/proxy/proxy_config_unittest.cc b/net/proxy/proxy_config_unittest.cc
index 4b041b343409d4edc3a840f739cf98e5721723a9..5ea135efa932f5bc5df01b21547027e1006b7543 100644
--- a/net/proxy/proxy_config_unittest.cc
+++ b/net/proxy/proxy_config_unittest.cc
@@ -107,204 +107,123 @@ TEST(ProxyConfigTest, ParseProxyRules) {
const char* proxy_for_ftp;
const char* fallback_proxy;
} tests[] = {
- // One HTTP proxy for all schemes.
- {
- "myproxy:80",
-
- ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
- "PROXY myproxy:80",
- NULL,
- NULL,
- NULL,
- NULL,
- },
-
- // Multiple HTTP proxies for all schemes.
- {
- "myproxy:80,https://myotherproxy",
-
- ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
- "PROXY myproxy:80;HTTPS myotherproxy:443",
- NULL,
- NULL,
- NULL,
- NULL,
- },
-
- // Only specify a proxy server for "http://" urls.
- {
- "http=myproxy:80",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "PROXY myproxy:80",
- NULL,
- NULL,
- NULL,
- },
-
- // Specify an HTTP proxy for "ftp://" and a SOCKS proxy for "https://" urls.
- {
- "ftp=ftp-proxy ; https=socks4://foopy",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- NULL,
- "SOCKS foopy:1080",
- "PROXY ftp-proxy:80",
- NULL,
- },
-
- // Give a scheme-specific proxy as well as a non-scheme specific.
- // The first entry "foopy" takes precedance marking this list as
- // TYPE_SINGLE_PROXY.
- {
- "foopy ; ftp=ftp-proxy",
-
- ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
- "PROXY foopy:80",
- NULL,
- NULL,
- NULL,
- NULL,
- },
-
- // Give a scheme-specific proxy as well as a non-scheme specific.
- // The first entry "ftp=ftp-proxy" takes precedance marking this list as
- // TYPE_PROXY_PER_SCHEME.
- {
- "ftp=ftp-proxy ; foopy",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- NULL,
- NULL,
- "PROXY ftp-proxy:80",
- NULL,
- },
-
- // Include a list of entries for a single scheme.
- {
- "ftp=ftp1,ftp2,ftp3",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- NULL,
- NULL,
- "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80",
- NULL,
- },
-
- // Include multiple entries for the same scheme -- they accumulate.
- {
- "http=http1,http2; http=http3",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "PROXY http1:80;PROXY http2:80;PROXY http3:80",
- NULL,
- NULL,
- NULL,
- },
-
- // Include lists of entries for multiple schemes.
- {
- "ftp=ftp1,ftp2,ftp3 ; http=http1,http2; ",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "PROXY http1:80;PROXY http2:80",
- NULL,
- "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80",
- NULL,
- },
-
- // Include non-default proxy schemes.
- {
- "http=https://secure_proxy; ftp=socks4://socks_proxy; https=socks://foo",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "HTTPS secure_proxy:443",
- "SOCKS5 foo:1080",
- "SOCKS socks_proxy:1080",
- NULL,
- },
-
- // Only SOCKS proxy present, others being blank.
- {
- "socks=foopy",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- NULL,
- NULL,
- NULL,
- "SOCKS foopy:1080",
- },
-
- // SOCKS proxy present along with other proxies too
- {
- "http=httpproxy ; https=httpsproxy ; ftp=ftpproxy ; socks=foopy ",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "PROXY httpproxy:80",
- "PROXY httpsproxy:80",
- "PROXY ftpproxy:80",
- "SOCKS foopy:1080",
- },
-
- // SOCKS proxy (with modifier) present along with some proxies
- // (FTP being blank)
- {
- "http=httpproxy ; https=httpsproxy ; socks=socks5://foopy ",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "PROXY httpproxy:80",
- "PROXY httpsproxy:80",
- NULL,
- "SOCKS5 foopy:1080",
- },
-
- // Include unsupported schemes -- they are discarded.
- {
- "crazy=foopy ; foo=bar ; https=myhttpsproxy",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- NULL,
- "PROXY myhttpsproxy:80",
- NULL,
- NULL,
- },
-
- // direct:// as first option for a scheme.
- {
- "http=direct://,myhttpproxy; https=direct://",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "DIRECT;PROXY myhttpproxy:80",
- "DIRECT",
- NULL,
- NULL,
- },
-
- // direct:// as a second option for a scheme.
- {
- "http=myhttpproxy,direct://",
-
- ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- NULL,
- "PROXY myhttpproxy:80;DIRECT",
- NULL,
- NULL,
- NULL,
- },
-
- };
+ // One HTTP proxy for all schemes.
+ {
+ "myproxy:80", ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
+ "PROXY myproxy:80", NULL, NULL, NULL, NULL,
+ },
+
+ // Multiple HTTP proxies for all schemes.
+ {
+ "myproxy:80,https://myotherproxy",
+ ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
+ "PROXY myproxy:80;HTTPS myotherproxy:443", NULL, NULL, NULL, NULL,
+ },
+
+ // Only specify a proxy server for "http://" urls.
+ {
+ "http=myproxy:80", ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
+ NULL, "PROXY myproxy:80", NULL, NULL, NULL,
+ },
+
+ // Specify an HTTP proxy for "ftp://" and a SOCKS proxy for "https://"
+ // urls.
+ {
+ "ftp=ftp-proxy ; https=socks4://foopy",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL, NULL,
+ "SOCKS foopy:1080", "PROXY ftp-proxy:80", NULL,
+ },
+
+ // Give a scheme-specific proxy as well as a non-scheme specific.
+ // The first entry "foopy" takes precedance marking this list as
+ // TYPE_SINGLE_PROXY.
+ {
+ "foopy ; ftp=ftp-proxy", ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
+ "PROXY foopy:80", NULL, NULL, NULL, NULL,
+ },
+
+ // Give a scheme-specific proxy as well as a non-scheme specific.
+ // The first entry "ftp=ftp-proxy" takes precedance marking this list as
+ // TYPE_PROXY_PER_SCHEME.
+ {
+ "ftp=ftp-proxy ; foopy",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL, NULL, NULL,
+ "PROXY ftp-proxy:80", NULL,
+ },
+
+ // Include a list of entries for a single scheme.
+ {
+ "ftp=ftp1,ftp2,ftp3", ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
+ NULL, NULL, NULL, "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80", NULL,
+ },
+
+ // Include multiple entries for the same scheme -- they accumulate.
+ {
+ "http=http1,http2; http=http3",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "PROXY http1:80;PROXY http2:80;PROXY http3:80", NULL, NULL, NULL,
+ },
+
+ // Include lists of entries for multiple schemes.
+ {
+ "ftp=ftp1,ftp2,ftp3 ; http=http1,http2; ",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "PROXY http1:80;PROXY http2:80", NULL,
+ "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80", NULL,
+ },
+
+ // Include non-default proxy schemes.
+ {
+ "http=https://secure_proxy; ftp=socks4://socks_proxy; "
+ "https=socks://foo",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "HTTPS secure_proxy:443", "SOCKS5 foo:1080", "SOCKS socks_proxy:1080",
+ NULL,
+ },
+
+ // Only SOCKS proxy present, others being blank.
+ {
+ "socks=foopy", ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ NULL, NULL, NULL, "SOCKS foopy:1080",
+ },
+
+ // SOCKS proxy present along with other proxies too
+ {
+ "http=httpproxy ; https=httpsproxy ; ftp=ftpproxy ; socks=foopy ",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "PROXY httpproxy:80", "PROXY httpsproxy:80", "PROXY ftpproxy:80",
+ "SOCKS foopy:1080",
+ },
+
+ // SOCKS proxy (with modifier) present along with some proxies
+ // (FTP being blank)
+ {
+ "http=httpproxy ; https=httpsproxy ; socks=socks5://foopy ",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "PROXY httpproxy:80", "PROXY httpsproxy:80", NULL, "SOCKS5 foopy:1080",
+ },
+
+ // Include unsupported schemes -- they are discarded.
+ {
+ "crazy=foopy ; foo=bar ; https=myhttpsproxy",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL, NULL,
+ "PROXY myhttpsproxy:80", NULL, NULL,
+ },
+
+ // direct:// as first option for a scheme.
+ {
+ "http=direct://,myhttpproxy; https=direct://",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "DIRECT;PROXY myhttpproxy:80", "DIRECT", NULL, NULL,
+ },
+
+ // direct:// as a second option for a scheme.
+ {
+ "http=myhttpproxy,direct://",
+ ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, NULL,
+ "PROXY myhttpproxy:80;DIRECT", NULL, NULL, NULL,
+ },
+ };
ProxyConfig config;
@@ -328,7 +247,7 @@ TEST(ProxyConfigTest, ParseProxyRules) {
TEST(ProxyConfigTest, ProxyRulesSetBypassFlag) {
// Test whether the did_bypass_proxy() flag is set in proxy info correctly.
ProxyConfig::ProxyRules rules;
- ProxyInfo result;
+ ProxyInfo result;
rules.ParseFromString("http=httpproxy:80");
rules.bypass_rules.AddRuleFromString(".com");

Powered by Google App Engine
This is Rietveld 408576698