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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 452 } |
453 | 453 |
454 TEST_P(QuicCryptoServerStreamTest, OnlySendSCUPAfterHandshakeComplete) { | 454 TEST_P(QuicCryptoServerStreamTest, OnlySendSCUPAfterHandshakeComplete) { |
455 // An attempt to send a SCUP before completing handshake should fail. | 455 // An attempt to send a SCUP before completing handshake should fail. |
456 Initialize(); | 456 Initialize(); |
457 | 457 |
458 server_stream()->SendServerConfigUpdate(nullptr); | 458 server_stream()->SendServerConfigUpdate(nullptr); |
459 EXPECT_EQ(0, server_stream()->NumServerConfigUpdateMessagesSent()); | 459 EXPECT_EQ(0, server_stream()->NumServerConfigUpdateMessagesSent()); |
460 } | 460 } |
461 | 461 |
| 462 TEST_P(QuicCryptoServerStreamTest, SendSCUPAfterHandshakeComplete) { |
| 463 FLAGS_quic_use_hash_in_scup = true; |
| 464 Initialize(); |
| 465 |
| 466 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 467 |
| 468 // Do a first handshake in order to prime the client config with the server's |
| 469 // information. |
| 470 AdvanceHandshakeWithFakeClient(); |
| 471 |
| 472 // Now do another handshake, with the blocking SHLO connection option. |
| 473 InitializeServer(); |
| 474 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 475 AdvanceHandshakeWithFakeClient(); |
| 476 |
| 477 // Send a SCUP message and ensure that the client was able to verify it. |
| 478 EXPECT_CALL(*client_connection_, CloseConnection(_, _, _)).Times(0); |
| 479 server_stream()->SendServerConfigUpdate(nullptr); |
| 480 CryptoTestUtils::AdvanceHandshake(client_connection_, client_stream(), 1, |
| 481 server_connection_, server_stream(), 1); |
| 482 |
| 483 EXPECT_EQ(1, server_stream()->NumServerConfigUpdateMessagesSent()); |
| 484 EXPECT_EQ(1, client_stream()->num_scup_messages_received()); |
| 485 } |
| 486 |
462 TEST_P(QuicCryptoServerStreamTest, DoesPeerSupportStatelessRejects) { | 487 TEST_P(QuicCryptoServerStreamTest, DoesPeerSupportStatelessRejects) { |
463 Initialize(); | 488 Initialize(); |
464 | 489 |
465 ConstructHandshakeMessage(); | 490 ConstructHandshakeMessage(); |
466 QuicConfig stateless_reject_config = DefaultQuicConfigStatelessRejects(); | 491 QuicConfig stateless_reject_config = DefaultQuicConfigStatelessRejects(); |
467 stateless_reject_config.ToHandshakeMessage(&message_); | 492 stateless_reject_config.ToHandshakeMessage(&message_); |
468 EXPECT_TRUE( | 493 EXPECT_TRUE( |
469 QuicCryptoServerStreamPeer::DoesPeerSupportStatelessRejects(message_)); | 494 QuicCryptoServerStreamPeer::DoesPeerSupportStatelessRejects(message_)); |
470 | 495 |
471 message_.Clear(); | 496 message_.Clear(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 QUIC_NO_ERROR, "", ConnectionCloseBehavior::SILENT_CLOSE); | 561 QUIC_NO_ERROR, "", ConnectionCloseBehavior::SILENT_CLOSE); |
537 | 562 |
538 // The outstanding nonce verification RPC now completes. | 563 // The outstanding nonce verification RPC now completes. |
539 strike_register_client_->RunPendingVerifications(); | 564 strike_register_client_->RunPendingVerifications(); |
540 } | 565 } |
541 | 566 |
542 } // namespace | 567 } // namespace |
543 | 568 |
544 } // namespace test | 569 } // namespace test |
545 } // namespace net | 570 } // namespace net |
OLD | NEW |