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 9372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9383 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); | 9383 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); |
9384 | 9384 |
9385 EXPECT_EQ(OK, out.rv); | 9385 EXPECT_EQ(OK, out.rv); |
9386 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 9386 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
9387 EXPECT_EQ("hello world", out.response_data); | 9387 EXPECT_EQ("hello world", out.response_data); |
9388 } | 9388 } |
9389 | 9389 |
9390 TEST_F(HttpNetworkTransactionSpdy21Test, CloseIdleSpdySessionToOpenNewOne) { | 9390 TEST_F(HttpNetworkTransactionSpdy21Test, CloseIdleSpdySessionToOpenNewOne) { |
9391 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 9391 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
9392 int old_max_sockets_per_group = | 9392 int old_max_sockets_per_group = |
9393 ClientSocketPoolManager::max_sockets_per_group(); | 9393 ClientSocketPoolManager::max_sockets_per_group( |
| 9394 HttpNetworkSession::NORMAL_SOCKET_POOL); |
9394 int old_max_sockets_per_proxy_server = | 9395 int old_max_sockets_per_proxy_server = |
9395 ClientSocketPoolManager::max_sockets_per_proxy_server(); | 9396 ClientSocketPoolManager::max_sockets_per_proxy_server( |
| 9397 HttpNetworkSession::NORMAL_SOCKET_POOL); |
9396 int old_max_sockets_per_pool = | 9398 int old_max_sockets_per_pool = |
9397 ClientSocketPoolManager::max_sockets_per_pool(); | 9399 ClientSocketPoolManager::max_sockets_per_pool( |
9398 ClientSocketPoolManager::set_max_sockets_per_group(1); | 9400 HttpNetworkSession::NORMAL_SOCKET_POOL); |
9399 ClientSocketPoolManager::set_max_sockets_per_proxy_server(1); | 9401 ClientSocketPoolManager::set_max_sockets_per_group( |
9400 ClientSocketPoolManager::set_max_sockets_per_pool(1); | 9402 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 9403 ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 9404 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 9405 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 9406 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
9401 | 9407 |
9402 // Use two different hosts with different IPs so they don't get pooled. | 9408 // Use two different hosts with different IPs so they don't get pooled. |
9403 SessionDependencies session_deps; | 9409 SessionDependencies session_deps; |
9404 session_deps.host_resolver->rules()->AddRule("a.com", "10.0.0.1"); | 9410 session_deps.host_resolver->rules()->AddRule("a.com", "10.0.0.1"); |
9405 session_deps.host_resolver->rules()->AddRule("b.com", "10.0.0.2"); | 9411 session_deps.host_resolver->rules()->AddRule("b.com", "10.0.0.2"); |
9406 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 9412 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
9407 | 9413 |
9408 SSLSocketDataProvider ssl1(ASYNC, OK); | 9414 SSLSocketDataProvider ssl1(ASYNC, OK); |
9409 ssl1.SetNextProto(SSLClientSocket::kProtoSPDY21); | 9415 ssl1.SetNextProto(SSLClientSocket::kProtoSPDY21); |
9410 SSLSocketDataProvider ssl2(ASYNC, OK); | 9416 SSLSocketDataProvider ssl2(ASYNC, OK); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9547 EXPECT_FALSE(response->was_fetched_via_spdy); | 9553 EXPECT_FALSE(response->was_fetched_via_spdy); |
9548 EXPECT_FALSE(response->was_npn_negotiated); | 9554 EXPECT_FALSE(response->was_npn_negotiated); |
9549 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 9555 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
9550 EXPECT_EQ("hello!", response_data); | 9556 EXPECT_EQ("hello!", response_data); |
9551 EXPECT_FALSE( | 9557 EXPECT_FALSE( |
9552 session->spdy_session_pool()->HasSession(host_port_proxy_pair_a)); | 9558 session->spdy_session_pool()->HasSession(host_port_proxy_pair_a)); |
9553 EXPECT_FALSE( | 9559 EXPECT_FALSE( |
9554 session->spdy_session_pool()->HasSession(host_port_proxy_pair_b)); | 9560 session->spdy_session_pool()->HasSession(host_port_proxy_pair_b)); |
9555 | 9561 |
9556 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 9562 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
9557 ClientSocketPoolManager::set_max_sockets_per_pool(old_max_sockets_per_pool); | 9563 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 9564 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_pool); |
9558 ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 9565 ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
9559 old_max_sockets_per_proxy_server); | 9566 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_proxy_server); |
9560 ClientSocketPoolManager::set_max_sockets_per_group(old_max_sockets_per_group); | 9567 ClientSocketPoolManager::set_max_sockets_per_group( |
| 9568 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_group); |
9561 } | 9569 } |
9562 | 9570 |
9563 } // namespace net | 9571 } // namespace net |
OLD | NEW |