diff options
author | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-29 16:39:00 +0000 |
---|---|---|
committer | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-29 16:39:00 +0000 |
commit | 96e1933fd50fb512c5e678169d0d2c59841a7d1a (patch) | |
tree | e93a20434f5478025387ca0f022d3f511a9a7bf2 /net/proxy/proxy_service_unittest.cc | |
parent | 61b75a55cd3366f236584da844cc5f9fd5a37a99 (diff) | |
download | chromium_src-96e1933fd50fb512c5e678169d0d2c59841a7d1a.zip chromium_src-96e1933fd50fb512c5e678169d0d2c59841a7d1a.tar.gz chromium_src-96e1933fd50fb512c5e678169d0d2c59841a7d1a.tar.bz2 |
Only mark a proxy as bad if we have confirmation that another proxy succeeded for the same request.
BUG=87336
TEST=net_unittests --gtest_filter=ProxyServiceTest.ProxyFallback:HttpStreamFactoryTest.JobNotifiesProxy
Review URL: http://codereview.chromium.org/7532011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98643 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service_unittest.cc')
-rw-r--r-- | net/proxy/proxy_service_unittest.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index d41f48c..b2345d5 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -541,6 +541,9 @@ TEST(ProxyServiceTest, ProxyFallback) { // The second proxy should be specified. EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); + // Report back that the second proxy worked. This will globally mark the + // first proxy as bad. + service.ReportSuccess(info); TestCompletionCallback callback3; rv = service.ResolveProxy(url, &info, &callback3, NULL, BoundNetLog()); @@ -584,6 +587,25 @@ TEST(ProxyServiceTest, ProxyFallback) { EXPECT_FALSE(info.is_direct()); EXPECT_TRUE(info.is_empty()); + // Look up proxies again + TestCompletionCallback callback7; + rv = service.ResolveProxy(url, &info, &callback7, NULL, BoundNetLog()); + EXPECT_EQ(ERR_IO_PENDING, rv); + + ASSERT_EQ(1u, resolver->pending_requests().size()); + EXPECT_EQ(url, resolver->pending_requests()[0]->url()); + + // This time, the first 3 results have been found to be bad, but only the + // first proxy has been confirmed ... + resolver->pending_requests()[0]->results()->UseNamedProxy( + "foopy1:8080;foopy3:7070;foopy2:9090;foopy4:9091"); + resolver->pending_requests()[0]->CompleteNow(OK); + + // ... therefore, we should see the second proxy first. + EXPECT_EQ(OK, callback7.WaitForResult()); + EXPECT_FALSE(info.is_direct()); + EXPECT_EQ("foopy3:7070", info.proxy_server().ToURI()); + // TODO(nsylvain): Test that the proxy can be retried after the delay. } |