| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/stateless_rejector.h" | 5 #include "net/tools/quic/stateless_rejector.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "net/quic/core/crypto/crypto_handshake_message.h" | 11 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| 12 #include "net/quic/core/crypto/proof_source.h" | 12 #include "net/quic/core/crypto/proof_source.h" |
| 13 #include "net/quic/core/quic_utils.h" | 13 #include "net/quic/core/quic_utils.h" |
| 14 #include "net/quic/platform/api/quic_logging.h" |
| 14 #include "net/quic/platform/api/quic_str_cat.h" | 15 #include "net/quic/platform/api/quic_str_cat.h" |
| 15 #include "net/quic/platform/api/quic_text_utils.h" | 16 #include "net/quic/platform/api/quic_text_utils.h" |
| 16 #include "net/quic/test_tools/crypto_test_utils.h" | 17 #include "net/quic/test_tools/crypto_test_utils.h" |
| 17 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 18 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
| 18 #include "net/quic/test_tools/quic_test_utils.h" | 19 #include "net/quic/test_tools/quic_test_utils.h" |
| 19 | 20 |
| 20 using std::string; | 21 using std::string; |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 namespace test { | 24 namespace test { |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 const QuicConnectionId kConnectionId = 42; | 27 const QuicConnectionId kConnectionId = 42; |
| 27 const QuicConnectionId kServerDesignateConnectionId = 24; | 28 const QuicConnectionId kServerDesignateConnectionId = 24; |
| 28 | 29 |
| 29 // All four combinations of the two flags involved. | 30 // All four combinations of the two flags involved. |
| 30 enum FlagsMode { ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED }; | 31 enum FlagsMode { ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED }; |
| 31 | 32 |
| 32 const char* FlagsModeToString(FlagsMode mode) { | 33 const char* FlagsModeToString(FlagsMode mode) { |
| 33 switch (mode) { | 34 switch (mode) { |
| 34 case ENABLED: | 35 case ENABLED: |
| 35 return "ENABLED"; | 36 return "ENABLED"; |
| 36 case STATELESS_DISABLED: | 37 case STATELESS_DISABLED: |
| 37 return "STATELESS_DISABLED"; | 38 return "STATELESS_DISABLED"; |
| 38 case CHEAP_DISABLED: | 39 case CHEAP_DISABLED: |
| 39 return "CHEAP_DISABLED"; | 40 return "CHEAP_DISABLED"; |
| 40 case BOTH_DISABLED: | 41 case BOTH_DISABLED: |
| 41 return "BOTH_DISABLED"; | 42 return "BOTH_DISABLED"; |
| 42 default: | 43 default: |
| 43 DLOG(FATAL) << "Unexpected FlagsMode"; | 44 QUIC_DLOG(FATAL) << "Unexpected FlagsMode"; |
| 44 return nullptr; | 45 return nullptr; |
| 45 } | 46 } |
| 46 } | 47 } |
| 47 | 48 |
| 48 // Test various combinations of QUIC version and flag state. | 49 // Test various combinations of QUIC version and flag state. |
| 49 struct TestParams { | 50 struct TestParams { |
| 50 QuicVersion version; | 51 QuicVersion version; |
| 51 FlagsMode flags; | 52 FlagsMode flags; |
| 52 }; | 53 }; |
| 53 | 54 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); | 286 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); |
| 286 StatelessRejector::Process(std::move(rejector_), | 287 StatelessRejector::Process(std::move(rejector_), |
| 287 base::MakeUnique<ProcessDoneCallback>(this)); | 288 base::MakeUnique<ProcessDoneCallback>(this)); |
| 288 | 289 |
| 289 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); | 290 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); |
| 290 } | 291 } |
| 291 | 292 |
| 292 } // namespace | 293 } // namespace |
| 293 } // namespace test | 294 } // namespace test |
| 294 } // namespace net | 295 } // namespace net |
| OLD | NEW |