1 // Copyright (c) 2012 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 #include "net/socket/mock_client_socket_pool_manager.h"
7 #include "net/http/http_proxy_client_socket_pool.h"
8 #include "net/socket/socks_client_socket_pool.h"
9 #include "net/socket/ssl_client_socket_pool.h"
10 #include "net/socket/transport_client_socket_pool.h"
14 MockClientSocketPoolManager::MockClientSocketPoolManager() {}
15 MockClientSocketPoolManager::~MockClientSocketPoolManager() {}
17 void MockClientSocketPoolManager::SetTransportSocketPool(
18 TransportClientSocketPool
* pool
) {
19 transport_socket_pool_
.reset(pool
);
22 void MockClientSocketPoolManager::SetSSLSocketPool(
23 SSLClientSocketPool
* pool
) {
24 ssl_socket_pool_
.reset(pool
);
27 void MockClientSocketPoolManager::SetSocketPoolForSOCKSProxy(
28 const HostPortPair
& socks_proxy
,
29 SOCKSClientSocketPool
* pool
) {
30 socks_socket_pools_
[socks_proxy
] = pool
;
33 void MockClientSocketPoolManager::SetSocketPoolForHTTPProxy(
34 const HostPortPair
& http_proxy
,
35 HttpProxyClientSocketPool
* pool
) {
36 http_proxy_socket_pools_
[http_proxy
] = pool
;
39 void MockClientSocketPoolManager::SetSocketPoolForSSLWithProxy(
40 const HostPortPair
& proxy_server
,
41 SSLClientSocketPool
* pool
) {
42 ssl_socket_pools_for_proxies_
[proxy_server
] = pool
;
45 void MockClientSocketPoolManager::FlushSocketPools() {
49 void MockClientSocketPoolManager::CloseIdleSockets() {
53 TransportClientSocketPool
*
54 MockClientSocketPoolManager::GetTransportSocketPool() {
55 return transport_socket_pool_
.get();
58 SSLClientSocketPool
* MockClientSocketPoolManager::GetSSLSocketPool() {
59 return ssl_socket_pool_
.get();
62 SOCKSClientSocketPool
* MockClientSocketPoolManager::GetSocketPoolForSOCKSProxy(
63 const HostPortPair
& socks_proxy
) {
64 SOCKSSocketPoolMap::const_iterator it
= socks_socket_pools_
.find(socks_proxy
);
65 if (it
!= socks_socket_pools_
.end())
70 HttpProxyClientSocketPool
*
71 MockClientSocketPoolManager::GetSocketPoolForHTTPProxy(
72 const HostPortPair
& http_proxy
) {
73 HTTPProxySocketPoolMap::const_iterator it
=
74 http_proxy_socket_pools_
.find(http_proxy
);
75 if (it
!= http_proxy_socket_pools_
.end())
80 SSLClientSocketPool
* MockClientSocketPoolManager::GetSocketPoolForSSLWithProxy(
81 const HostPortPair
& proxy_server
) {
82 SSLSocketPoolMap::const_iterator it
=
83 ssl_socket_pools_for_proxies_
.find(proxy_server
);
84 if (it
!= ssl_socket_pools_for_proxies_
.end())
89 base::Value
* MockClientSocketPoolManager::SocketPoolInfoToValue() const {