| 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/quic_crypto_server_stream.h" | 5 #include "net/quic/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 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // CompleteCryptoHandshake returns the number of client hellos sent. This | 227 // CompleteCryptoHandshake returns the number of client hellos sent. This |
| 228 // test should send: | 228 // test should send: |
| 229 // * One to get a source-address token and certificates. | 229 // * One to get a source-address token and certificates. |
| 230 // * One to complete the handshake. | 230 // * One to complete the handshake. |
| 231 Initialize(); | 231 Initialize(); |
| 232 EXPECT_EQ(2, CompleteCryptoHandshake()); | 232 EXPECT_EQ(2, CompleteCryptoHandshake()); |
| 233 EXPECT_TRUE(server_stream()->encryption_established()); | 233 EXPECT_TRUE(server_stream()->encryption_established()); |
| 234 EXPECT_TRUE(server_stream()->handshake_confirmed()); | 234 EXPECT_TRUE(server_stream()->handshake_confirmed()); |
| 235 } | 235 } |
| 236 | 236 |
| 237 TEST_P(QuicCryptoServerStreamTest, EncryptionLevelAfterCHLO) { |
| 238 Initialize(); |
| 239 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 240 |
| 241 // Do a first handshake in order to prime the client config with the server's |
| 242 // information. |
| 243 AdvanceHandshakeWithFakeClient(); |
| 244 EXPECT_FALSE(server_stream()->encryption_established()); |
| 245 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
| 246 |
| 247 // Now do another handshake, with the blocking SHLO connection option. |
| 248 InitializeServer(); |
| 249 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 250 client_session_->config()->SetConnectionOptionsToSend({kIPFS}); |
| 251 |
| 252 AdvanceHandshakeWithFakeClient(); |
| 253 EXPECT_TRUE(server_stream()->encryption_established()); |
| 254 EXPECT_TRUE(server_stream()->handshake_confirmed()); |
| 255 EXPECT_EQ(ENCRYPTION_FORWARD_SECURE, |
| 256 server_session_->connection()->encryption_level()); |
| 257 } |
| 258 |
| 237 TEST_P(QuicCryptoServerStreamTest, StatelessRejectAfterCHLO) { | 259 TEST_P(QuicCryptoServerStreamTest, StatelessRejectAfterCHLO) { |
| 238 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stateless_reject_support, | 260 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stateless_reject_support, |
| 239 true); | 261 true); |
| 240 Initialize(); | 262 Initialize(); |
| 241 | 263 |
| 242 EXPECT_CALL(*server_connection_, | 264 EXPECT_CALL(*server_connection_, |
| 243 CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, _, _)); | 265 CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, _, _)); |
| 244 | 266 |
| 245 InitializeFakeClient(/* supports_stateless_rejects= */ true); | 267 InitializeFakeClient(/* supports_stateless_rejects= */ true); |
| 246 AdvanceHandshakeWithFakeClient(); | 268 AdvanceHandshakeWithFakeClient(); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 QUIC_NO_ERROR, "", ConnectionCloseBehavior::SILENT_CLOSE); | 545 QUIC_NO_ERROR, "", ConnectionCloseBehavior::SILENT_CLOSE); |
| 524 | 546 |
| 525 // The outstanding nonce verification RPC now completes. | 547 // The outstanding nonce verification RPC now completes. |
| 526 strike_register_client_->RunPendingVerifications(); | 548 strike_register_client_->RunPendingVerifications(); |
| 527 } | 549 } |
| 528 | 550 |
| 529 } // namespace | 551 } // namespace |
| 530 | 552 |
| 531 } // namespace test | 553 } // namespace test |
| 532 } // namespace net | 554 } // namespace net |
| OLD | NEW |