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

Unified Diff: net/proxy/proxy_list_unittest.cc

Issue 10987043: Receiving Connection: Proxy-Bypass induces proxy fallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Suppress proxy fallback loops. Created 8 years, 2 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_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.)

Powered by Google App Engine
This is Rietveld 408576698