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