| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <ostream> | 5 #include <ostream> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "crypto/secure_hash.h" | 10 #include "crypto/secure_hash.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 return params; | 87 return params; |
| 88 } | 88 } |
| 89 | 89 |
| 90 class CryptoServerTest : public ::testing::TestWithParam<TestParams> { | 90 class CryptoServerTest : public ::testing::TestWithParam<TestParams> { |
| 91 public: | 91 public: |
| 92 CryptoServerTest() | 92 CryptoServerTest() |
| 93 : rand_(QuicRandom::GetInstance()), | 93 : rand_(QuicRandom::GetInstance()), |
| 94 client_address_(Loopback4(), 1234), | 94 client_address_(Loopback4(), 1234), |
| 95 config_(QuicCryptoServerConfig::TESTING, rand_) { | 95 config_(QuicCryptoServerConfig::TESTING, rand_) { |
| 96 #if defined(USE_OPENSSL) |
| 96 config_.SetProofSource(CryptoTestUtils::ProofSourceForTesting()); | 97 config_.SetProofSource(CryptoTestUtils::ProofSourceForTesting()); |
| 98 #else |
| 99 config_.SetProofSource(CryptoTestUtils::FakeProofSourceForTesting()); |
| 100 #endif |
| 97 supported_versions_ = QuicSupportedVersions(); | 101 supported_versions_ = QuicSupportedVersions(); |
| 98 client_version_ = QuicUtils::TagToString( | 102 client_version_ = QuicUtils::TagToString( |
| 99 QuicVersionToQuicTag(supported_versions_.front())); | 103 QuicVersionToQuicTag(supported_versions_.front())); |
| 100 | 104 |
| 101 FLAGS_use_early_return_when_verifying_chlo = | 105 FLAGS_use_early_return_when_verifying_chlo = |
| 102 GetParam().use_early_return_when_verifying_chlo; | 106 GetParam().use_early_return_when_verifying_chlo; |
| 103 FLAGS_enable_quic_stateless_reject_support = | 107 FLAGS_enable_quic_stateless_reject_support = |
| 104 GetParam().enable_stateless_rejects; | 108 GetParam().enable_stateless_rejects; |
| 105 use_stateless_rejects_ = GetParam().use_stateless_rejects; | 109 use_stateless_rejects_ = GetParam().use_stateless_rejects; |
| 106 } | 110 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // clang-format on | 374 // clang-format on |
| 371 ShouldFailMentioning("SNI", msg); | 375 ShouldFailMentioning("SNI", msg); |
| 372 const HandshakeFailureReason kRejectReasons[] = { | 376 const HandshakeFailureReason kRejectReasons[] = { |
| 373 SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; | 377 SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; |
| 374 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); | 378 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); |
| 375 } | 379 } |
| 376 } | 380 } |
| 377 | 381 |
| 378 // TODO(rtenneti): Enable the DefaultCert test after implementing ProofSource. | 382 // TODO(rtenneti): Enable the DefaultCert test after implementing ProofSource. |
| 379 // See http://crbug.com/514472. | 383 // See http://crbug.com/514472. |
| 380 TEST_F(CryptoServerTest, DISABLED_DefaultCert) { | 384 TEST_P(CryptoServerTest, DefaultCert) { |
| 381 // Check that the server replies with a default certificate when no SNI is | 385 // Check that the server replies with a default certificate when no SNI is |
| 382 // specified. | 386 // specified. |
| 383 // clang-format off | 387 // clang-format off |
| 384 CryptoHandshakeMessage msg = CryptoTestUtils::Message( | 388 CryptoHandshakeMessage msg = CryptoTestUtils::Message( |
| 385 "CHLO", | 389 "CHLO", |
| 386 "AEAD", "AESG", | 390 "AEAD", "AESG", |
| 387 "KEXS", "C255", | 391 "KEXS", "C255", |
| 388 "SCID", scid_hex_.c_str(), | 392 "SCID", scid_hex_.c_str(), |
| 389 "#004b5453", srct_hex_.c_str(), | 393 "#004b5453", srct_hex_.c_str(), |
| 390 "PUBS", pub_hex_.c_str(), | 394 "PUBS", pub_hex_.c_str(), |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 780 |
| 777 strike_register_client_->RunPendingVerifications(); | 781 strike_register_client_->RunPendingVerifications(); |
| 778 ASSERT_TRUE(called); | 782 ASSERT_TRUE(called); |
| 779 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); | 783 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); |
| 780 // The message should be rejected now. | 784 // The message should be rejected now. |
| 781 CheckRejectTag(); | 785 CheckRejectTag(); |
| 782 } | 786 } |
| 783 | 787 |
| 784 } // namespace test | 788 } // namespace test |
| 785 } // namespace net | 789 } // namespace net |
| OLD | NEW |