| 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 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 ASSERT_TRUE(client_state->IsComplete(QuicWallTime::FromUNIXSeconds(0))); | 326 ASSERT_TRUE(client_state->IsComplete(QuicWallTime::FromUNIXSeconds(0))); |
| 327 } | 327 } |
| 328 | 328 |
| 329 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { | 329 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { |
| 330 Initialize(); | 330 Initialize(); |
| 331 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 331 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 332 | 332 |
| 333 // Do a first handshake in order to prime the client config with the server's | 333 // Do a first handshake in order to prime the client config with the server's |
| 334 // information. | 334 // information. |
| 335 AdvanceHandshakeWithFakeClient(); | 335 AdvanceHandshakeWithFakeClient(); |
| 336 EXPECT_FALSE(server_stream()->ZeroRttAttempted()); |
| 336 | 337 |
| 337 // Now do another handshake, hopefully in 0-RTT. | 338 // Now do another handshake, hopefully in 0-RTT. |
| 338 QUIC_LOG(INFO) << "Resetting for 0-RTT handshake attempt"; | 339 QUIC_LOG(INFO) << "Resetting for 0-RTT handshake attempt"; |
| 339 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 340 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 340 InitializeServer(); | 341 InitializeServer(); |
| 341 | 342 |
| 342 client_stream()->CryptoConnect(); | 343 client_stream()->CryptoConnect(); |
| 343 | 344 |
| 344 crypto_test_utils::CommunicateHandshakeMessages( | 345 crypto_test_utils::CommunicateHandshakeMessages( |
| 345 client_connection_, client_stream(), server_connection_, server_stream()); | 346 client_connection_, client_stream(), server_connection_, server_stream()); |
| 346 | 347 |
| 347 EXPECT_EQ(1, client_stream()->num_sent_client_hellos()); | 348 EXPECT_EQ(1, client_stream()->num_sent_client_hellos()); |
| 349 EXPECT_TRUE(server_stream()->ZeroRttAttempted()); |
| 348 } | 350 } |
| 349 | 351 |
| 350 TEST_P(QuicCryptoServerStreamTest, FailByPolicy) { | 352 TEST_P(QuicCryptoServerStreamTest, FailByPolicy) { |
| 351 Initialize(); | 353 Initialize(); |
| 352 InitializeFakeClient(/* supports_stateless_rejects= */ false); | 354 InitializeFakeClient(/* supports_stateless_rejects= */ false); |
| 353 | 355 |
| 354 EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _)) | 356 EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _)) |
| 355 .WillOnce(testing::Return(false)); | 357 .WillOnce(testing::Return(false)); |
| 356 EXPECT_CALL(*server_connection_, | 358 EXPECT_CALL(*server_connection_, |
| 357 CloseConnection(QUIC_HANDSHAKE_FAILED, _, _)); | 359 CloseConnection(QUIC_HANDSHAKE_FAILED, _, _)); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 EXPECT_CALL( | 555 EXPECT_CALL( |
| 554 *server_connection_, | 556 *server_connection_, |
| 555 CloseConnection(QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, | 557 CloseConnection(QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, |
| 556 "Unexpected handshake message while processing CHLO", _)); | 558 "Unexpected handshake message while processing CHLO", _)); |
| 557 server_stream()->OnHandshakeMessage(chlo); | 559 server_stream()->OnHandshakeMessage(chlo); |
| 558 } | 560 } |
| 559 | 561 |
| 560 } // namespace | 562 } // namespace |
| 561 } // namespace test | 563 } // namespace test |
| 562 } // namespace net | 564 } // namespace net |
| OLD | NEW |