1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_SOCKET_MOCK_CLIENT_SOCKET_POOL_MANAGER_H_
6 #define NET_SOCKET_MOCK_CLIENT_SOCKET_POOL_MANAGER_H_
8 #include "base/basictypes.h"
9 #include "net/socket/client_socket_pool_manager.h"
10 #include "net/socket/client_socket_pool_manager_impl.h"
14 class MockClientSocketPoolManager
: public ClientSocketPoolManager
{
16 MockClientSocketPoolManager();
17 ~MockClientSocketPoolManager() override
;
19 // Sets "override" socket pools that get used instead.
20 void SetTransportSocketPool(TransportClientSocketPool
* pool
);
21 void SetSSLSocketPool(SSLClientSocketPool
* pool
);
22 void SetSocketPoolForSOCKSProxy(const HostPortPair
& socks_proxy
,
23 SOCKSClientSocketPool
* pool
);
24 void SetSocketPoolForHTTPProxy(const HostPortPair
& http_proxy
,
25 HttpProxyClientSocketPool
* pool
);
26 void SetSocketPoolForSSLWithProxy(const HostPortPair
& proxy_server
,
27 SSLClientSocketPool
* pool
);
29 // ClientSocketPoolManager methods:
30 void FlushSocketPoolsWithError(int error
) override
;
31 void CloseIdleSockets() override
;
32 TransportClientSocketPool
* GetTransportSocketPool() override
;
33 SSLClientSocketPool
* GetSSLSocketPool() override
;
34 SOCKSClientSocketPool
* GetSocketPoolForSOCKSProxy(
35 const HostPortPair
& socks_proxy
) override
;
36 HttpProxyClientSocketPool
* GetSocketPoolForHTTPProxy(
37 const HostPortPair
& http_proxy
) override
;
38 SSLClientSocketPool
* GetSocketPoolForSSLWithProxy(
39 const HostPortPair
& proxy_server
) override
;
40 base::Value
* SocketPoolInfoToValue() const override
;
43 typedef internal::OwnedPoolMap
<HostPortPair
, TransportClientSocketPool
*>
44 TransportSocketPoolMap
;
45 typedef internal::OwnedPoolMap
<HostPortPair
, SOCKSClientSocketPool
*>
47 typedef internal::OwnedPoolMap
<HostPortPair
, HttpProxyClientSocketPool
*>
48 HTTPProxySocketPoolMap
;
49 typedef internal::OwnedPoolMap
<HostPortPair
, SSLClientSocketPool
*>
52 scoped_ptr
<TransportClientSocketPool
> transport_socket_pool_
;
53 scoped_ptr
<SSLClientSocketPool
> ssl_socket_pool_
;
54 SOCKSSocketPoolMap socks_socket_pools_
;
55 HTTPProxySocketPoolMap http_proxy_socket_pools_
;
56 SSLSocketPoolMap ssl_socket_pools_for_proxies_
;
58 DISALLOW_COPY_AND_ASSIGN(MockClientSocketPoolManager
);
63 #endif // NET_SOCKET_MOCK_CLIENT_SOCKET_POOL_MANAGER_H_