xref: /aosp_15_r20/external/cronet/net/socket/mock_client_socket_pool_manager.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
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 <utility>
8 
9 #include "base/values.h"
10 #include "net/socket/client_socket_pool.h"
11 
12 namespace net {
13 
14 MockClientSocketPoolManager::MockClientSocketPoolManager() = default;
15 MockClientSocketPoolManager::~MockClientSocketPoolManager() = default;
16 
SetSocketPool(const ProxyChain & proxy_chain,std::unique_ptr<ClientSocketPool> pool)17 void MockClientSocketPoolManager::SetSocketPool(
18     const ProxyChain& proxy_chain,
19     std::unique_ptr<ClientSocketPool> pool) {
20   socket_pools_[proxy_chain] = std::move(pool);
21 }
22 
FlushSocketPoolsWithError(int error,const char * net_log_reason_utf8)23 void MockClientSocketPoolManager::FlushSocketPoolsWithError(
24     int error,
25     const char* net_log_reason_utf8) {
26   NOTIMPLEMENTED();
27 }
28 
CloseIdleSockets(const char * net_log_reason_utf8)29 void MockClientSocketPoolManager::CloseIdleSockets(
30     const char* net_log_reason_utf8) {
31   NOTIMPLEMENTED();
32 }
33 
GetSocketPool(const ProxyChain & proxy_chain)34 ClientSocketPool* MockClientSocketPoolManager::GetSocketPool(
35     const ProxyChain& proxy_chain) {
36   ClientSocketPoolMap::const_iterator it = socket_pools_.find(proxy_chain);
37   if (it != socket_pools_.end())
38     return it->second.get();
39   return nullptr;
40 }
41 
SocketPoolInfoToValue() const42 base::Value MockClientSocketPoolManager::SocketPoolInfoToValue() const {
43   NOTIMPLEMENTED();
44   return base::Value();
45 }
46 
47 }  // namespace net
48