diff options
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())); } } |