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 "base/values.h"
8 #include "net/http/http_proxy_client_socket_pool.h"
9 #include "net/socket/socks_client_socket_pool.h"
10 #include "net/socket/ssl_client_socket_pool.h"
11 #include "net/socket/transport_client_socket_pool.h"
15 MockClientSocketPoolManager::MockClientSocketPoolManager() {}
16 MockClientSocketPoolManager::~MockClientSocketPoolManager() {}
18 void MockClientSocketPoolManager::SetTransportSocketPool(
19 TransportClientSocketPool
* pool
) {
20 transport_socket_pool_
.reset(pool
);
23 void MockClientSocketPoolManager::SetSSLSocketPool(
24 SSLClientSocketPool
* pool
) {
25 ssl_socket_pool_
.reset(pool
);
28 void MockClientSocketPoolManager::SetSocketPoolForSOCKSProxy(
29 const HostPortPair
& socks_proxy
,
30 SOCKSClientSocketPool
* pool
) {
31 socks_socket_pools_
[socks_proxy
] = pool
;
34 void MockClientSocketPoolManager::SetSocketPoolForHTTPProxy(
35 const HostPortPair
& http_proxy
,
36 HttpProxyClientSocketPool
* pool
) {
37 http_proxy_socket_pools_
[http_proxy
] = pool
;
40 void MockClientSocketPoolManager::SetSocketPoolForSSLWithProxy(
41 const HostPortPair
& proxy_server
,
42 SSLClientSocketPool
* pool
) {
43 ssl_socket_pools_for_proxies_
[proxy_server
] = pool
;
46 void MockClientSocketPoolManager::FlushSocketPoolsWithError(int error
) {
50 void MockClientSocketPoolManager::CloseIdleSockets() {
54 TransportClientSocketPool
*
55 MockClientSocketPoolManager::GetTransportSocketPool() {
56 return transport_socket_pool_
.get();
59 SSLClientSocketPool
* MockClientSocketPoolManager::GetSSLSocketPool() {
60 return ssl_socket_pool_
.get();
63 SOCKSClientSocketPool
* MockClientSocketPoolManager::GetSocketPoolForSOCKSProxy(
64 const HostPortPair
& socks_proxy
) {
65 SOCKSSocketPoolMap::const_iterator it
= socks_socket_pools_
.find(socks_proxy
);
66 if (it
!= socks_socket_pools_
.end())
71 HttpProxyClientSocketPool
*
72 MockClientSocketPoolManager::GetSocketPoolForHTTPProxy(
73 const HostPortPair
& http_proxy
) {
74 HTTPProxySocketPoolMap::const_iterator it
=
75 http_proxy_socket_pools_
.find(http_proxy
);
76 if (it
!= http_proxy_socket_pools_
.end())
81 SSLClientSocketPool
* MockClientSocketPoolManager::GetSocketPoolForSSLWithProxy(
82 const HostPortPair
& proxy_server
) {
83 SSLSocketPoolMap::const_iterator it
=
84 ssl_socket_pools_for_proxies_
.find(proxy_server
);
85 if (it
!= ssl_socket_pools_for_proxies_
.end())
90 scoped_ptr
<base::Value
> MockClientSocketPoolManager::SocketPoolInfoToValue()
93 return scoped_ptr
<base::Value
>(nullptr);