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