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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 SpdySessionPool* spdy_session_pool_; | 175 SpdySessionPool* spdy_session_pool_; |
176 GURL test_url_; | 176 GURL test_url_; |
177 HostPortPair test_host_port_pair_; | 177 HostPortPair test_host_port_pair_; |
178 SpdySessionKey key_; | 178 SpdySessionKey key_; |
179 }; | 179 }; |
180 | 180 |
181 INSTANTIATE_TEST_CASE_P( | 181 INSTANTIATE_TEST_CASE_P( |
182 NextProto, | 182 NextProto, |
183 SpdySessionTest, | 183 SpdySessionTest, |
184 testing::Values(kProtoDeprecatedSPDY2, | 184 testing::Values(kProtoDeprecatedSPDY2, |
185 kProtoSPDY3, kProtoSPDY31, kProtoSPDY4)); | 185 kProtoSPDY3, kProtoSPDY31, kProtoSPDY4_14, kProtoSPDY4_15)); |
186 | 186 |
187 // Try to create a SPDY session that will fail during | 187 // Try to create a SPDY session that will fail during |
188 // initialization. Nothing should blow up. | 188 // initialization. Nothing should blow up. |
189 TEST_P(SpdySessionTest, InitialReadError) { | 189 TEST_P(SpdySessionTest, InitialReadError) { |
190 CreateDeterministicNetworkSession(); | 190 CreateDeterministicNetworkSession(); |
191 | 191 |
192 base::WeakPtr<SpdySession> session = TryCreateFakeSpdySessionExpectingFailure( | 192 base::WeakPtr<SpdySession> session = TryCreateFakeSpdySessionExpectingFailure( |
193 spdy_session_pool_, key_, ERR_CONNECTION_CLOSED); | 193 spdy_session_pool_, key_, ERR_CONNECTION_CLOSED); |
194 EXPECT_TRUE(session); | 194 EXPECT_TRUE(session); |
195 // Flush the read. | 195 // Flush the read. |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize); | 1549 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize); |
1550 } | 1550 } |
1551 MockConnect connect_data(SYNCHRONOUS, OK); | 1551 MockConnect connect_data(SYNCHRONOUS, OK); |
1552 scoped_ptr<SpdyFrame> settings_frame( | 1552 scoped_ptr<SpdyFrame> settings_frame( |
1553 spdy_util_.ConstructSpdySettings(settings)); | 1553 spdy_util_.ConstructSpdySettings(settings)); |
1554 scoped_ptr<SpdyFrame> initial_window_update( | 1554 scoped_ptr<SpdyFrame> initial_window_update( |
1555 spdy_util_.ConstructSpdyWindowUpdate( | 1555 spdy_util_.ConstructSpdyWindowUpdate( |
1556 kSessionFlowControlStreamId, | 1556 kSessionFlowControlStreamId, |
1557 kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); | 1557 kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); |
1558 std::vector<MockWrite> writes; | 1558 std::vector<MockWrite> writes; |
1559 if (GetParam() == kProtoSPDY4) { | 1559 if ((GetParam() >= kProtoSPDY4MinimumVersion) && |
| 1560 (GetParam() <= kProtoSPDY4MaximumVersion)) { |
1560 writes.push_back( | 1561 writes.push_back( |
1561 MockWrite(ASYNC, | 1562 MockWrite(ASYNC, |
1562 kHttp2ConnectionHeaderPrefix, | 1563 kHttp2ConnectionHeaderPrefix, |
1563 kHttp2ConnectionHeaderPrefixSize)); | 1564 kHttp2ConnectionHeaderPrefixSize)); |
1564 } | 1565 } |
1565 writes.push_back(CreateMockWrite(*settings_frame)); | 1566 writes.push_back(CreateMockWrite(*settings_frame)); |
1566 if (GetParam() >= kProtoSPDY31) { | 1567 if (GetParam() >= kProtoSPDY31) { |
1567 writes.push_back(CreateMockWrite(*initial_window_update)); | 1568 writes.push_back(CreateMockWrite(*initial_window_update)); |
1568 }; | 1569 }; |
1569 | 1570 |
(...skipping 3563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5133 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5134 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
5134 "spdy_pooling.pem"); | 5135 "spdy_pooling.pem"); |
5135 ssl_info.is_issued_by_known_root = true; | 5136 ssl_info.is_issued_by_known_root = true; |
5136 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5137 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
5137 | 5138 |
5138 EXPECT_TRUE(SpdySession::CanPool( | 5139 EXPECT_TRUE(SpdySession::CanPool( |
5139 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5140 &tss, ssl_info, "www.example.org", "mail.example.org")); |
5140 } | 5141 } |
5141 | 5142 |
5142 } // namespace net | 5143 } // namespace net |
OLD | NEW |