OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 8126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8137 TestCompletionCallback callback; | 8137 TestCompletionCallback callback; |
8138 | 8138 |
8139 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8139 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
8140 scoped_ptr<HttpTransaction> trans( | 8140 scoped_ptr<HttpTransaction> trans( |
8141 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8141 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
8142 | 8142 |
8143 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8143 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
8144 EXPECT_EQ(ERR_IO_PENDING, rv); | 8144 EXPECT_EQ(ERR_IO_PENDING, rv); |
8145 | 8145 |
8146 HostPortPair http_host_port_pair("www.google.com", 80); | 8146 HostPortPair http_host_port_pair("www.google.com", 80); |
8147 HttpServerProperties& http_server_properties = | 8147 const HttpServerProperties& http_server_properties = |
8148 *session->http_server_properties(); | 8148 *session->http_server_properties(); |
8149 EXPECT_FALSE( | 8149 EXPECT_FALSE( |
8150 http_server_properties.HasAlternateProtocol(http_host_port_pair)); | 8150 http_server_properties.HasAlternateProtocol(http_host_port_pair)); |
8151 | 8151 |
8152 EXPECT_EQ(OK, callback.WaitForResult()); | 8152 EXPECT_EQ(OK, callback.WaitForResult()); |
8153 | 8153 |
8154 const HttpResponseInfo* response = trans->GetResponseInfo(); | 8154 const HttpResponseInfo* response = trans->GetResponseInfo(); |
8155 ASSERT_TRUE(response != NULL); | 8155 ASSERT_TRUE(response != NULL); |
8156 ASSERT_TRUE(response->headers.get() != NULL); | 8156 ASSERT_TRUE(response->headers.get() != NULL); |
8157 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 8157 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
(...skipping 4276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12434 // established, to let the HTTP request start. | 12434 // established, to let the HTTP request start. |
12435 ASSERT_EQ(OK, http_callback.WaitForResult()); | 12435 ASSERT_EQ(OK, http_callback.WaitForResult()); |
12436 std::string response_data; | 12436 std::string response_data; |
12437 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); | 12437 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); |
12438 EXPECT_EQ("falafel", response_data); | 12438 EXPECT_EQ("falafel", response_data); |
12439 | 12439 |
12440 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); | 12440 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); |
12441 } | 12441 } |
12442 | 12442 |
12443 } // namespace net | 12443 } // namespace net |
OLD | NEW |