From 10b71b546ae4ce616bd2a26c5fcadfdfcddf4e3f Mon Sep 17 00:00:00 2001 From: "agayev@chromium.org" Date: Thu, 28 Jul 2011 02:20:06 +0000 Subject: Revert 94412 - HostResolverImpl: don't interpret NULL callback argument as a request to do synchronous resolution. BUG=90547,60149 TEST=net_unittests --gtest_filter="HostResolverImplTest*" Review URL: http://codereview.chromium.org/7465046 TBR=agayev@chromium.org Review URL: http://codereview.chromium.org/7524018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94417 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/http_network_transaction_unittest.cc | 31 ++++++++------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'net/http') diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 9679667..2a942dc 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -5833,21 +5833,20 @@ void BypassHostCacheOnRefreshHelper(int load_flags) { scoped_ptr trans(new HttpNetworkTransaction( CreateSession(&session_deps))); - // Warm up the host cache so it has an entry for "www.google.com". + // Warm up the host cache so it has an entry for "www.google.com" (by doing + // a synchronous lookup.) AddressList addrlist; - TestCompletionCallback callback; int rv = session_deps.host_resolver->Resolve( HostResolver::RequestInfo(HostPortPair("www.google.com", 80)), &addrlist, - &callback, NULL, BoundNetLog()); - EXPECT_EQ(ERR_IO_PENDING, rv); - rv = callback.WaitForResult(); + NULL, NULL, BoundNetLog()); EXPECT_EQ(OK, rv); // Verify that it was added to host cache, by doing a subsequent async lookup // and confirming it completes synchronously. + TestCompletionCallback resolve_callback; rv = session_deps.host_resolver->Resolve( HostResolver::RequestInfo(HostPortPair("www.google.com", 80)), &addrlist, - &callback, NULL, BoundNetLog()); + &resolve_callback, NULL, BoundNetLog()); ASSERT_EQ(OK, rv); // Inject a failure the next time that "www.google.com" is resolved. This way @@ -5862,6 +5861,7 @@ void BypassHostCacheOnRefreshHelper(int load_flags) { session_deps.socket_factory.AddSocketDataProvider(&data); // Run the request. + TestCompletionCallback callback; rv = trans->Start(&request, &callback, BoundNetLog()); ASSERT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); @@ -8721,12 +8721,7 @@ void IPPoolingAddAlias(MockCachingHostResolver* host_resolver, // Resolve the host and port. AddressList addresses; HostResolver::RequestInfo info(host_port_pair); - TestCompletionCallback callback; - int rv = host_resolver->Resolve(info, &addresses, &callback, NULL, - BoundNetLog()); - if (rv == ERR_IO_PENDING) - rv = callback.WaitForResult(); - DCHECK_EQ(OK, rv); + host_resolver->Resolve(info, &addresses, NULL, NULL, BoundNetLog()); // Add the first address as an alias. It would have been better to call // MockClientSocket::GetPeerAddress but that returns 192.0.2.33 whereas @@ -8813,11 +8808,7 @@ TEST_F(HttpNetworkTransactionTest, UseIPConnectionPooling) { HostPortPair host_port("www.gmail.com", 443); HostResolver::RequestInfo resolve_info(host_port); AddressList ignored; - rv = host_resolver.Resolve(resolve_info, &ignored, &callback, NULL, - BoundNetLog()); - EXPECT_EQ(ERR_IO_PENDING, rv); - rv = callback.WaitForResult(); - EXPECT_EQ(OK, rv); + host_resolver.Resolve(resolve_info, &ignored, NULL, NULL, BoundNetLog()); // MockHostResolver returns 127.0.0.1, port 443 for https://www.google.com/ // and https://www.gmail.com/. Add 127.0.0.1 as alias for host_port_pair: @@ -8969,11 +8960,7 @@ TEST_F(HttpNetworkTransactionTest, // Preload cache entries into HostCache. HostResolver::RequestInfo resolve_info(HostPortPair("www.gmail.com", 443)); AddressList ignored; - rv = host_resolver.Resolve(resolve_info, &ignored, &callback, NULL, - BoundNetLog()); - EXPECT_EQ(ERR_IO_PENDING, rv); - rv = callback.WaitForResult(); - EXPECT_EQ(OK, rv); + host_resolver.Resolve(resolve_info, &ignored, NULL, NULL, BoundNetLog()); HttpRequestInfo request2; request2.method = "GET"; -- cgit v1.1