| 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 "net/quic/core/crypto/crypto_handshake_message.h" | 10 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 friend ostream& operator<<(ostream& os, const TestParams& p) { | 35 friend ostream& operator<<(ostream& os, const TestParams& p) { |
| 36 os << "{ version: " << p.version << " flags: " << p.flags << " }"; | 36 os << "{ version: " << p.version << " flags: " << p.flags << " }"; |
| 37 return os; | 37 return os; |
| 38 } | 38 } |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 vector<TestParams> GetTestParams() { | 41 vector<TestParams> GetTestParams() { |
| 42 vector<TestParams> params; | 42 vector<TestParams> params; |
| 43 for (FlagsMode flags : | 43 for (FlagsMode flags : |
| 44 {ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED}) { | 44 {ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED}) { |
| 45 for (QuicVersion version : QuicSupportedVersions()) { | 45 for (QuicVersion version : AllSupportedVersions()) { |
| 46 TestParams param; | 46 TestParams param; |
| 47 param.version = version; | 47 param.version = version; |
| 48 param.flags = flags; | 48 param.flags = flags; |
| 49 params.push_back(param); | 49 params.push_back(param); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 return params; | 52 return params; |
| 53 } | 53 } |
| 54 | 54 |
| 55 class StatelessRejectorTest : public ::testing::TestWithParam<TestParams> { | 55 class StatelessRejectorTest : public ::testing::TestWithParam<TestParams> { |
| 56 public: | 56 public: |
| 57 StatelessRejectorTest() | 57 StatelessRejectorTest() |
| 58 : proof_source_(CryptoTestUtils::ProofSourceForTesting()), | 58 : proof_source_(CryptoTestUtils::ProofSourceForTesting()), |
| 59 config_(QuicCryptoServerConfig::TESTING, | 59 config_(QuicCryptoServerConfig::TESTING, |
| 60 QuicRandom::GetInstance(), | 60 QuicRandom::GetInstance(), |
| 61 CryptoTestUtils::ProofSourceForTesting()), | 61 CryptoTestUtils::ProofSourceForTesting()), |
| 62 config_peer_(&config_), | 62 config_peer_(&config_), |
| 63 compressed_certs_cache_( | 63 compressed_certs_cache_( |
| 64 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), | 64 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), |
| 65 rejector_(GetParam().version, | 65 rejector_(GetParam().version, |
| 66 QuicSupportedVersions(), | 66 AllSupportedVersions(), |
| 67 &config_, | 67 &config_, |
| 68 &compressed_certs_cache_, | 68 &compressed_certs_cache_, |
| 69 &clock_, | 69 &clock_, |
| 70 QuicRandom::GetInstance(), | 70 QuicRandom::GetInstance(), |
| 71 kDefaultMaxPacketSize, | 71 kDefaultMaxPacketSize, |
| 72 IPEndPoint(net::test::Loopback4(), 12345), | 72 IPEndPoint(net::test::Loopback4(), 12345), |
| 73 IPEndPoint(net::test::Loopback4(), 443)) { | 73 IPEndPoint(net::test::Loopback4(), 443)) { |
| 74 FLAGS_enable_quic_stateless_reject_support = | 74 FLAGS_enable_quic_stateless_reject_support = |
| 75 GetParam().flags == ENABLED || GetParam().flags == CHEAP_DISABLED; | 75 GetParam().flags == ENABLED || GetParam().flags == CHEAP_DISABLED; |
| 76 FLAGS_quic_use_cheap_stateless_rejects = | 76 FLAGS_quic_use_cheap_stateless_rejects = |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (GetParam().flags != ENABLED || GetParam().version <= QUIC_VERSION_32) { | 233 if (GetParam().flags != ENABLED || GetParam().version <= QUIC_VERSION_32) { |
| 234 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_.state()); | 234 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_.state()); |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_.state()); | 237 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_.state()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace | 240 } // namespace |
| 241 } // namespace test | 241 } // namespace test |
| 242 } // namespace net | 242 } // namespace net |
| OLD | NEW |