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 5629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5640 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5640 const HttpResponseInfo* response = trans->GetResponseInfo(); |
5641 ASSERT_TRUE(response != NULL); | 5641 ASSERT_TRUE(response != NULL); |
5642 ASSERT_TRUE(response->headers != NULL); | 5642 ASSERT_TRUE(response->headers != NULL); |
5643 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 5643 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
5644 | 5644 |
5645 std::string response_data; | 5645 std::string response_data; |
5646 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 5646 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
5647 EXPECT_EQ("hello world", response_data); | 5647 EXPECT_EQ("hello world", response_data); |
5648 | 5648 |
5649 // Set up an initial SpdySession in the pool to reuse. | 5649 // Set up an initial SpdySession in the pool to reuse. |
5650 HostPortProxyPair pair(HostPortPair("www.google.com", 443), "DIRECT"); | 5650 HostPortProxyPair pair(HostPortPair("www.google.com", 443), |
| 5651 ProxyServer::Direct()); |
5651 scoped_refptr<SpdySession> spdy_session = | 5652 scoped_refptr<SpdySession> spdy_session = |
5652 session->spdy_session_pool()->Get(pair, session, BoundNetLog()); | 5653 session->spdy_session_pool()->Get(pair, session, BoundNetLog()); |
5653 scoped_refptr<TCPSocketParams> tcp_params = | 5654 scoped_refptr<TCPSocketParams> tcp_params = |
5654 new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false); | 5655 new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false); |
5655 spdy_session->Connect("www.google.com:443", tcp_params, MEDIUM); | 5656 spdy_session->Connect("www.google.com:443", tcp_params, MEDIUM); |
5656 trans.reset(new HttpNetworkTransaction(session)); | 5657 trans.reset(new HttpNetworkTransaction(session)); |
5657 | 5658 |
5658 rv = trans->Start(&request, &callback, BoundNetLog()); | 5659 rv = trans->Start(&request, &callback, BoundNetLog()); |
5659 EXPECT_EQ(ERR_IO_PENDING, rv); | 5660 EXPECT_EQ(ERR_IO_PENDING, rv); |
5660 EXPECT_EQ(OK, callback.WaitForResult()); | 5661 EXPECT_EQ(OK, callback.WaitForResult()); |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6589 | 6590 |
6590 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); | 6591 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
6591 int rv = trans->Start(&request, &callback, log.bound()); | 6592 int rv = trans->Start(&request, &callback, log.bound()); |
6592 EXPECT_EQ(ERR_IO_PENDING, rv); | 6593 EXPECT_EQ(ERR_IO_PENDING, rv); |
6593 trans.reset(); // Cancel the transaction here. | 6594 trans.reset(); // Cancel the transaction here. |
6594 | 6595 |
6595 MessageLoop::current()->RunAllPending(); | 6596 MessageLoop::current()->RunAllPending(); |
6596 } | 6597 } |
6597 | 6598 |
6598 } // namespace net | 6599 } // namespace net |
OLD | NEW |