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 16 matching lines...) Expand all Loading... |
27 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 27 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
28 #include "net/quic/test_tools/quic_test_utils.h" | 28 #include "net/quic/test_tools/quic_test_utils.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 | 31 |
32 namespace net { | 32 namespace net { |
33 class QuicConnection; | 33 class QuicConnection; |
34 class ReliableQuicStream; | 34 class ReliableQuicStream; |
35 } // namespace net | 35 } // namespace net |
36 | 36 |
37 using std::pair; | |
38 using std::string; | 37 using std::string; |
39 using testing::_; | 38 using testing::_; |
40 | 39 |
41 namespace net { | 40 namespace net { |
42 namespace test { | 41 namespace test { |
43 | 42 |
44 class QuicCryptoServerStreamPeer { | 43 class QuicCryptoServerStreamPeer { |
45 public: | 44 public: |
46 static bool DoesPeerSupportStatelessRejects( | 45 static bool DoesPeerSupportStatelessRejects( |
47 const CryptoHandshakeMessage& message) { | 46 const CryptoHandshakeMessage& message) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 InitializeServer(); | 364 InitializeServer(); |
366 | 365 |
367 client_stream()->CryptoConnect(); | 366 client_stream()->CryptoConnect(); |
368 | 367 |
369 if (AsyncStrikeRegisterVerification()) { | 368 if (AsyncStrikeRegisterVerification()) { |
370 EXPECT_FALSE(client_stream()->handshake_confirmed()); | 369 EXPECT_FALSE(client_stream()->handshake_confirmed()); |
371 EXPECT_FALSE(server_stream()->handshake_confirmed()); | 370 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
372 | 371 |
373 // Advance the handshake. Expect that the server will be stuck waiting for | 372 // Advance the handshake. Expect that the server will be stuck waiting for |
374 // client nonce verification to complete. | 373 // client nonce verification to complete. |
375 pair<size_t, size_t> messages_moved = CryptoTestUtils::AdvanceHandshake( | 374 std::pair<size_t, size_t> messages_moved = |
376 client_connection_, client_stream(), 0, server_connection_, | 375 CryptoTestUtils::AdvanceHandshake(client_connection_, client_stream(), |
377 server_stream(), 0); | 376 0, server_connection_, |
| 377 server_stream(), 0); |
378 EXPECT_EQ(1u, messages_moved.first); | 378 EXPECT_EQ(1u, messages_moved.first); |
379 EXPECT_EQ(0u, messages_moved.second); | 379 EXPECT_EQ(0u, messages_moved.second); |
380 EXPECT_EQ(1, strike_register_client_->PendingVerifications()); | 380 EXPECT_EQ(1, strike_register_client_->PendingVerifications()); |
381 EXPECT_FALSE(client_stream()->handshake_confirmed()); | 381 EXPECT_FALSE(client_stream()->handshake_confirmed()); |
382 EXPECT_FALSE(server_stream()->handshake_confirmed()); | 382 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
383 | 383 |
384 // The server handshake completes once the nonce verification completes. | 384 // The server handshake completes once the nonce verification completes. |
385 strike_register_client_->RunPendingVerifications(); | 385 strike_register_client_->RunPendingVerifications(); |
386 EXPECT_FALSE(client_stream()->handshake_confirmed()); | 386 EXPECT_FALSE(client_stream()->handshake_confirmed()); |
387 EXPECT_TRUE(server_stream()->handshake_confirmed()); | 387 EXPECT_TRUE(server_stream()->handshake_confirmed()); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 // Regression test for b/31521252, in which a crash would happen here. | 618 // Regression test for b/31521252, in which a crash would happen here. |
619 AdvanceHandshakeWithFakeClient(); | 619 AdvanceHandshakeWithFakeClient(); |
620 EXPECT_FALSE(server_stream()->encryption_established()); | 620 EXPECT_FALSE(server_stream()->encryption_established()); |
621 EXPECT_FALSE(server_stream()->handshake_confirmed()); | 621 EXPECT_FALSE(server_stream()->handshake_confirmed()); |
622 } | 622 } |
623 | 623 |
624 } // namespace | 624 } // namespace |
625 | 625 |
626 } // namespace test | 626 } // namespace test |
627 } // namespace net | 627 } // namespace net |
OLD | NEW |