| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2956 PRIVACY_MODE_DISABLED); | 2956 PRIVACY_MODE_DISABLED); |
| 2957 base::WeakPtr<SpdySession> session1 = ::net::CreateInsecureSpdySession( | 2957 base::WeakPtr<SpdySession> session1 = ::net::CreateInsecureSpdySession( |
| 2958 http_session_.get(), key1, BoundNetLog()); | 2958 http_session_.get(), key1, BoundNetLog()); |
| 2959 EXPECT_FALSE(pool->IsStalled()); | 2959 EXPECT_FALSE(pool->IsStalled()); |
| 2960 | 2960 |
| 2961 // Set up an alias for the idle SPDY session, increasing its ref count to 2. | 2961 // Set up an alias for the idle SPDY session, increasing its ref count to 2. |
| 2962 SpdySessionKey key2(HostPortPair("2.com", 80), ProxyServer::Direct(), | 2962 SpdySessionKey key2(HostPortPair("2.com", 80), ProxyServer::Direct(), |
| 2963 PRIVACY_MODE_DISABLED); | 2963 PRIVACY_MODE_DISABLED); |
| 2964 HostResolver::RequestInfo info(key2.host_port_pair()); | 2964 HostResolver::RequestInfo info(key2.host_port_pair()); |
| 2965 AddressList addresses; | 2965 AddressList addresses; |
| 2966 std::unique_ptr<HostResolver::Request> request; |
| 2966 // Pre-populate the DNS cache, since a synchronous resolution is required in | 2967 // Pre-populate the DNS cache, since a synchronous resolution is required in |
| 2967 // order to create the alias. | 2968 // order to create the alias. |
| 2968 session_deps_.host_resolver->Resolve(info, DEFAULT_PRIORITY, &addresses, | 2969 session_deps_.host_resolver->Resolve(info, DEFAULT_PRIORITY, &addresses, |
| 2969 CompletionCallback(), nullptr, | 2970 CompletionCallback(), &request, |
| 2970 BoundNetLog()); | 2971 BoundNetLog()); |
| 2971 // Get a session for |key2|, which should return the session created earlier. | 2972 // Get a session for |key2|, which should return the session created earlier. |
| 2972 base::WeakPtr<SpdySession> session2 = | 2973 base::WeakPtr<SpdySession> session2 = |
| 2973 spdy_session_pool_->FindAvailableSession(key2, GURL(), BoundNetLog()); | 2974 spdy_session_pool_->FindAvailableSession(key2, GURL(), BoundNetLog()); |
| 2974 ASSERT_EQ(session1.get(), session2.get()); | 2975 ASSERT_EQ(session1.get(), session2.get()); |
| 2975 EXPECT_FALSE(pool->IsStalled()); | 2976 EXPECT_FALSE(pool->IsStalled()); |
| 2976 | 2977 |
| 2977 // Trying to create a new connection should cause the pool to be stalled, and | 2978 // Trying to create a new connection should cause the pool to be stalled, and |
| 2978 // post a task asynchronously to try and close the session. | 2979 // post a task asynchronously to try and close the session. |
| 2979 TestCompletionCallback callback3; | 2980 TestCompletionCallback callback3; |
| (...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5399 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 5399 "spdy_pooling.pem"); | 5400 "spdy_pooling.pem"); |
| 5400 ssl_info.is_issued_by_known_root = true; | 5401 ssl_info.is_issued_by_known_root = true; |
| 5401 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5402 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 5402 | 5403 |
| 5403 EXPECT_TRUE(SpdySession::CanPool( | 5404 EXPECT_TRUE(SpdySession::CanPool( |
| 5404 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5405 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 5405 } | 5406 } |
| 5406 | 5407 |
| 5407 } // namespace net | 5408 } // namespace net |
| OLD | NEW |