OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void TestIPPoolingDisabled(SSLSocketDataProvider* ssl); | 178 void TestIPPoolingDisabled(SSLSocketDataProvider* ssl); |
179 | 179 |
180 MockClientSocketFactory socket_factory_; | 180 MockClientSocketFactory socket_factory_; |
181 MockCachingHostResolver host_resolver_; | 181 MockCachingHostResolver host_resolver_; |
182 scoped_ptr<CertVerifier> cert_verifier_; | 182 scoped_ptr<CertVerifier> cert_verifier_; |
183 scoped_ptr<TransportSecurityState> transport_security_state_; | 183 scoped_ptr<TransportSecurityState> transport_security_state_; |
184 const scoped_ptr<ProxyService> proxy_service_; | 184 const scoped_ptr<ProxyService> proxy_service_; |
185 const scoped_refptr<SSLConfigService> ssl_config_service_; | 185 const scoped_refptr<SSLConfigService> ssl_config_service_; |
186 const scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 186 const scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
187 HttpServerPropertiesImpl http_server_properties_; | 187 HttpServerPropertiesImpl http_server_properties_; |
188 const scoped_refptr<HttpNetworkSession> session_; | 188 const scoped_ptr<HttpNetworkSession> session_; |
189 | 189 |
190 scoped_refptr<TransportSocketParams> direct_transport_socket_params_; | 190 scoped_refptr<TransportSocketParams> direct_transport_socket_params_; |
191 MockTransportClientSocketPool transport_socket_pool_; | 191 MockTransportClientSocketPool transport_socket_pool_; |
192 | 192 |
193 scoped_refptr<TransportSocketParams> proxy_transport_socket_params_; | 193 scoped_refptr<TransportSocketParams> proxy_transport_socket_params_; |
194 | 194 |
195 scoped_refptr<SOCKSSocketParams> socks_socket_params_; | 195 scoped_refptr<SOCKSSocketParams> socks_socket_params_; |
196 MockSOCKSClientSocketPool socks_socket_pool_; | 196 MockSOCKSClientSocketPool socks_socket_pool_; |
197 | 197 |
198 scoped_refptr<HttpProxySocketParams> http_proxy_socket_params_; | 198 scoped_refptr<HttpProxySocketParams> http_proxy_socket_params_; |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 821 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
822 socket_factory_.AddSocketDataProvider(&data); | 822 socket_factory_.AddSocketDataProvider(&data); |
823 SSLSocketDataProvider ssl(ASYNC, OK); | 823 SSLSocketDataProvider ssl(ASYNC, OK); |
824 ssl.cert = X509Certificate::CreateFromBytes( | 824 ssl.cert = X509Certificate::CreateFromBytes( |
825 reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); | 825 reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); |
826 ssl.SetNextProto(GetParam()); | 826 ssl.SetNextProto(GetParam()); |
827 socket_factory_.AddSSLSocketDataProvider(&ssl); | 827 socket_factory_.AddSSLSocketDataProvider(&ssl); |
828 | 828 |
829 CreatePool(true /* tcp pool */, false, false); | 829 CreatePool(true /* tcp pool */, false, false); |
830 base::WeakPtr<SpdySession> spdy_session = | 830 base::WeakPtr<SpdySession> spdy_session = |
831 CreateSecureSpdySession(session_, test_hosts[0].key, BoundNetLog()); | 831 CreateSecureSpdySession(session_.get(), test_hosts[0].key, BoundNetLog()); |
832 | 832 |
833 EXPECT_TRUE( | 833 EXPECT_TRUE( |
834 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); | 834 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); |
835 EXPECT_FALSE( | 835 EXPECT_FALSE( |
836 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); | 836 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); |
837 EXPECT_TRUE( | 837 EXPECT_TRUE( |
838 HasSpdySession(session_->spdy_session_pool(), test_hosts[2].key)); | 838 HasSpdySession(session_->spdy_session_pool(), test_hosts[2].key)); |
839 | 839 |
840 session_->spdy_session_pool()->CloseAllSessions(); | 840 session_->spdy_session_pool()->CloseAllSessions(); |
841 } | 841 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 878 |
879 MockRead reads[] = { | 879 MockRead reads[] = { |
880 MockRead(ASYNC, ERR_IO_PENDING), | 880 MockRead(ASYNC, ERR_IO_PENDING), |
881 }; | 881 }; |
882 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 882 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
883 socket_factory_.AddSocketDataProvider(&data); | 883 socket_factory_.AddSocketDataProvider(&data); |
884 socket_factory_.AddSSLSocketDataProvider(ssl); | 884 socket_factory_.AddSSLSocketDataProvider(ssl); |
885 | 885 |
886 CreatePool(true /* tcp pool */, false, false); | 886 CreatePool(true /* tcp pool */, false, false); |
887 base::WeakPtr<SpdySession> spdy_session = | 887 base::WeakPtr<SpdySession> spdy_session = |
888 CreateSecureSpdySession(session_, test_hosts[0].key, BoundNetLog()); | 888 CreateSecureSpdySession(session_.get(), test_hosts[0].key, BoundNetLog()); |
889 | 889 |
890 EXPECT_TRUE( | 890 EXPECT_TRUE( |
891 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); | 891 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); |
892 EXPECT_FALSE( | 892 EXPECT_FALSE( |
893 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); | 893 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); |
894 | 894 |
895 session_->spdy_session_pool()->CloseAllSessions(); | 895 session_->spdy_session_pool()->CloseAllSessions(); |
896 } | 896 } |
897 | 897 |
898 // Verifies that an SSL connection with client authentication disables SPDY IP | 898 // Verifies that an SSL connection with client authentication disables SPDY IP |
(...skipping 13 matching lines...) Expand all Loading... |
912 ssl.channel_id_sent = true; | 912 ssl.channel_id_sent = true; |
913 ssl.SetNextProto(GetParam()); | 913 ssl.SetNextProto(GetParam()); |
914 TestIPPoolingDisabled(&ssl); | 914 TestIPPoolingDisabled(&ssl); |
915 } | 915 } |
916 | 916 |
917 // It would be nice to also test the timeouts in SSLClientSocketPool. | 917 // It would be nice to also test the timeouts in SSLClientSocketPool. |
918 | 918 |
919 } // namespace | 919 } // namespace |
920 | 920 |
921 } // namespace net | 921 } // namespace net |
OLD | NEW |