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

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: Build fix for android_dbg. 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
« no previous file with comments | « net/proxy/proxy_list.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..470a9000882e001e35a109e5087aa9238a8f707f 100644
--- a/net/proxy/proxy_list_unittest.cc
+++ b/net/proxy/proxy_list_unittest.cc
@@ -89,6 +89,42 @@ 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");
+ 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));
+ }
+
+ // A list with one bad proxy and a DIRECT entry has something to try.
+ {
+ ProxyList list;
+ list.SetFromPacString("PROXY bad1:80; DIRECT");
+ ProxyRetryInfoMap retry_info_map;
+ retry_info_map["bad1:80"] = proxy_retry_info;
+ EXPECT_TRUE(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.)
« no previous file with comments | « net/proxy/proxy_list.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698