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/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 using base::IntToString; | 40 using base::IntToString; |
41 using base::StringPiece; | 41 using base::StringPiece; |
42 using net::EpollServer; | 42 using net::EpollServer; |
43 using net::test::ConstructEncryptedPacket; | 43 using net::test::ConstructEncryptedPacket; |
44 using net::test::CryptoTestUtils; | 44 using net::test::CryptoTestUtils; |
45 using net::test::MockQuicConnection; | 45 using net::test::MockQuicConnection; |
46 using net::test::MockQuicConnectionHelper; | 46 using net::test::MockQuicConnectionHelper; |
47 using std::ostream; | 47 using std::ostream; |
48 using std::string; | 48 using std::string; |
49 using std::vector; | |
50 using testing::CreateFunctor; | 49 using testing::CreateFunctor; |
51 using testing::DoAll; | 50 using testing::DoAll; |
52 using testing::InSequence; | 51 using testing::InSequence; |
53 using testing::Invoke; | 52 using testing::Invoke; |
54 using testing::Return; | 53 using testing::Return; |
55 using testing::WithoutArgs; | 54 using testing::WithoutArgs; |
56 using testing::_; | 55 using testing::_; |
57 | 56 |
58 static const size_t kDefaultMaxConnectionsInStore = 100; | 57 static const size_t kDefaultMaxConnectionsInStore = 100; |
59 static const size_t kMaxConnectionsWithoutCHLO = | 58 static const size_t kMaxConnectionsWithoutCHLO = |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 // This only enables the stateless reject feature via the feature-flag. | 579 // This only enables the stateless reject feature via the feature-flag. |
581 // This should be a no-op if the peer does not support them. | 580 // This should be a no-op if the peer does not support them. |
582 bool enable_stateless_rejects_via_flag; | 581 bool enable_stateless_rejects_via_flag; |
583 // Whether or not the client supports stateless rejects. | 582 // Whether or not the client supports stateless rejects. |
584 bool client_supports_statelesss_rejects; | 583 bool client_supports_statelesss_rejects; |
585 // Should the initial crypto handshake succeed or not. | 584 // Should the initial crypto handshake succeed or not. |
586 bool crypto_handshake_successful; | 585 bool crypto_handshake_successful; |
587 }; | 586 }; |
588 | 587 |
589 // Constructs various test permutations for stateless rejects. | 588 // Constructs various test permutations for stateless rejects. |
590 vector<StatelessRejectTestParams> GetStatelessRejectTestParams() { | 589 std::vector<StatelessRejectTestParams> GetStatelessRejectTestParams() { |
591 vector<StatelessRejectTestParams> params; | 590 std::vector<StatelessRejectTestParams> params; |
592 for (bool enable_stateless_rejects_via_flag : {true, false}) { | 591 for (bool enable_stateless_rejects_via_flag : {true, false}) { |
593 for (bool client_supports_statelesss_rejects : {true, false}) { | 592 for (bool client_supports_statelesss_rejects : {true, false}) { |
594 for (bool crypto_handshake_successful : {true, false}) { | 593 for (bool crypto_handshake_successful : {true, false}) { |
595 params.push_back(StatelessRejectTestParams( | 594 params.push_back(StatelessRejectTestParams( |
596 enable_stateless_rejects_via_flag, | 595 enable_stateless_rejects_via_flag, |
597 client_supports_statelesss_rejects, crypto_handshake_successful)); | 596 client_supports_statelesss_rejects, crypto_handshake_successful)); |
598 } | 597 } |
599 } | 598 } |
600 } | 599 } |
601 return params; | 600 return params; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 return os; | 1075 return os; |
1077 } | 1076 } |
1078 | 1077 |
1079 // This only enables the stateless reject feature via the feature-flag. | 1078 // This only enables the stateless reject feature via the feature-flag. |
1080 // This should be a no-op if the peer does not support them. | 1079 // This should be a no-op if the peer does not support them. |
1081 bool enable_stateless_rejects_via_flag; | 1080 bool enable_stateless_rejects_via_flag; |
1082 // Whether to do cheap stateless or not. | 1081 // Whether to do cheap stateless or not. |
1083 bool support_cheap_stateless_reject; | 1082 bool support_cheap_stateless_reject; |
1084 }; | 1083 }; |
1085 | 1084 |
1086 vector<BufferedPacketStoreTestParams> GetBufferedPacketStoreTestParams() { | 1085 std::vector<BufferedPacketStoreTestParams> GetBufferedPacketStoreTestParams() { |
1087 vector<BufferedPacketStoreTestParams> params; | 1086 std::vector<BufferedPacketStoreTestParams> params; |
1088 for (bool enable_stateless_rejects_via_flag : {true, false}) { | 1087 for (bool enable_stateless_rejects_via_flag : {true, false}) { |
1089 for (bool support_cheap_stateless_reject : {true, false}) { | 1088 for (bool support_cheap_stateless_reject : {true, false}) { |
1090 params.push_back(BufferedPacketStoreTestParams( | 1089 params.push_back(BufferedPacketStoreTestParams( |
1091 enable_stateless_rejects_via_flag, support_cheap_stateless_reject)); | 1090 enable_stateless_rejects_via_flag, support_cheap_stateless_reject)); |
1092 } | 1091 } |
1093 } | 1092 } |
1094 return params; | 1093 return params; |
1095 } | 1094 } |
1096 | 1095 |
1097 // A dispatcher whose stateless rejector will always ACCEPTs CHLO. | 1096 // A dispatcher whose stateless rejector will always ACCEPTs CHLO. |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 check.Call(2); | 2023 check.Call(2); |
2025 GetFakeProofSource()->InvokePendingCallback(0); | 2024 GetFakeProofSource()->InvokePendingCallback(0); |
2026 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); | 2025 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); |
2027 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); | 2026 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); |
2028 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); | 2027 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); |
2029 } | 2028 } |
2030 | 2029 |
2031 } // namespace | 2030 } // namespace |
2032 } // namespace test | 2031 } // namespace test |
2033 } // namespace net | 2032 } // namespace net |
OLD | NEW |