OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "net/socket/mock_client_socket_pool_manager.h" |
| 6 |
| 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" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 MockClientSocketPoolManager::MockClientSocketPoolManager() {} |
| 15 MockClientSocketPoolManager::~MockClientSocketPoolManager() {} |
| 16 |
| 17 void MockClientSocketPoolManager::SetTransportSocketPool( |
| 18 TransportClientSocketPool* pool) { |
| 19 transport_socket_pool_.reset(pool); |
| 20 } |
| 21 |
| 22 void MockClientSocketPoolManager::SetSSLSocketPool( |
| 23 SSLClientSocketPool* pool) { |
| 24 ssl_socket_pool_.reset(pool); |
| 25 } |
| 26 |
| 27 void MockClientSocketPoolManager::SetSocketPoolForSOCKSProxy( |
| 28 const HostPortPair& socks_proxy, |
| 29 SOCKSClientSocketPool* pool) { |
| 30 socks_socket_pools_[socks_proxy] = pool; |
| 31 } |
| 32 |
| 33 void MockClientSocketPoolManager::SetSocketPoolForHTTPProxy( |
| 34 const HostPortPair& http_proxy, |
| 35 HttpProxyClientSocketPool* pool) { |
| 36 http_proxy_socket_pools_[http_proxy] = pool; |
| 37 } |
| 38 |
| 39 void MockClientSocketPoolManager::SetSocketPoolForSSLWithProxy( |
| 40 const HostPortPair& proxy_server, |
| 41 SSLClientSocketPool* pool) { |
| 42 ssl_socket_pools_for_proxies_[proxy_server] = pool; |
| 43 } |
| 44 |
| 45 void MockClientSocketPoolManager::FlushSocketPools() { |
| 46 NOTIMPLEMENTED(); |
| 47 } |
| 48 |
| 49 void MockClientSocketPoolManager::CloseIdleSockets() { |
| 50 NOTIMPLEMENTED(); |
| 51 } |
| 52 |
| 53 TransportClientSocketPool* |
| 54 MockClientSocketPoolManager::GetTransportSocketPool() { |
| 55 return transport_socket_pool_.get(); |
| 56 } |
| 57 |
| 58 SSLClientSocketPool* MockClientSocketPoolManager::GetSSLSocketPool() { |
| 59 return ssl_socket_pool_.get(); |
| 60 } |
| 61 |
| 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()) |
| 66 return it->second; |
| 67 return NULL; |
| 68 } |
| 69 |
| 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()) |
| 76 return it->second; |
| 77 return NULL; |
| 78 } |
| 79 |
| 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()) |
| 85 return it->second; |
| 86 return NULL; |
| 87 } |
| 88 |
| 89 Value* MockClientSocketPoolManager::SocketPoolInfoToValue() const { |
| 90 NOTIMPLEMENTED(); |
| 91 return NULL; |
| 92 } |
| 93 |
| 94 } // namespace net |
OLD | NEW |