diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 00:20:48 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 00:20:48 +0000 |
commit | ed4ed0fa4e964e416cd3ac65df64bc238f65461c (patch) | |
tree | 83a492355815043301313a6cced9fb96a033c37f /net/proxy/proxy_config_service_win_unittest.cc | |
parent | b07408332337cd6f10b31e87cbed0886e872fa93 (diff) | |
download | chromium_src-ed4ed0fa4e964e416cd3ac65df64bc238f65461c.zip chromium_src-ed4ed0fa4e964e416cd3ac65df64bc238f65461c.tar.gz chromium_src-ed4ed0fa4e964e416cd3ac65df64bc238f65461c.tar.bz2 |
ProxyConfig behaved like a struct, but was defined as a class.
Changed it to be a proper class with hidden implementation variables, setters etc.
Also seized this opportunity to move the bypass list from being a member of ProxyConfig, to being a member of ProxyRules. This is a more correct hiearchy, since the bypass rules only apply to the manual settings. Lastly, this makes it possible to have the manual rules evaluation be a method on ProxyRules, and shift some more code out of proxy_service.
Review URL: http://codereview.chromium.org/651070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_config_service_win_unittest.cc')
-rw-r--r-- | net/proxy/proxy_config_service_win_unittest.cc | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/net/proxy/proxy_config_service_win_unittest.cc b/net/proxy/proxy_config_service_win_unittest.cc index ffcb0be..1d4f45d 100644 --- a/net/proxy/proxy_config_service_win_unittest.cc +++ b/net/proxy/proxy_config_service_win_unittest.cc @@ -19,7 +19,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected outputs (fields of the ProxyConfig). bool auto_detect; GURL pac_url; - ProxyConfig::ProxyRules proxy_rules; + ProxyRulesExpectation proxy_rules; const char* proxy_bypass_list; // newline separated } tests[] = { // Auto detect. @@ -34,8 +34,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. true, // auto_detect GURL(), // pac_url - ProxyConfig::ProxyRules(), // proxy_rules - "", // proxy_bypass_list + ProxyRulesExpectation::Empty(), }, // Valid PAC url @@ -50,8 +49,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. false, // auto_detect GURL("http://wpad/wpad.dat"), // pac_url - ProxyConfig::ProxyRules(), // proxy_rules - "", // proxy_bypass_list + ProxyRulesExpectation::Empty(), }, // Invalid PAC url string. @@ -66,8 +64,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. false, // auto_detect GURL(), // pac_url - ProxyConfig::ProxyRules(), // proxy_rules - "", // proxy_bypass_list + ProxyRulesExpectation::Empty(), }, // Single-host in proxy list. @@ -82,8 +79,9 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. false, // auto_detect GURL(), // pac_url - MakeSingleProxyRules("www.google.com"), // proxy_rules - "", // proxy_bypass_list + ProxyRulesExpectation::Single( + "www.google.com:80", // single proxy + ""), // bypass rules }, // Per-scheme proxy rules. @@ -98,8 +96,11 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. false, // auto_detect GURL(), // pac_url - MakeProxyPerSchemeRules("www.google.com:80", "www.foo.com:110", ""), - "", // proxy_bypass_list + ProxyRulesExpectation::PerScheme( + "www.google.com:80", // http + "www.foo.com:110", // https + "", // ftp + ""), // bypass rules }, // SOCKS proxy configuration @@ -115,9 +116,12 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. false, // auto_detect GURL(), // pac_url - MakeProxyPerSchemeRules("www.google.com:80", "www.foo.com:110", - "ftpproxy:20", "foopy:130"), - "", // proxy_bypass_list + ProxyRulesExpectation::PerSchemeWithSocks( + "www.google.com:80", // http + "www.foo.com:110", // https + "ftpproxy:20", // ftp + "socks4://foopy:130", // socks + ""), // bypass rules }, // Bypass local names. @@ -131,8 +135,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { true, // auto_detect GURL(), // pac_url - ProxyConfig::ProxyRules(), // proxy_rules - "<local>\n", // proxy_bypass_list + ProxyRulesExpectation::EmptyWithBypass("<local>"), }, // Bypass "google.com" and local names, using semicolon as delimeter @@ -148,8 +151,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. true, // auto_detect GURL(), // pac_url - ProxyConfig::ProxyRules(), // proxy_rules - "<local>\ngoogle.com\n", // proxy_bypass_list + ProxyRulesExpectation::EmptyWithBypass("<local>,google.com"), }, // Bypass "foo.com" and "google.com", using lines as delimeter. @@ -164,8 +166,7 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { // Expected result. true, // auto_detect GURL(), // pac_url - ProxyConfig::ProxyRules(), // proxy_rules - "foo.com\ngoogle.com\n", // proxy_bypass_list + ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"), }, }; @@ -173,11 +174,9 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) { ProxyConfig config; ProxyConfigServiceWin::SetFromIEConfig(&config, tests[i].ie_config); - EXPECT_EQ(tests[i].auto_detect, config.auto_detect); - EXPECT_EQ(tests[i].pac_url, config.pac_url); - EXPECT_EQ(tests[i].proxy_bypass_list, - FlattenProxyBypass(config.bypass_rules)); - EXPECT_EQ(tests[i].proxy_rules, config.proxy_rules); + EXPECT_EQ(tests[i].auto_detect, config.auto_detect()); + EXPECT_EQ(tests[i].pac_url, config.pac_url()); + EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules())); } } |