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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 }; | 97 }; |
98 | 98 |
99 ProxyService* CreateFixedProxyService(const std::string& proxy) { | 99 ProxyService* CreateFixedProxyService(const std::string& proxy) { |
100 net::ProxyConfig proxy_config; | 100 net::ProxyConfig proxy_config; |
101 proxy_config.proxy_rules().ParseFromString(proxy); | 101 proxy_config.proxy_rules().ParseFromString(proxy); |
102 return ProxyService::CreateFixed(proxy_config); | 102 return ProxyService::CreateFixed(proxy_config); |
103 } | 103 } |
104 | 104 |
105 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { | 105 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { |
106 return new HttpNetworkSession(session_deps->host_resolver.get(), | 106 return new HttpNetworkSession(session_deps->host_resolver.get(), |
| 107 NULL /* dnsrr_resolver */, |
107 session_deps->proxy_service, | 108 session_deps->proxy_service, |
108 &session_deps->socket_factory, | 109 &session_deps->socket_factory, |
109 session_deps->ssl_config_service, | 110 session_deps->ssl_config_service, |
110 new SpdySessionPool(NULL), | 111 new SpdySessionPool(NULL), |
111 session_deps->http_auth_handler_factory.get(), | 112 session_deps->http_auth_handler_factory.get(), |
112 NULL, | 113 NULL, |
113 session_deps->net_log); | 114 session_deps->net_log); |
114 } | 115 } |
115 | 116 |
116 class HttpNetworkTransactionTest : public PlatformTest { | 117 class HttpNetworkTransactionTest : public PlatformTest { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 template<> | 298 template<> |
298 CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool( | 299 CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool( |
299 HttpNetworkSession* session) | 300 HttpNetworkSession* session) |
300 : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, | 301 : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, |
301 NULL, NULL) {} | 302 NULL, NULL) {} |
302 | 303 |
303 template<> | 304 template<> |
304 CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( | 305 CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( |
305 HttpNetworkSession* session) | 306 HttpNetworkSession* session) |
306 : SSLClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, NULL, | 307 : SSLClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, NULL, |
307 NULL, NULL, NULL, NULL) {} | 308 NULL, NULL, NULL, NULL, NULL) {} |
308 | 309 |
309 //----------------------------------------------------------------------------- | 310 //----------------------------------------------------------------------------- |
310 | 311 |
311 // This is the expected list of advertised protocols from the browser's NPN | 312 // This is the expected list of advertised protocols from the browser's NPN |
312 // list. | 313 // list. |
313 static const char kExpectedNPNString[] = "\x08http/1.1\x06spdy/2"; | 314 static const char kExpectedNPNString[] = "\x08http/1.1\x06spdy/2"; |
314 | 315 |
315 // This is the expected return from a current server advertising SPDY. | 316 // This is the expected return from a current server advertising SPDY. |
316 static const char kAlternateProtocolHttpHeader[] = | 317 static const char kAlternateProtocolHttpHeader[] = |
317 "Alternate-Protocol: 443:npn-spdy/2\r\n\r\n"; | 318 "Alternate-Protocol: 443:npn-spdy/2\r\n\r\n"; |
(...skipping 7086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7404 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; | 7405 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; |
7405 | 7406 |
7406 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); | 7407 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); |
7407 | 7408 |
7408 int rv = trans->Start(&request, &callback, BoundNetLog()); | 7409 int rv = trans->Start(&request, &callback, BoundNetLog()); |
7409 EXPECT_EQ(ERR_IO_PENDING, rv); | 7410 EXPECT_EQ(ERR_IO_PENDING, rv); |
7410 EXPECT_EQ(OK, callback.WaitForResult()); | 7411 EXPECT_EQ(OK, callback.WaitForResult()); |
7411 } | 7412 } |
7412 | 7413 |
7413 } // namespace net | 7414 } // namespace net |
OLD | NEW |