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

Unified Diff: net/proxy/proxy_service_unittest.cc

Issue 542029: Retry proxies which were cached as bad before giving up.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_service_unittest.cc
===================================================================
--- net/proxy/proxy_service_unittest.cc (revision 35979)
+++ net/proxy/proxy_service_unittest.cc (working copy)
@@ -404,7 +404,7 @@
EXPECT_EQ(url, resolver->pending_requests()[0]->url());
// Set the result in proxy resolver -- the second result is already known
- // to be bad.
+ // to be bad, so we will not try to use it initially.
resolver->pending_requests()[0]->results()->UseNamedProxy(
"foopy3:7070;foopy1:8080;foopy2:9090");
resolver->pending_requests()[0]->CompleteNow(OK);
@@ -419,10 +419,18 @@
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI());
+ // We fake another error. At this point we have tried all of the
+ // proxy servers we thought were valid; next we try the proxy server
+ // that was in our bad proxies map (foopy1:8080).
+ TestCompletionCallback callback5;
+ rv = service->ReconsiderProxyAfterError(url, &info, &callback5, NULL, NULL);
+ EXPECT_EQ(OK, rv);
+ EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
+
// Fake another error, the last proxy is gone, the list should now be empty,
// so there is nothing left to try.
- TestCompletionCallback callback5;
- rv = service->ReconsiderProxyAfterError(url, &info, &callback5, NULL, NULL);
+ TestCompletionCallback callback6;
+ rv = service->ReconsiderProxyAfterError(url, &info, &callback6, NULL, NULL);
EXPECT_EQ(ERR_FAILED, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_TRUE(info.is_empty());
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698