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/quic/core/quic_crypto_server_stream.h" | 5 #include "net/quic/core/quic_crypto_server_stream.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" | 12 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" |
13 #include "net/quic/core/crypto/crypto_framer.h" | 13 #include "net/quic/core/crypto/crypto_framer.h" |
14 #include "net/quic/core/crypto/crypto_handshake.h" | 14 #include "net/quic/core/crypto/crypto_handshake.h" |
15 #include "net/quic/core/crypto/crypto_protocol.h" | 15 #include "net/quic/core/crypto/crypto_protocol.h" |
16 #include "net/quic/core/crypto/crypto_utils.h" | 16 #include "net/quic/core/crypto/crypto_utils.h" |
17 #include "net/quic/core/crypto/quic_crypto_server_config.h" | 17 #include "net/quic/core/crypto/quic_crypto_server_config.h" |
18 #include "net/quic/core/crypto/quic_decrypter.h" | 18 #include "net/quic/core/crypto/quic_decrypter.h" |
19 #include "net/quic/core/crypto/quic_encrypter.h" | 19 #include "net/quic/core/crypto/quic_encrypter.h" |
20 #include "net/quic/core/crypto/quic_random.h" | 20 #include "net/quic/core/crypto/quic_random.h" |
21 #include "net/quic/core/quic_crypto_client_stream.h" | 21 #include "net/quic/core/quic_crypto_client_stream.h" |
22 #include "net/quic/core/quic_flags.h" | 22 #include "net/quic/core/quic_flags.h" |
23 #include "net/quic/core/quic_protocol.h" | 23 #include "net/quic/core/quic_protocol.h" |
24 #include "net/quic/core/quic_session.h" | 24 #include "net/quic/core/quic_session.h" |
25 #include "net/quic/test_tools/crypto_test_utils.h" | 25 #include "net/quic/test_tools/crypto_test_utils.h" |
26 #include "net/quic/test_tools/delayed_verify_strike_register_client.h" | |
27 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 26 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
28 #include "net/quic/test_tools/quic_test_utils.h" | 27 #include "net/quic/test_tools/quic_test_utils.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
31 | 30 |
32 namespace net { | 31 namespace net { |
33 class QuicConnection; | 32 class QuicConnection; |
34 class QuicStream; | 33 class QuicStream; |
35 } // namespace net | 34 } // namespace net |
36 | 35 |
(...skipping 24 matching lines...) Expand all Loading... |
61 | 60 |
62 explicit QuicCryptoServerStreamTest(std::unique_ptr<ProofSource> proof_source) | 61 explicit QuicCryptoServerStreamTest(std::unique_ptr<ProofSource> proof_source) |
63 : server_crypto_config_(QuicCryptoServerConfig::TESTING, | 62 : server_crypto_config_(QuicCryptoServerConfig::TESTING, |
64 QuicRandom::GetInstance(), | 63 QuicRandom::GetInstance(), |
65 std::move(proof_source)), | 64 std::move(proof_source)), |
66 server_compressed_certs_cache_( | 65 server_compressed_certs_cache_( |
67 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), | 66 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), |
68 server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), | 67 server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), |
69 client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { | 68 client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { |
70 FLAGS_enable_quic_stateless_reject_support = false; | 69 FLAGS_enable_quic_stateless_reject_support = false; |
71 server_crypto_config_.set_strike_register_no_startup_period(); | |
72 } | 70 } |
73 | 71 |
74 void Initialize() { InitializeServer(); } | 72 void Initialize() { InitializeServer(); } |
75 | 73 |
76 ~QuicCryptoServerStreamTest() override { | 74 ~QuicCryptoServerStreamTest() override { |
77 // Ensure that anything that might reference |helpers_| is destroyed before | 75 // Ensure that anything that might reference |helpers_| is destroyed before |
78 // |helpers_| is destroyed. | 76 // |helpers_| is destroyed. |
79 server_session_.reset(); | 77 server_session_.reset(); |
80 client_session_.reset(); | 78 client_session_.reset(); |
81 helpers_.clear(); | 79 helpers_.clear(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 QuicServerId server_id_; | 165 QuicServerId server_id_; |
168 | 166 |
169 // Client state. | 167 // Client state. |
170 PacketSavingConnection* client_connection_; | 168 PacketSavingConnection* client_connection_; |
171 QuicCryptoClientConfig client_crypto_config_; | 169 QuicCryptoClientConfig client_crypto_config_; |
172 std::unique_ptr<TestQuicSpdyClientSession> client_session_; | 170 std::unique_ptr<TestQuicSpdyClientSession> client_session_; |
173 | 171 |
174 CryptoHandshakeMessage message_; | 172 CryptoHandshakeMessage message_; |
175 std::unique_ptr<QuicData> message_data_; | 173 std::unique_ptr<QuicData> message_data_; |
176 CryptoTestUtils::FakeClientOptions client_options_; | 174 CryptoTestUtils::FakeClientOptions client_options_; |
177 DelayedVerifyStrikeRegisterClient* strike_register_client_; | |
178 | 175 |
179 // Which QUIC versions the client and server support. | 176 // Which QUIC versions the client and server support. |
180 QuicVersionVector supported_versions_ = AllSupportedVersions(); | 177 QuicVersionVector supported_versions_ = AllSupportedVersions(); |
181 }; | 178 }; |
182 | 179 |
183 INSTANTIATE_TEST_CASE_P(Tests, QuicCryptoServerStreamTest, testing::Bool()); | 180 INSTANTIATE_TEST_CASE_P(Tests, QuicCryptoServerStreamTest, testing::Bool()); |
184 | 181 |
185 TEST_P(QuicCryptoServerStreamTest, NotInitiallyConected) { | 182 TEST_P(QuicCryptoServerStreamTest, NotInitiallyConected) { |
186 Initialize(); | 183 Initialize(); |
187 EXPECT_FALSE(server_stream()->encryption_established()); | 184 EXPECT_FALSE(server_stream()->encryption_established()); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 // Regression test for b/31521252, in which a crash would happen here. | 519 // Regression test for b/31521252, in which a crash would happen here. |
523 AdvanceHandshakeWithFakeClient(); | 520 AdvanceHandshakeWithFakeClient(); |
524 EXPECT_FALSE(server_stream()->encryption_established()); | 521 EXPECT_FALSE(server_stream()->encryption_established()); |
525 EXPECT_FALSE(server_stream()->handshake_confirmed()); | 522 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
526 } | 523 } |
527 | 524 |
528 } // namespace | 525 } // namespace |
529 | 526 |
530 } // namespace test | 527 } // namespace test |
531 } // namespace net | 528 } // namespace net |
OLD | NEW |