Chromium Code Reviews| Index: net/proxy/proxy_list_unittest.cc |
| diff --git a/net/proxy/proxy_list_unittest.cc b/net/proxy/proxy_list_unittest.cc |
| index 04d926880443295871ab93ec2318790601982c6c..dbdbcb5c2fa3ca19b9235045b9d0e8b576a2db5d 100644 |
| --- a/net/proxy/proxy_list_unittest.cc |
| +++ b/net/proxy/proxy_list_unittest.cc |
| @@ -89,6 +89,33 @@ TEST(ProxyListTest, RemoveProxiesWithoutScheme) { |
| } |
| } |
| +TEST(ProxyListTest, HasUntriedProxies) { |
| + // As in DeprioritizeBadProxies, we use a lengthy timeout to avoid depending |
| + // on the current time. |
| + ProxyRetryInfo proxy_retry_info; |
| + proxy_retry_info.bad_until = |
| + base::TimeTicks::Now() + base::TimeDelta::FromDays(1); |
| + |
| + // An empty list has nothing to try. |
| + { |
| + ProxyList list; |
| + ProxyRetryInfoMap proxy_retry_info; |
| + EXPECT_FALSE(list.HasUntriedProxies(proxy_retry_info)); |
| + } |
| + |
| + // A list with one bad proxy has something to try. With two bad proxies, |
| + // there's nothing to try. |
| + { |
| + ProxyList list; |
| + list.SetFromPacString("PROXY bad1:80; PROXY bad2:80"); |
|
eroman
2012/10/12 18:30:58
Also consider adding a test with PAC string that c
Michael Piatek
2012/10/15 17:10:16
Done.
|
| + ProxyRetryInfoMap retry_info_map; |
| + retry_info_map["bad1:80"] = proxy_retry_info; |
| + EXPECT_TRUE(list.HasUntriedProxies(retry_info_map)); |
| + retry_info_map["bad2:80"] = proxy_retry_info; |
| + EXPECT_FALSE(list.HasUntriedProxies(retry_info_map)); |
| + } |
| +} |
| + |
| TEST(ProxyListTest, DeprioritizeBadProxies) { |
| // Retry info that marks a proxy as being bad for a *very* long time (to avoid |
| // the test depending on the current time.) |