Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: net/socket/ssl_client_socket_pool_unittest.cc

Issue 14471023: Refactor pooled socket request code to prepare for implementation of pretend-to-preconnect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't overload SSLSocketParams c-tor Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 &socket_factory_, 146 &socket_factory_,
147 transport_pool ? &transport_socket_pool_ : NULL, 147 transport_pool ? &transport_socket_pool_ : NULL,
148 socks_pool ? &socks_socket_pool_ : NULL, 148 socks_pool ? &socks_socket_pool_ : NULL,
149 http_proxy_pool ? &http_proxy_socket_pool_ : NULL, 149 http_proxy_pool ? &http_proxy_socket_pool_ : NULL,
150 NULL, 150 NULL,
151 NULL)); 151 NULL));
152 } 152 }
153 153
154 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy, 154 scoped_refptr<SSLSocketParams> SSLParams(ProxyServer::Scheme proxy,
155 bool want_spdy_over_npn) { 155 bool want_spdy_over_npn) {
156 return make_scoped_refptr(new SSLSocketParams( 156 HostPortPair host_port("host", 443);
157 proxy == ProxyServer::SCHEME_DIRECT ? 157
158 direct_transport_socket_params_ : NULL, 158 switch(proxy) {
159 proxy == ProxyServer::SCHEME_SOCKS5 ? socks_socket_params_ : NULL, 159 case ProxyServer::SCHEME_DIRECT:
160 proxy == ProxyServer::SCHEME_HTTP ? http_proxy_socket_params_ : NULL, 160 return SSLSocketParams::CreateForDirectConnection(
161 proxy, 161 direct_transport_socket_params_,
162 HostPortPair("host", 443), 162 host_port,
163 ssl_config_, 163 ssl_config_,
164 0, 164 0,
165 false, 165 false,
166 want_spdy_over_npn)); 166 want_spdy_over_npn);
167
168 case ProxyServer::SCHEME_HTTP:
169 return SSLSocketParams::CreateForHttpProxy(
170 http_proxy_socket_params_,
171 ProxyServer::SCHEME_HTTP,
172 host_port,
173 ssl_config_,
174 0,
175 false,
176 want_spdy_over_npn);
177
178 case ProxyServer::SCHEME_SOCKS5:
179 return SSLSocketParams::CreateForSocksProxy(
180 socks_socket_params_,
181 ProxyServer::SCHEME_SOCKS5,
182 host_port,
183 ssl_config_,
184 0,
185 false,
186 want_spdy_over_npn);
187
188 default:
189 LOG(DFATAL) << "unexpected proxy type";
190 NOTREACHED();
191 return NULL;
192 }
167 } 193 }
168 194
169 void AddAuthToCache() { 195 void AddAuthToCache() {
170 const base::string16 kFoo(ASCIIToUTF16("foo")); 196 const base::string16 kFoo(ASCIIToUTF16("foo"));
171 const base::string16 kBar(ASCIIToUTF16("bar")); 197 const base::string16 kBar(ASCIIToUTF16("bar"));
172 session_->http_auth_cache()->Add(GURL("http://proxy:443/"), 198 session_->http_auth_cache()->Add(GURL("http://proxy:443/"),
173 "MyRealm1", 199 "MyRealm1",
174 HttpAuth::AUTH_SCHEME_BASIC, 200 HttpAuth::AUTH_SCHEME_BASIC,
175 "Basic realm=MyRealm1", 201 "Basic realm=MyRealm1",
176 AuthCredentials(kFoo, kBar), 202 AuthCredentials(kFoo, kBar),
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 ssl.channel_id_sent = true; 918 ssl.channel_id_sent = true;
893 ssl.SetNextProto(kProtoSPDY2); 919 ssl.SetNextProto(kProtoSPDY2);
894 TestIPPoolingDisabled(&ssl); 920 TestIPPoolingDisabled(&ssl);
895 } 921 }
896 922
897 // It would be nice to also test the timeouts in SSLClientSocketPool. 923 // It would be nice to also test the timeouts in SSLClientSocketPool.
898 924
899 } // namespace 925 } // namespace
900 926
901 } // namespace net 927 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698