| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ignored_tcp_socket_params_(new TCPSocketParams( | 43 ignored_tcp_socket_params_(new TCPSocketParams( |
| 44 HostPortPair("proxy", 80), MEDIUM, GURL(), false)), | 44 HostPortPair("proxy", 80), MEDIUM, GURL(), false)), |
| 45 ignored_ssl_socket_params_(new SSLSocketParams( | 45 ignored_ssl_socket_params_(new SSLSocketParams( |
| 46 ignored_tcp_socket_params_, NULL, NULL, ProxyServer::SCHEME_DIRECT, | 46 ignored_tcp_socket_params_, NULL, NULL, ProxyServer::SCHEME_DIRECT, |
| 47 "host", ssl_config_, 0, false, false)), | 47 "host", ssl_config_, 0, false, false)), |
| 48 tcp_histograms_(new ClientSocketPoolHistograms("MockTCP")), | 48 tcp_histograms_(new ClientSocketPoolHistograms("MockTCP")), |
| 49 tcp_socket_pool_(new MockTCPClientSocketPool(kMaxSockets, | 49 tcp_socket_pool_(new MockTCPClientSocketPool(kMaxSockets, |
| 50 kMaxSocketsPerGroup, tcp_histograms_, &tcp_client_socket_factory_)), | 50 kMaxSocketsPerGroup, tcp_histograms_, &tcp_client_socket_factory_)), |
| 51 ssl_socket_pool_(new MockSSLClientSocketPool(kMaxSockets, | 51 ssl_socket_pool_(new MockSSLClientSocketPool(kMaxSockets, |
| 52 kMaxSocketsPerGroup, tcp_histograms_, &tcp_client_socket_factory_)), | 52 kMaxSocketsPerGroup, tcp_histograms_, &tcp_client_socket_factory_)), |
| 53 http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault()), | 53 host_resolver_(new MockHostResolver), |
| 54 session_(new HttpNetworkSession(new MockHostResolver, | 54 http_auth_handler_factory_( |
| 55 HttpAuthHandlerFactory::CreateDefault(host_resolver_)), |
| 56 session_(new HttpNetworkSession(host_resolver_, |
| 55 ProxyService::CreateDirect(), | 57 ProxyService::CreateDirect(), |
| 56 &socket_factory_, | 58 &socket_factory_, |
| 57 new SSLConfigServiceDefaults, | 59 new SSLConfigServiceDefaults, |
| 58 new SpdySessionPool(NULL), | 60 new SpdySessionPool(NULL), |
| 59 http_auth_handler_factory_.get(), | 61 http_auth_handler_factory_.get(), |
| 60 NULL, | 62 NULL, |
| 61 NULL)), | 63 NULL)), |
| 62 http_proxy_histograms_( | 64 http_proxy_histograms_( |
| 63 new ClientSocketPoolHistograms("HttpProxyUnitTest")), | 65 new ClientSocketPoolHistograms("HttpProxyUnitTest")), |
| 64 pool_(new HttpProxyClientSocketPool(kMaxSockets, kMaxSocketsPerGroup, | 66 pool_(new HttpProxyClientSocketPool(kMaxSockets, kMaxSocketsPerGroup, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 SSLConfig ssl_config_; | 113 SSLConfig ssl_config_; |
| 112 | 114 |
| 113 scoped_refptr<TCPSocketParams> ignored_tcp_socket_params_; | 115 scoped_refptr<TCPSocketParams> ignored_tcp_socket_params_; |
| 114 scoped_refptr<SSLSocketParams> ignored_ssl_socket_params_; | 116 scoped_refptr<SSLSocketParams> ignored_ssl_socket_params_; |
| 115 scoped_refptr<ClientSocketPoolHistograms> tcp_histograms_; | 117 scoped_refptr<ClientSocketPoolHistograms> tcp_histograms_; |
| 116 MockClientSocketFactory tcp_client_socket_factory_; | 118 MockClientSocketFactory tcp_client_socket_factory_; |
| 117 scoped_refptr<MockTCPClientSocketPool> tcp_socket_pool_; | 119 scoped_refptr<MockTCPClientSocketPool> tcp_socket_pool_; |
| 118 scoped_refptr<MockSSLClientSocketPool> ssl_socket_pool_; | 120 scoped_refptr<MockSSLClientSocketPool> ssl_socket_pool_; |
| 119 | 121 |
| 120 MockClientSocketFactory socket_factory_; | 122 MockClientSocketFactory socket_factory_; |
| 123 scoped_refptr<HostResolver> host_resolver_; |
| 121 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 124 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
| 122 scoped_refptr<HttpNetworkSession> session_; | 125 scoped_refptr<HttpNetworkSession> session_; |
| 123 scoped_refptr<ClientSocketPoolHistograms> http_proxy_histograms_; | 126 scoped_refptr<ClientSocketPoolHistograms> http_proxy_histograms_; |
| 124 scoped_refptr<HttpProxyClientSocketPool> pool_; | 127 scoped_refptr<HttpProxyClientSocketPool> pool_; |
| 125 }; | 128 }; |
| 126 | 129 |
| 127 //----------------------------------------------------------------------------- | 130 //----------------------------------------------------------------------------- |
| 128 // All tests are run with three different connection types: SPDY after NPN | 131 // All tests are run with three different connection types: SPDY after NPN |
| 129 // negotiation, SPDY without SSL, and SPDY with SSL. | 132 // negotiation, SPDY without SSL, and SPDY with SSL. |
| 130 INSTANTIATE_TEST_CASE_P(HttpProxyClientSocketPoolTests, | 133 INSTANTIATE_TEST_CASE_P(HttpProxyClientSocketPoolTests, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, callback.WaitForResult()); | 326 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, callback.WaitForResult()); |
| 324 EXPECT_FALSE(handle.is_initialized()); | 327 EXPECT_FALSE(handle.is_initialized()); |
| 325 EXPECT_FALSE(handle.socket()); | 328 EXPECT_FALSE(handle.socket()); |
| 326 } | 329 } |
| 327 | 330 |
| 328 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. | 331 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. |
| 329 | 332 |
| 330 } // namespace | 333 } // namespace |
| 331 | 334 |
| 332 } // namespace net | 335 } // namespace net |
| OLD | NEW |