Index: net/proxy/sync_host_resolver_bridge_unittest.cc |
=================================================================== |
--- net/proxy/sync_host_resolver_bridge_unittest.cc (revision 51891) |
+++ net/proxy/sync_host_resolver_bridge_unittest.cc (working copy) |
@@ -9,14 +9,10 @@ |
#include "net/base/address_list.h" |
#include "net/base/net_errors.h" |
#include "net/base/net_log.h" |
-#include "net/proxy/multi_threaded_proxy_resolver.h" |
#include "net/base/test_completion_callback.h" |
#include "net/proxy/proxy_info.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-// TODO(eroman): This test should be moved into |
-// multi_threaded_proxy_resolver_unittest.cc. |
- |
namespace net { |
namespace { |
@@ -79,7 +75,7 @@ |
// on |host_resolver| in response to GetProxyForURL(). |
class SyncProxyResolver : public ProxyResolver { |
public: |
- explicit SyncProxyResolver(SyncHostResolverBridge* host_resolver) |
+ explicit SyncProxyResolver(HostResolver* host_resolver) |
: ProxyResolver(false), host_resolver_(host_resolver) {} |
virtual int GetProxyForURL(const GURL& url, |
@@ -105,35 +101,17 @@ |
NOTREACHED(); |
} |
- virtual void Shutdown() { |
- host_resolver_->Shutdown(); |
- } |
- |
private: |
virtual int SetPacScript(const GURL& pac_url, |
const string16& pac_script, |
CompletionCallback* callback) { |
+ NOTREACHED(); |
return OK; |
} |
- scoped_refptr<SyncHostResolverBridge> host_resolver_; |
+ scoped_refptr<HostResolver> host_resolver_; |
}; |
-class SyncProxyResolverFactory : public ProxyResolverFactory { |
- public: |
- explicit SyncProxyResolverFactory(SyncHostResolverBridge* sync_host_resolver) |
- : ProxyResolverFactory(false), |
- sync_host_resolver_(sync_host_resolver) { |
- } |
- |
- virtual ProxyResolver* CreateProxyResolver() { |
- return new SyncProxyResolver(sync_host_resolver_); |
- } |
- |
- private: |
- scoped_refptr<SyncHostResolverBridge> sync_host_resolver_; |
-}; |
- |
// This helper thread is used to create the circumstances for the deadlock. |
// It is analagous to the "IO thread" which would be main thread running the |
// network stack. |
@@ -159,15 +137,10 @@ |
new SyncHostResolverBridge(async_resolver_, message_loop()); |
proxy_resolver_.reset( |
- new MultiThreadedProxyResolver( |
- new SyncProxyResolverFactory(sync_resolver), |
- 1u)); |
+ new SingleThreadedProxyResolverUsingBridgedHostResolver( |
+ new SyncProxyResolver(sync_resolver), |
+ sync_resolver)); |
- // Initialize the resolver. |
- TestCompletionCallback callback; |
- proxy_resolver_->SetPacScriptByUrl(GURL(), &callback); |
- EXPECT_EQ(OK, callback.WaitForResult()); |
- |
// Start an asynchronous request to the proxy resolver |
// (note that it will never complete). |
proxy_resolver_->GetProxyForURL(GURL("http://test/"), &results_, |
@@ -205,7 +178,7 @@ |
// Test that a deadlock does not happen during shutdown when a host resolve |
// is outstanding on the SyncHostResolverBridge. |
// This is a regression test for http://crbug.com/41244. |
-TEST(MultiThreadedProxyResolverTest, ShutdownIsCalledBeforeThreadJoin) { |
+TEST(SingleThreadedProxyResolverWithBridgedHostResolverTest, ShutdownDeadlock) { |
IOThread io_thread; |
base::Thread::Options options; |
options.message_loop_type = MessageLoop::TYPE_IO; |