| 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 22 matching lines...) Expand all Loading... |
| 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 NULL /* dnsrr_resolver */, |
| 43 NULL /* ssl_host_info_factory */, | |
| 44 ProxyService::CreateDirect(), | 43 ProxyService::CreateDirect(), |
| 45 &socket_factory_, | 44 &socket_factory_, |
| 46 new SSLConfigServiceDefaults, | 45 new SSLConfigServiceDefaults, |
| 47 new SpdySessionPool(NULL), | 46 new SpdySessionPool(NULL), |
| 48 http_auth_handler_factory_.get(), | 47 http_auth_handler_factory_.get(), |
| 49 NULL, | 48 NULL, |
| 50 NULL)), | 49 NULL)), |
| 51 direct_tcp_socket_params_(new TCPSocketParams( | 50 direct_tcp_socket_params_(new TCPSocketParams( |
| 52 HostPortPair("host", 443), MEDIUM, GURL(), false)), | 51 HostPortPair("host", 443), MEDIUM, GURL(), false)), |
| 53 tcp_histograms_("MockTCP"), | 52 tcp_histograms_("MockTCP"), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 89 } |
| 91 | 90 |
| 92 void CreatePool(bool tcp_pool, bool http_proxy_pool, bool socks_pool) { | 91 void CreatePool(bool tcp_pool, bool http_proxy_pool, bool socks_pool) { |
| 93 ssl_histograms_.reset(new ClientSocketPoolHistograms("SSLUnitTest")); | 92 ssl_histograms_.reset(new ClientSocketPoolHistograms("SSLUnitTest")); |
| 94 pool_.reset(new SSLClientSocketPool( | 93 pool_.reset(new SSLClientSocketPool( |
| 95 kMaxSockets, | 94 kMaxSockets, |
| 96 kMaxSocketsPerGroup, | 95 kMaxSocketsPerGroup, |
| 97 ssl_histograms_.get(), | 96 ssl_histograms_.get(), |
| 98 NULL, | 97 NULL, |
| 99 NULL /* dnsrr_resolver */, | 98 NULL /* dnsrr_resolver */, |
| 100 NULL /* ssl_host_info_factory */, | |
| 101 &socket_factory_, | 99 &socket_factory_, |
| 102 tcp_pool ? &tcp_socket_pool_ : NULL, | 100 tcp_pool ? &tcp_socket_pool_ : NULL, |
| 103 socks_pool ? &socks_socket_pool_ : NULL, | 101 socks_pool ? &socks_socket_pool_ : NULL, |
| 104 http_proxy_pool ? &http_proxy_socket_pool_ : NULL, | 102 http_proxy_pool ? &http_proxy_socket_pool_ : NULL, |
| 105 NULL, | 103 NULL, |
| 106 NULL)); | 104 NULL)); |
| 107 } | 105 } |
| 108 | 106 |
| 109 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, | 107 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, |
| 110 bool want_spdy_over_npn) { | 108 bool want_spdy_over_npn) { |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 handle.release_pending_http_proxy_connection()); | 629 handle.release_pending_http_proxy_connection()); |
| 632 EXPECT_TRUE(tunnel_handle->socket()); | 630 EXPECT_TRUE(tunnel_handle->socket()); |
| 633 EXPECT_FALSE(tunnel_handle->socket()->IsConnected()); | 631 EXPECT_FALSE(tunnel_handle->socket()->IsConnected()); |
| 634 } | 632 } |
| 635 | 633 |
| 636 // It would be nice to also test the timeouts in SSLClientSocketPool. | 634 // It would be nice to also test the timeouts in SSLClientSocketPool. |
| 637 | 635 |
| 638 } // namespace | 636 } // namespace |
| 639 | 637 |
| 640 } // namespace net | 638 } // namespace net |
| OLD | NEW |