OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdarg.h> | 8 #include <stdarg.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 7243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7254 std::string response_data; | 7254 std::string response_data; |
7255 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 7255 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
7256 EXPECT_EQ("hello world", response_data); | 7256 EXPECT_EQ("hello world", response_data); |
7257 | 7257 |
7258 // Set up an initial SpdySession in the pool to reuse. | 7258 // Set up an initial SpdySession in the pool to reuse. |
7259 HostPortPair host_port_pair("www.google.com", 443); | 7259 HostPortPair host_port_pair("www.google.com", 443); |
7260 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); | 7260 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); |
7261 scoped_refptr<SpdySession> spdy_session = | 7261 scoped_refptr<SpdySession> spdy_session = |
7262 session->spdy_session_pool()->Get(pair, BoundNetLog()); | 7262 session->spdy_session_pool()->Get(pair, BoundNetLog()); |
7263 scoped_refptr<TransportSocketParams> transport_params( | 7263 scoped_refptr<TransportSocketParams> transport_params( |
7264 new TransportSocketParams(host_port_pair, MEDIUM, GURL(), false, false)); | 7264 new TransportSocketParams(host_port_pair, MEDIUM, false, false)); |
7265 | 7265 |
7266 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 7266 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
7267 EXPECT_EQ(ERR_IO_PENDING, | 7267 EXPECT_EQ(ERR_IO_PENDING, |
7268 connection->Init(host_port_pair.ToString(), | 7268 connection->Init(host_port_pair.ToString(), |
7269 transport_params, | 7269 transport_params, |
7270 LOWEST, | 7270 LOWEST, |
7271 &callback, | 7271 &callback, |
7272 session->transport_socket_pool(), | 7272 session->transport_socket_pool(), |
7273 BoundNetLog())); | 7273 BoundNetLog())); |
7274 EXPECT_EQ(OK, callback.WaitForResult()); | 7274 EXPECT_EQ(OK, callback.WaitForResult()); |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8510 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); | 8510 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl); |
8511 | 8511 |
8512 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 8512 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
8513 | 8513 |
8514 // Set up an initial SpdySession in the pool to reuse. | 8514 // Set up an initial SpdySession in the pool to reuse. |
8515 HostPortPair host_port_pair("www.google.com", 443); | 8515 HostPortPair host_port_pair("www.google.com", 443); |
8516 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); | 8516 HostPortProxyPair pair(host_port_pair, ProxyServer::Direct()); |
8517 scoped_refptr<SpdySession> spdy_session = | 8517 scoped_refptr<SpdySession> spdy_session = |
8518 session->spdy_session_pool()->Get(pair, BoundNetLog()); | 8518 session->spdy_session_pool()->Get(pair, BoundNetLog()); |
8519 scoped_refptr<TransportSocketParams> transport_params( | 8519 scoped_refptr<TransportSocketParams> transport_params( |
8520 new TransportSocketParams(host_port_pair, MEDIUM, GURL(), false, false)); | 8520 new TransportSocketParams(host_port_pair, MEDIUM, false, false)); |
8521 TestOldCompletionCallback callback; | 8521 TestOldCompletionCallback callback; |
8522 | 8522 |
8523 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 8523 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
8524 EXPECT_EQ(ERR_IO_PENDING, | 8524 EXPECT_EQ(ERR_IO_PENDING, |
8525 connection->Init(host_port_pair.ToString(), transport_params, | 8525 connection->Init(host_port_pair.ToString(), transport_params, |
8526 LOWEST, &callback, | 8526 LOWEST, &callback, |
8527 session->transport_socket_pool(), BoundNetLog())); | 8527 session->transport_socket_pool(), BoundNetLog())); |
8528 EXPECT_EQ(OK, callback.WaitForResult()); | 8528 EXPECT_EQ(OK, callback.WaitForResult()); |
8529 spdy_session->InitializeWithSocket(connection.release(), false, OK); | 8529 spdy_session->InitializeWithSocket(connection.release(), false, OK); |
8530 | 8530 |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9222 StaticSocketDataProvider* data[] = { &data1, &data2 }; | 9222 StaticSocketDataProvider* data[] = { &data1, &data2 }; |
9223 | 9223 |
9224 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); | 9224 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); |
9225 | 9225 |
9226 EXPECT_EQ(OK, out.rv); | 9226 EXPECT_EQ(OK, out.rv); |
9227 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 9227 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
9228 EXPECT_EQ("hello world", out.response_data); | 9228 EXPECT_EQ("hello world", out.response_data); |
9229 } | 9229 } |
9230 | 9230 |
9231 } // namespace net | 9231 } // namespace net |
OLD | NEW |