| 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 "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "net/quic/core/crypto/crypto_handshake_message.h" | 12 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| 13 #include "net/quic/core/crypto/proof_source.h" | 13 #include "net/quic/core/crypto/proof_source.h" |
| 14 #include "net/quic/core/quic_utils.h" | 14 #include "net/quic/core/quic_utils.h" |
| 15 #include "net/quic/test_tools/crypto_test_utils.h" | 15 #include "net/quic/test_tools/crypto_test_utils.h" |
| 16 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" | 16 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" |
| 17 #include "net/quic/test_tools/quic_test_utils.h" | 17 #include "net/quic/test_tools/quic_test_utils.h" |
| 18 | 18 |
| 19 using std::ostream; | 19 using std::ostream; |
| 20 using std::string; | 20 using std::string; |
| 21 using std::vector; | |
| 22 | 21 |
| 23 namespace net { | 22 namespace net { |
| 24 namespace test { | 23 namespace test { |
| 25 namespace { | 24 namespace { |
| 26 | 25 |
| 27 const QuicConnectionId kConnectionId = 42; | 26 const QuicConnectionId kConnectionId = 42; |
| 28 const QuicConnectionId kServerDesignateConnectionId = 24; | 27 const QuicConnectionId kServerDesignateConnectionId = 24; |
| 29 | 28 |
| 30 // All four combinations of the two flags involved. | 29 // All four combinations of the two flags involved. |
| 31 enum FlagsMode { ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED }; | 30 enum FlagsMode { ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 struct TestParams { | 49 struct TestParams { |
| 51 QuicVersion version; | 50 QuicVersion version; |
| 52 FlagsMode flags; | 51 FlagsMode flags; |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 string TestParamToString(const testing::TestParamInfo<TestParams>& params) { | 54 string TestParamToString(const testing::TestParamInfo<TestParams>& params) { |
| 56 return base::StringPrintf("v%i_%s", params.param.version, | 55 return base::StringPrintf("v%i_%s", params.param.version, |
| 57 FlagsModeToString(params.param.flags)); | 56 FlagsModeToString(params.param.flags)); |
| 58 } | 57 } |
| 59 | 58 |
| 60 vector<TestParams> GetTestParams() { | 59 std::vector<TestParams> GetTestParams() { |
| 61 vector<TestParams> params; | 60 std::vector<TestParams> params; |
| 62 for (FlagsMode flags : | 61 for (FlagsMode flags : |
| 63 {ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED}) { | 62 {ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED}) { |
| 64 for (QuicVersion version : AllSupportedVersions()) { | 63 for (QuicVersion version : AllSupportedVersions()) { |
| 65 TestParams param; | 64 TestParams param; |
| 66 param.version = version; | 65 param.version = version; |
| 67 param.flags = flags; | 66 param.flags = flags; |
| 68 params.push_back(param); | 67 params.push_back(param); |
| 69 } | 68 } |
| 70 } | 69 } |
| 71 return params; | 70 return params; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); | 283 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); |
| 285 StatelessRejector::Process(std::move(rejector_), | 284 StatelessRejector::Process(std::move(rejector_), |
| 286 base::MakeUnique<ProcessDoneCallback>(this)); | 285 base::MakeUnique<ProcessDoneCallback>(this)); |
| 287 | 286 |
| 288 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); | 287 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); |
| 289 } | 288 } |
| 290 | 289 |
| 291 } // namespace | 290 } // namespace |
| 292 } // namespace test | 291 } // namespace test |
| 293 } // namespace net | 292 } // namespace net |
| OLD | NEW |