Adding Baseframework of the ResourceManager (all hooks and observers)
[chromium-blink-merge.git] / net / socket / mock_client_socket_pool_manager.h
blobc2c3792a4f612eea300d81c53ff6451235ba3213
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"
12 namespace net {
14 class MockClientSocketPoolManager : public ClientSocketPoolManager {
15 public:
16 MockClientSocketPoolManager();
17 virtual ~MockClientSocketPoolManager();
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 virtual void FlushSocketPoolsWithError(int error) OVERRIDE;
31 virtual void CloseIdleSockets() OVERRIDE;
32 virtual TransportClientSocketPool* GetTransportSocketPool() OVERRIDE;
33 virtual SSLClientSocketPool* GetSSLSocketPool() OVERRIDE;
34 virtual SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy(
35 const HostPortPair& socks_proxy) OVERRIDE;
36 virtual HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy(
37 const HostPortPair& http_proxy) OVERRIDE;
38 virtual SSLClientSocketPool* GetSocketPoolForSSLWithProxy(
39 const HostPortPair& proxy_server) OVERRIDE;
40 virtual base::Value* SocketPoolInfoToValue() const OVERRIDE;
42 private:
43 typedef internal::OwnedPoolMap<HostPortPair, TransportClientSocketPool*>
44 TransportSocketPoolMap;
45 typedef internal::OwnedPoolMap<HostPortPair, SOCKSClientSocketPool*>
46 SOCKSSocketPoolMap;
47 typedef internal::OwnedPoolMap<HostPortPair, HttpProxyClientSocketPool*>
48 HTTPProxySocketPoolMap;
49 typedef internal::OwnedPoolMap<HostPortPair, SSLClientSocketPool*>
50 SSLSocketPoolMap;
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);
61 } // namespace net
63 #endif // NET_SOCKET_MOCK_CLIENT_SOCKET_POOL_MANAGER_H_