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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, | 153 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, |
154 bool want_spdy_over_npn) { | 154 bool want_spdy_over_npn) { |
155 return make_scoped_refptr(new SSLSocketParams( | 155 return make_scoped_refptr(new SSLSocketParams( |
156 proxy == ProxyServer::SCHEME_DIRECT ? direct_transport_socket_params_ | 156 proxy == ProxyServer::SCHEME_DIRECT ? direct_transport_socket_params_ |
157 : NULL, | 157 : NULL, |
158 proxy == ProxyServer::SCHEME_SOCKS5 ? socks_socket_params_ : NULL, | 158 proxy == ProxyServer::SCHEME_SOCKS5 ? socks_socket_params_ : NULL, |
159 proxy == ProxyServer::SCHEME_HTTP ? http_proxy_socket_params_ : NULL, | 159 proxy == ProxyServer::SCHEME_HTTP ? http_proxy_socket_params_ : NULL, |
160 HostPortPair("host", 443), | 160 HostPortPair("host", 443), |
161 ssl_config_, | 161 ssl_config_, |
162 kPrivacyModeDisabled, | 162 PRIVACY_MODE_DISABLED, |
163 0, | 163 0, |
164 false, | 164 false, |
165 want_spdy_over_npn)); | 165 want_spdy_over_npn)); |
166 } | 166 } |
167 | 167 |
168 void AddAuthToCache() { | 168 void AddAuthToCache() { |
169 const base::string16 kFoo(base::ASCIIToUTF16("foo")); | 169 const base::string16 kFoo(base::ASCIIToUTF16("foo")); |
170 const base::string16 kBar(base::ASCIIToUTF16("bar")); | 170 const base::string16 kBar(base::ASCIIToUTF16("bar")); |
171 session_->http_auth_cache()->Add(GURL("http://proxy:443/"), | 171 session_->http_auth_cache()->Add(GURL("http://proxy:443/"), |
172 "MyRealm1", | 172 "MyRealm1", |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 host_resolver_.Resolve(info, | 823 host_resolver_.Resolve(info, |
824 DEFAULT_PRIORITY, | 824 DEFAULT_PRIORITY, |
825 &test_hosts[i].addresses, | 825 &test_hosts[i].addresses, |
826 CompletionCallback(), | 826 CompletionCallback(), |
827 NULL, | 827 NULL, |
828 BoundNetLog()); | 828 BoundNetLog()); |
829 | 829 |
830 // Setup a SpdySessionKey | 830 // Setup a SpdySessionKey |
831 test_hosts[i].key = SpdySessionKey( | 831 test_hosts[i].key = SpdySessionKey( |
832 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), | 832 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), |
833 kPrivacyModeDisabled); | 833 PRIVACY_MODE_DISABLED); |
834 } | 834 } |
835 | 835 |
836 MockRead reads[] = { | 836 MockRead reads[] = { |
837 MockRead(ASYNC, ERR_IO_PENDING), | 837 MockRead(ASYNC, ERR_IO_PENDING), |
838 }; | 838 }; |
839 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 839 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
840 socket_factory_.AddSocketDataProvider(&data); | 840 socket_factory_.AddSocketDataProvider(&data); |
841 SSLSocketDataProvider ssl(ASYNC, OK); | 841 SSLSocketDataProvider ssl(ASYNC, OK); |
842 ssl.cert = X509Certificate::CreateFromBytes( | 842 ssl.cert = X509Certificate::CreateFromBytes( |
843 reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); | 843 reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 DEFAULT_PRIORITY, | 884 DEFAULT_PRIORITY, |
885 &test_hosts[i].addresses, | 885 &test_hosts[i].addresses, |
886 callback.callback(), | 886 callback.callback(), |
887 NULL, | 887 NULL, |
888 BoundNetLog()); | 888 BoundNetLog()); |
889 EXPECT_EQ(OK, callback.GetResult(rv)); | 889 EXPECT_EQ(OK, callback.GetResult(rv)); |
890 | 890 |
891 // Setup a SpdySessionKey | 891 // Setup a SpdySessionKey |
892 test_hosts[i].key = SpdySessionKey( | 892 test_hosts[i].key = SpdySessionKey( |
893 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), | 893 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), |
894 kPrivacyModeDisabled); | 894 PRIVACY_MODE_DISABLED); |
895 } | 895 } |
896 | 896 |
897 MockRead reads[] = { | 897 MockRead reads[] = { |
898 MockRead(ASYNC, ERR_IO_PENDING), | 898 MockRead(ASYNC, ERR_IO_PENDING), |
899 }; | 899 }; |
900 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 900 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
901 socket_factory_.AddSocketDataProvider(&data); | 901 socket_factory_.AddSocketDataProvider(&data); |
902 socket_factory_.AddSSLSocketDataProvider(ssl); | 902 socket_factory_.AddSSLSocketDataProvider(ssl); |
903 | 903 |
904 CreatePool(true /* tcp pool */, false, false); | 904 CreatePool(true /* tcp pool */, false, false); |
(...skipping 25 matching lines...) Expand all Loading... |
930 ssl.channel_id_sent = true; | 930 ssl.channel_id_sent = true; |
931 ssl.SetNextProto(GetParam()); | 931 ssl.SetNextProto(GetParam()); |
932 TestIPPoolingDisabled(&ssl); | 932 TestIPPoolingDisabled(&ssl); |
933 } | 933 } |
934 | 934 |
935 // It would be nice to also test the timeouts in SSLClientSocketPool. | 935 // It would be nice to also test the timeouts in SSLClientSocketPool. |
936 | 936 |
937 } // namespace | 937 } // namespace |
938 | 938 |
939 } // namespace net | 939 } // namespace net |
OLD | NEW |