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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ret.push_back(value); | 98 ret.push_back(value); |
99 } | 99 } |
100 va_end(args); | 100 va_end(args); |
101 | 101 |
102 return ret; | 102 return ret; |
103 } | 103 } |
104 | 104 |
105 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating | 105 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating |
106 // SPDY. | 106 // SPDY. |
107 std::vector<std::string> SpdyNextProtos() { | 107 std::vector<std::string> SpdyNextProtos() { |
108 return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", NULL); | 108 return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", "spdy/3.1", NULL); |
109 } | 109 } |
110 | 110 |
111 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { | 111 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { |
112 return session->GetTransportSocketPool( | 112 return session->GetTransportSocketPool( |
113 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 113 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
114 } | 114 } |
115 | 115 |
116 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { | 116 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { |
117 return session->GetSSLSocketPool( | 117 return session->GetSSLSocketPool( |
118 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 118 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
(...skipping 9432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9551 EXPECT_EQ(ERR_IO_PENDING, rv); | 9551 EXPECT_EQ(ERR_IO_PENDING, rv); |
9552 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); | 9552 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); |
9553 } | 9553 } |
9554 | 9554 |
9555 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { | 9555 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { |
9556 // This test ensures that the URL passed into the proxy is upgraded | 9556 // This test ensures that the URL passed into the proxy is upgraded |
9557 // to https when doing an Alternate Protocol upgrade. | 9557 // to https when doing an Alternate Protocol upgrade. |
9558 HttpStreamFactory::set_use_alternate_protocols(true); | 9558 HttpStreamFactory::set_use_alternate_protocols(true); |
9559 HttpStreamFactory::SetNextProtos( | 9559 HttpStreamFactory::SetNextProtos( |
9560 MakeNextProtos( | 9560 MakeNextProtos( |
9561 "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy", NULL)); | 9561 "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy/3.1", "spdy", NULL)); |
9562 | 9562 |
9563 SpdySessionDependencies session_deps( | 9563 SpdySessionDependencies session_deps( |
9564 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 9564 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
9565 CapturingNetLog net_log; | 9565 CapturingNetLog net_log; |
9566 session_deps.net_log = &net_log; | 9566 session_deps.net_log = &net_log; |
9567 HttpAuthHandlerMock::Factory* auth_factory = | 9567 HttpAuthHandlerMock::Factory* auth_factory = |
9568 new HttpAuthHandlerMock::Factory(); | 9568 new HttpAuthHandlerMock::Factory(); |
9569 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 9569 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
9570 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 9570 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
9571 auth_factory->set_do_init_from_challenge(true); | 9571 auth_factory->set_do_init_from_challenge(true); |
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11095 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 11095 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
11096 MessageLoop::current()->RunUntilIdle(); | 11096 MessageLoop::current()->RunUntilIdle(); |
11097 data2->RunFor(3); | 11097 data2->RunFor(3); |
11098 | 11098 |
11099 ASSERT_TRUE(callback2.have_result()); | 11099 ASSERT_TRUE(callback2.have_result()); |
11100 EXPECT_EQ(OK, callback2.WaitForResult()); | 11100 EXPECT_EQ(OK, callback2.WaitForResult()); |
11101 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 11101 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
11102 } | 11102 } |
11103 | 11103 |
11104 } // namespace net | 11104 } // namespace net |
OLD | NEW |