| 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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3421 HostResolver::RequestInfo info(key2.host_port_pair()); | 3421 HostResolver::RequestInfo info(key2.host_port_pair()); |
| 3422 AddressList addresses; | 3422 AddressList addresses; |
| 3423 std::unique_ptr<HostResolver::Request> request; | 3423 std::unique_ptr<HostResolver::Request> request; |
| 3424 // Pre-populate the DNS cache, since a synchronous resolution is required in | 3424 // Pre-populate the DNS cache, since a synchronous resolution is required in |
| 3425 // order to create the alias. | 3425 // order to create the alias. |
| 3426 session_deps_.host_resolver->Resolve(info, DEFAULT_PRIORITY, &addresses, | 3426 session_deps_.host_resolver->Resolve(info, DEFAULT_PRIORITY, &addresses, |
| 3427 CompletionCallback(), &request, | 3427 CompletionCallback(), &request, |
| 3428 NetLogWithSource()); | 3428 NetLogWithSource()); |
| 3429 // Get a session for |key2|, which should return the session created earlier. | 3429 // Get a session for |key2|, which should return the session created earlier. |
| 3430 base::WeakPtr<SpdySession> session2 = | 3430 base::WeakPtr<SpdySession> session2 = |
| 3431 spdy_session_pool_->FindAvailableSession(key2, GURL(), | 3431 spdy_session_pool_->FindAvailableSession( |
| 3432 NetLogWithSource()); | 3432 key2, GURL(), |
| 3433 /* enable_ip_based_pooling = */ true, NetLogWithSource()); |
| 3433 ASSERT_EQ(session1.get(), session2.get()); | 3434 ASSERT_EQ(session1.get(), session2.get()); |
| 3434 EXPECT_FALSE(pool->IsStalled()); | 3435 EXPECT_FALSE(pool->IsStalled()); |
| 3435 | 3436 |
| 3436 // Trying to create a new connection should cause the pool to be stalled, and | 3437 // Trying to create a new connection should cause the pool to be stalled, and |
| 3437 // post a task asynchronously to try and close the session. | 3438 // post a task asynchronously to try and close the session. |
| 3438 TestCompletionCallback callback3; | 3439 TestCompletionCallback callback3; |
| 3439 HostPortPair host_port3("3.com", 80); | 3440 HostPortPair host_port3("3.com", 80); |
| 3440 scoped_refptr<TransportSocketParams> params3(new TransportSocketParams( | 3441 scoped_refptr<TransportSocketParams> params3(new TransportSocketParams( |
| 3441 host_port3, false, OnHostResolutionCallback(), | 3442 host_port3, false, OnHostResolutionCallback(), |
| 3442 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)); | 3443 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)); |
| (...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6180 CreateSecureSpdySession(); | 6181 CreateSecureSpdySession(); |
| 6181 | 6182 |
| 6182 // If the experiment is enabled, the SpdySession will close idle sockets. | 6183 // If the experiment is enabled, the SpdySession will close idle sockets. |
| 6183 EXPECT_EQ( | 6184 EXPECT_EQ( |
| 6184 experiment_enabled_ ? 0 : kNumIdleSockets - 1, | 6185 experiment_enabled_ ? 0 : kNumIdleSockets - 1, |
| 6185 http_session_->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL) | 6186 http_session_->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL) |
| 6186 ->IdleSocketCount()); | 6187 ->IdleSocketCount()); |
| 6187 } | 6188 } |
| 6188 | 6189 |
| 6189 } // namespace net | 6190 } // namespace net |
| OLD | NEW |