| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 scoped_refptr<ProxyService> proxy_service; | 92 scoped_refptr<ProxyService> proxy_service; |
| 93 scoped_refptr<SSLConfigService> ssl_config_service; | 93 scoped_refptr<SSLConfigService> ssl_config_service; |
| 94 MockClientSocketFactory socket_factory; | 94 MockClientSocketFactory socket_factory; |
| 95 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; | 95 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; |
| 96 NetLog* net_log; | 96 NetLog* net_log; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { | 99 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { |
| 100 return new HttpNetworkSession(session_deps->host_resolver.get(), | 100 return new HttpNetworkSession(session_deps->host_resolver.get(), |
| 101 NULL /* dnsrr_resolver */, | 101 NULL /* dnsrr_resolver */, |
| 102 NULL /* ssl_host_info_factory */, | |
| 103 session_deps->proxy_service, | 102 session_deps->proxy_service, |
| 104 &session_deps->socket_factory, | 103 &session_deps->socket_factory, |
| 105 session_deps->ssl_config_service, | 104 session_deps->ssl_config_service, |
| 106 new SpdySessionPool(NULL), | 105 new SpdySessionPool(NULL), |
| 107 session_deps->http_auth_handler_factory.get(), | 106 session_deps->http_auth_handler_factory.get(), |
| 108 NULL, | 107 NULL, |
| 109 session_deps->net_log); | 108 session_deps->net_log); |
| 110 } | 109 } |
| 111 | 110 |
| 112 class HttpNetworkTransactionTest : public PlatformTest { | 111 class HttpNetworkTransactionTest : public PlatformTest { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 template<> | 289 template<> |
| 291 CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool( | 290 CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool( |
| 292 HttpNetworkSession* session) | 291 HttpNetworkSession* session) |
| 293 : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, | 292 : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, |
| 294 NULL, NULL) {} | 293 NULL, NULL) {} |
| 295 | 294 |
| 296 template<> | 295 template<> |
| 297 CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( | 296 CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( |
| 298 HttpNetworkSession* session) | 297 HttpNetworkSession* session) |
| 299 : SSLClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, NULL, | 298 : SSLClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, NULL, |
| 300 NULL, NULL, NULL, NULL, NULL, NULL) {} | 299 NULL, NULL, NULL, NULL, NULL) {} |
| 301 | 300 |
| 302 //----------------------------------------------------------------------------- | 301 //----------------------------------------------------------------------------- |
| 303 | 302 |
| 304 // This is the expected list of advertised protocols from the browser's NPN | 303 // This is the expected list of advertised protocols from the browser's NPN |
| 305 // list. | 304 // list. |
| 306 static const char kExpectedNPNString[] = "\x08http/1.1\x06spdy/2"; | 305 static const char kExpectedNPNString[] = "\x08http/1.1\x06spdy/2"; |
| 307 | 306 |
| 308 // This is the expected return from a current server advertising SPDY. | 307 // This is the expected return from a current server advertising SPDY. |
| 309 static const char kAlternateProtocolHttpHeader[] = | 308 static const char kAlternateProtocolHttpHeader[] = |
| 310 "Alternate-Protocol: 443:npn-spdy/2\r\n\r\n"; | 309 "Alternate-Protocol: 443:npn-spdy/2\r\n\r\n"; |
| (...skipping 6107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6418 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 6417 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 6419 EXPECT_EQ(ERR_IO_PENDING, | 6418 EXPECT_EQ(ERR_IO_PENDING, |
| 6420 connection->Init(host_port_pair.ToString(),tcp_params, LOWEST, | 6419 connection->Init(host_port_pair.ToString(),tcp_params, LOWEST, |
| 6421 &callback, session->tcp_socket_pool(), | 6420 &callback, session->tcp_socket_pool(), |
| 6422 BoundNetLog())); | 6421 BoundNetLog())); |
| 6423 EXPECT_EQ(OK, callback.WaitForResult()); | 6422 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6424 | 6423 |
| 6425 SSLConfig ssl_config; | 6424 SSLConfig ssl_config; |
| 6426 session->ssl_config_service()->GetSSLConfig(&ssl_config); | 6425 session->ssl_config_service()->GetSSLConfig(&ssl_config); |
| 6427 ClientSocket* socket = connection->release_socket(); | 6426 ClientSocket* socket = connection->release_socket(); |
| 6428 socket = session->socket_factory()->CreateSSLClientSocket( | 6427 socket = session->socket_factory()->CreateSSLClientSocket(socket, "" , |
| 6429 socket, "" , ssl_config, NULL /* ssl_host_info */); | 6428 ssl_config); |
| 6430 connection->set_socket(socket); | 6429 connection->set_socket(socket); |
| 6431 EXPECT_EQ(ERR_IO_PENDING, socket->Connect(&callback)); | 6430 EXPECT_EQ(ERR_IO_PENDING, socket->Connect(&callback)); |
| 6432 EXPECT_EQ(OK, callback.WaitForResult()); | 6431 EXPECT_EQ(OK, callback.WaitForResult()); |
| 6433 | 6432 |
| 6434 EXPECT_EQ(OK, spdy_session->InitializeWithSocket(connection.release(), | 6433 EXPECT_EQ(OK, spdy_session->InitializeWithSocket(connection.release(), |
| 6435 true, OK)); | 6434 true, OK)); |
| 6436 | 6435 |
| 6437 trans.reset(new HttpNetworkTransaction(session)); | 6436 trans.reset(new HttpNetworkTransaction(session)); |
| 6438 | 6437 |
| 6439 rv = trans->Start(&request, &callback, BoundNetLog()); | 6438 rv = trans->Start(&request, &callback, BoundNetLog()); |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7609 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; | 7608 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; |
| 7610 | 7609 |
| 7611 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); | 7610 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); |
| 7612 | 7611 |
| 7613 int rv = trans->Start(&request, &callback, BoundNetLog()); | 7612 int rv = trans->Start(&request, &callback, BoundNetLog()); |
| 7614 EXPECT_EQ(ERR_IO_PENDING, rv); | 7613 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 7615 EXPECT_EQ(OK, callback.WaitForResult()); | 7614 EXPECT_EQ(OK, callback.WaitForResult()); |
| 7616 } | 7615 } |
| 7617 | 7616 |
| 7618 } // namespace net | 7617 } // namespace net |
| OLD | NEW |