| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool( | 132 old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool( |
| 133 HttpNetworkSession::NORMAL_SOCKET_POOL)), | 133 HttpNetworkSession::NORMAL_SOCKET_POOL)), |
| 134 spdy_util_(GetProtocol(), GetDependenciesFromPriority()), | 134 spdy_util_(GetProtocol(), GetDependenciesFromPriority()), |
| 135 session_deps_(GetProtocol()), | 135 session_deps_(GetProtocol()), |
| 136 spdy_session_pool_(nullptr), | 136 spdy_session_pool_(nullptr), |
| 137 test_url_(kDefaultURL), | 137 test_url_(kDefaultURL), |
| 138 test_host_port_pair_(HostPortPair::FromURL(test_url_)), | 138 test_host_port_pair_(HostPortPair::FromURL(test_url_)), |
| 139 key_(test_host_port_pair_, | 139 key_(test_host_port_pair_, |
| 140 ProxyServer::Direct(), | 140 ProxyServer::Direct(), |
| 141 PRIVACY_MODE_DISABLED) { | 141 PRIVACY_MODE_DISABLED) { |
| 142 SpdySession::SetPriorityDependencyDefaultForTesting( | 142 old_dependency_default_ = |
| 143 GetDependenciesFromPriority()); | 143 Http2PriorityDependencies::SetEnabledDefaultForTesting( |
| 144 GetDependenciesFromPriority()); |
| 144 } | 145 } |
| 145 | 146 |
| 146 virtual ~SpdySessionTest() { | 147 virtual ~SpdySessionTest() { |
| 147 // Important to restore the per-pool limit first, since the pool limit must | 148 // Important to restore the per-pool limit first, since the pool limit must |
| 148 // always be greater than group limit, and the tests reduce both limits. | 149 // always be greater than group limit, and the tests reduce both limits. |
| 149 ClientSocketPoolManager::set_max_sockets_per_pool( | 150 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 150 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_pool_sockets_); | 151 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_pool_sockets_); |
| 151 ClientSocketPoolManager::set_max_sockets_per_group( | 152 ClientSocketPoolManager::set_max_sockets_per_group( |
| 152 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_); | 153 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_); |
| 153 SpdySession::SetPriorityDependencyDefaultForTesting(false); | 154 Http2PriorityDependencies::SetEnabledDefaultForTesting( |
| 155 old_dependency_default_); |
| 154 } | 156 } |
| 155 | 157 |
| 156 void SetUp() override { | 158 void SetUp() override { |
| 157 g_time_delta = base::TimeDelta(); | 159 g_time_delta = base::TimeDelta(); |
| 158 g_time_now = base::TimeTicks::Now(); | 160 g_time_now = base::TimeTicks::Now(); |
| 159 session_deps_.net_log = log_.bound().net_log(); | 161 session_deps_.net_log = log_.bound().net_log(); |
| 160 } | 162 } |
| 161 | 163 |
| 162 void CreateNetworkSession() { | 164 void CreateNetworkSession() { |
| 163 DCHECK(!http_session_); | 165 DCHECK(!http_session_); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 210 |
| 209 SpdyTestUtil spdy_util_; | 211 SpdyTestUtil spdy_util_; |
| 210 SpdySessionDependencies session_deps_; | 212 SpdySessionDependencies session_deps_; |
| 211 scoped_ptr<HttpNetworkSession> http_session_; | 213 scoped_ptr<HttpNetworkSession> http_session_; |
| 212 base::WeakPtr<SpdySession> session_; | 214 base::WeakPtr<SpdySession> session_; |
| 213 SpdySessionPool* spdy_session_pool_; | 215 SpdySessionPool* spdy_session_pool_; |
| 214 GURL test_url_; | 216 GURL test_url_; |
| 215 HostPortPair test_host_port_pair_; | 217 HostPortPair test_host_port_pair_; |
| 216 SpdySessionKey key_; | 218 SpdySessionKey key_; |
| 217 BoundTestNetLog log_; | 219 BoundTestNetLog log_; |
| 220 bool old_dependency_default_; |
| 218 }; | 221 }; |
| 219 | 222 |
| 220 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, | 223 INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, |
| 221 SpdySessionTest, | 224 SpdySessionTest, |
| 222 testing::Values(kTestCaseSPDY31, | 225 testing::Values(kTestCaseSPDY31, |
| 223 kTestCaseHTTP2NoPriorityDependencies, | 226 kTestCaseHTTP2NoPriorityDependencies, |
| 224 kTestCaseHTTP2PriorityDependencies)); | 227 kTestCaseHTTP2PriorityDependencies)); |
| 225 | 228 |
| 226 // Try to create a SPDY session that will fail during | 229 // Try to create a SPDY session that will fail during |
| 227 // initialization. Nothing should blow up. | 230 // initialization. Nothing should blow up. |
| (...skipping 5218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5446 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5449 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 5447 "spdy_pooling.pem"); | 5450 "spdy_pooling.pem"); |
| 5448 ssl_info.is_issued_by_known_root = true; | 5451 ssl_info.is_issued_by_known_root = true; |
| 5449 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5452 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 5450 | 5453 |
| 5451 EXPECT_TRUE(SpdySession::CanPool( | 5454 EXPECT_TRUE(SpdySession::CanPool( |
| 5452 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5455 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 5453 } | 5456 } |
| 5454 | 5457 |
| 5455 } // namespace net | 5458 } // namespace net |
| OLD | NEW |