| 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/time.h" | 10 #include "base/time.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 const int kMaxSockets = 32; | 32 const int kMaxSockets = 32; |
| 33 const int kMaxSocketsPerGroup = 6; | 33 const int kMaxSocketsPerGroup = 6; |
| 34 | 34 |
| 35 class SSLClientSocketPoolTest : public testing::Test { | 35 class SSLClientSocketPoolTest : public testing::Test { |
| 36 protected: | 36 protected: |
| 37 SSLClientSocketPoolTest() | 37 SSLClientSocketPoolTest() |
| 38 : host_resolver_(new MockHostResolver), | 38 : host_resolver_(new MockHostResolver), |
| 39 http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault( | 39 http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault( |
| 40 host_resolver_.get())), | 40 host_resolver_.get())), |
| 41 session_(new HttpNetworkSession(host_resolver_.get(), | 41 session_(new HttpNetworkSession(host_resolver_.get(), |
| 42 NULL /* dnsrr_resolver */, |
| 42 ProxyService::CreateDirect(), | 43 ProxyService::CreateDirect(), |
| 43 &socket_factory_, | 44 &socket_factory_, |
| 44 new SSLConfigServiceDefaults, | 45 new SSLConfigServiceDefaults, |
| 45 new SpdySessionPool(NULL), | 46 new SpdySessionPool(NULL), |
| 46 http_auth_handler_factory_.get(), | 47 http_auth_handler_factory_.get(), |
| 47 NULL, | 48 NULL, |
| 48 NULL)), | 49 NULL)), |
| 49 direct_tcp_socket_params_(new TCPSocketParams( | 50 direct_tcp_socket_params_(new TCPSocketParams( |
| 50 HostPortPair("host", 443), MEDIUM, GURL(), false)), | 51 HostPortPair("host", 443), MEDIUM, GURL(), false)), |
| 51 tcp_histograms_("MockTCP"), | 52 tcp_histograms_("MockTCP"), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ssl_config_service->GetSSLConfig(&ssl_config_); | 86 ssl_config_service->GetSSLConfig(&ssl_config_); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void CreatePool(bool tcp_pool, bool http_proxy_pool, bool socks_pool) { | 89 void CreatePool(bool tcp_pool, bool http_proxy_pool, bool socks_pool) { |
| 89 ssl_histograms_.reset(new ClientSocketPoolHistograms("SSLUnitTest")); | 90 ssl_histograms_.reset(new ClientSocketPoolHistograms("SSLUnitTest")); |
| 90 pool_.reset(new SSLClientSocketPool( | 91 pool_.reset(new SSLClientSocketPool( |
| 91 kMaxSockets, | 92 kMaxSockets, |
| 92 kMaxSocketsPerGroup, | 93 kMaxSocketsPerGroup, |
| 93 ssl_histograms_.get(), | 94 ssl_histograms_.get(), |
| 94 NULL, | 95 NULL, |
| 96 NULL /* dnsrr_resolver */, |
| 95 &socket_factory_, | 97 &socket_factory_, |
| 96 tcp_pool ? &tcp_socket_pool_ : NULL, | 98 tcp_pool ? &tcp_socket_pool_ : NULL, |
| 97 socks_pool ? &socks_socket_pool_ : NULL, | 99 socks_pool ? &socks_socket_pool_ : NULL, |
| 98 http_proxy_pool ? &http_proxy_socket_pool_ : NULL, | 100 http_proxy_pool ? &http_proxy_socket_pool_ : NULL, |
| 99 NULL, | 101 NULL, |
| 100 NULL)); | 102 NULL)); |
| 101 } | 103 } |
| 102 | 104 |
| 103 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, | 105 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, |
| 104 bool want_spdy_over_npn) { | 106 bool want_spdy_over_npn) { |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 handle.release_pending_http_proxy_connection()); | 627 handle.release_pending_http_proxy_connection()); |
| 626 EXPECT_TRUE(tunnel_handle->socket()); | 628 EXPECT_TRUE(tunnel_handle->socket()); |
| 627 EXPECT_FALSE(tunnel_handle->socket()->IsConnected()); | 629 EXPECT_FALSE(tunnel_handle->socket()->IsConnected()); |
| 628 } | 630 } |
| 629 | 631 |
| 630 // It would be nice to also test the timeouts in SSLClientSocketPool. | 632 // It would be nice to also test the timeouts in SSLClientSocketPool. |
| 631 | 633 |
| 632 } // namespace | 634 } // namespace |
| 633 | 635 |
| 634 } // namespace net | 636 } // namespace net |
| OLD | NEW |