Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / socket / mock_client_socket_pool_manager.cc
blobbdf18f62d5f82c9f7b86359af8951f30b6b0346b
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"
13 namespace net {
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) {
47 NOTIMPLEMENTED();
50 void MockClientSocketPoolManager::CloseIdleSockets() {
51 NOTIMPLEMENTED();
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())
67 return it->second;
68 return NULL;
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())
77 return it->second;
78 return NULL;
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())
86 return it->second;
87 return NULL;
90 scoped_ptr<base::Value> MockClientSocketPoolManager::SocketPoolInfoToValue()
91 const {
92 NOTIMPLEMENTED();
93 return scoped_ptr<base::Value>(nullptr);
96 } // namespace net