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 17 matching lines...) Loading... |
28 namespace net { | 28 namespace net { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
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 ClientSocketPoolTest { | 35 class SSLClientSocketPoolTest : public ClientSocketPoolTest { |
36 protected: | 36 protected: |
37 SSLClientSocketPoolTest() | 37 SSLClientSocketPoolTest() |
38 : http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault()), | 38 : host_resolver_(new MockHostResolver), |
39 session_(new HttpNetworkSession(new MockHostResolver, | 39 http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault( |
| 40 host_resolver_)), |
| 41 session_(new HttpNetworkSession(host_resolver_, |
40 ProxyService::CreateDirect(), | 42 ProxyService::CreateDirect(), |
41 &socket_factory_, | 43 &socket_factory_, |
42 new SSLConfigServiceDefaults, | 44 new SSLConfigServiceDefaults, |
43 new SpdySessionPool(NULL), | 45 new SpdySessionPool(NULL), |
44 http_auth_handler_factory_.get(), | 46 http_auth_handler_factory_.get(), |
45 NULL, | 47 NULL, |
46 NULL)), | 48 NULL)), |
47 direct_tcp_socket_params_(new TCPSocketParams( | 49 direct_tcp_socket_params_(new TCPSocketParams( |
48 HostPortPair("host", 443), MEDIUM, GURL(), false)), | 50 HostPortPair("host", 443), MEDIUM, GURL(), false)), |
49 tcp_socket_pool_(new MockTCPClientSocketPool( | 51 tcp_socket_pool_(new MockTCPClientSocketPool( |
(...skipping 59 matching lines...) Loading... |
109 } | 111 } |
110 | 112 |
111 void AddAuthToCache() { | 113 void AddAuthToCache() { |
112 const string16 kFoo(ASCIIToUTF16("foo")); | 114 const string16 kFoo(ASCIIToUTF16("foo")); |
113 const string16 kBar(ASCIIToUTF16("bar")); | 115 const string16 kBar(ASCIIToUTF16("bar")); |
114 session_->auth_cache()->Add(GURL("http://proxy:443/"), "MyRealm1", "Basic", | 116 session_->auth_cache()->Add(GURL("http://proxy:443/"), "MyRealm1", "Basic", |
115 "Basic realm=MyRealm1", kFoo, kBar, "/"); | 117 "Basic realm=MyRealm1", kFoo, kBar, "/"); |
116 } | 118 } |
117 | 119 |
118 MockClientSocketFactory socket_factory_; | 120 MockClientSocketFactory socket_factory_; |
| 121 scoped_refptr<HostResolver> host_resolver_; |
119 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 122 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
120 scoped_refptr<HttpNetworkSession> session_; | 123 scoped_refptr<HttpNetworkSession> session_; |
121 | 124 |
122 scoped_refptr<TCPSocketParams> direct_tcp_socket_params_; | 125 scoped_refptr<TCPSocketParams> direct_tcp_socket_params_; |
123 scoped_refptr<MockTCPClientSocketPool> tcp_socket_pool_; | 126 scoped_refptr<MockTCPClientSocketPool> tcp_socket_pool_; |
124 | 127 |
125 scoped_refptr<TCPSocketParams> proxy_tcp_socket_params_; | 128 scoped_refptr<TCPSocketParams> proxy_tcp_socket_params_; |
126 scoped_refptr<HttpProxySocketParams> http_proxy_socket_params_; | 129 scoped_refptr<HttpProxySocketParams> http_proxy_socket_params_; |
127 scoped_refptr<HttpProxyClientSocketPool> http_proxy_socket_pool_; | 130 scoped_refptr<HttpProxyClientSocketPool> http_proxy_socket_pool_; |
128 | 131 |
(...skipping 466 matching lines...) Loading... |
595 handle.release_pending_http_proxy_connection()); | 598 handle.release_pending_http_proxy_connection()); |
596 EXPECT_TRUE(tunnel_handle->socket()); | 599 EXPECT_TRUE(tunnel_handle->socket()); |
597 EXPECT_FALSE(tunnel_handle->socket()->IsConnected()); | 600 EXPECT_FALSE(tunnel_handle->socket()->IsConnected()); |
598 } | 601 } |
599 | 602 |
600 // It would be nice to also test the timeouts in SSLClientSocketPool. | 603 // It would be nice to also test the timeouts in SSLClientSocketPool. |
601 | 604 |
602 } // namespace | 605 } // namespace |
603 | 606 |
604 } // namespace net | 607 } // namespace net |
OLD | NEW |