OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 ret.push_back(value); | 97 ret.push_back(value); |
98 } | 98 } |
99 va_end(args); | 99 va_end(args); |
100 | 100 |
101 return ret; | 101 return ret; |
102 } | 102 } |
103 | 103 |
104 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating | 104 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating |
105 // SPDY. | 105 // SPDY. |
106 std::vector<std::string> SpdyNextProtos() { | 106 std::vector<std::string> SpdyNextProtos() { |
107 return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", "spdy/3.1", NULL); | 107 return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", "spdy/3.1", |
| 108 "spdy/4a1", NULL); |
108 } | 109 } |
109 | 110 |
110 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { | 111 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { |
111 return session->GetTransportSocketPool( | 112 return session->GetTransportSocketPool( |
112 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 113 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
113 } | 114 } |
114 | 115 |
115 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { | 116 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { |
116 return session->GetSSLSocketPool( | 117 return session->GetSSLSocketPool( |
117 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 118 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
(...skipping 9566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9684 EXPECT_EQ(ERR_IO_PENDING, rv); | 9685 EXPECT_EQ(ERR_IO_PENDING, rv); |
9685 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); | 9686 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); |
9686 } | 9687 } |
9687 | 9688 |
9688 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { | 9689 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { |
9689 // This test ensures that the URL passed into the proxy is upgraded | 9690 // This test ensures that the URL passed into the proxy is upgraded |
9690 // to https when doing an Alternate Protocol upgrade. | 9691 // to https when doing an Alternate Protocol upgrade. |
9691 HttpStreamFactory::set_use_alternate_protocols(true); | 9692 HttpStreamFactory::set_use_alternate_protocols(true); |
9692 HttpStreamFactory::SetNextProtos( | 9693 HttpStreamFactory::SetNextProtos( |
9693 MakeNextProtos( | 9694 MakeNextProtos( |
9694 "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy/3.1", "spdy", NULL)); | 9695 "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy/3.1", |
| 9696 "spdy/4a1", "spdy", NULL)); |
9695 | 9697 |
9696 SpdySessionDependencies session_deps( | 9698 SpdySessionDependencies session_deps( |
9697 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 9699 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
9698 CapturingNetLog net_log; | 9700 CapturingNetLog net_log; |
9699 session_deps.net_log = &net_log; | 9701 session_deps.net_log = &net_log; |
9700 HttpAuthHandlerMock::Factory* auth_factory = | 9702 HttpAuthHandlerMock::Factory* auth_factory = |
9701 new HttpAuthHandlerMock::Factory(); | 9703 new HttpAuthHandlerMock::Factory(); |
9702 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 9704 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
9703 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 9705 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
9704 auth_factory->set_do_init_from_challenge(true); | 9706 auth_factory->set_do_init_from_challenge(true); |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11230 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 11232 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
11231 MessageLoop::current()->RunUntilIdle(); | 11233 MessageLoop::current()->RunUntilIdle(); |
11232 data2->RunFor(3); | 11234 data2->RunFor(3); |
11233 | 11235 |
11234 ASSERT_TRUE(callback2.have_result()); | 11236 ASSERT_TRUE(callback2.have_result()); |
11235 EXPECT_EQ(OK, callback2.WaitForResult()); | 11237 EXPECT_EQ(OK, callback2.WaitForResult()); |
11236 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 11238 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
11237 } | 11239 } |
11238 | 11240 |
11239 } // namespace net | 11241 } // namespace net |
OLD | NEW |