Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: net/quic/crypto/crypto_server_test.cc

Issue 2189763002: Landing Recent QUIC changes until 7/26/2016 13:53 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/crypto/proof_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <cstdint> 6 #include <cstdint>
7 #include <memory> 7 #include <memory>
8 #include <ostream> 8 #include <ostream>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 CryptoTestUtils::ProofSourceForTesting()), 112 CryptoTestUtils::ProofSourceForTesting()),
113 compressed_certs_cache_( 113 compressed_certs_cache_(
114 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { 114 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {
115 supported_versions_ = GetParam().supported_versions; 115 supported_versions_ = GetParam().supported_versions;
116 config_.set_enable_serving_sct(true); 116 config_.set_enable_serving_sct(true);
117 117
118 client_version_ = supported_versions_.front(); 118 client_version_ = supported_versions_.front();
119 client_version_string_ = 119 client_version_string_ =
120 QuicUtils::TagToString(QuicVersionToQuicTag(client_version_)); 120 QuicUtils::TagToString(QuicVersionToQuicTag(client_version_));
121 121
122 FLAGS_quic_require_handshake_confirmation_pre33 = false;
122 FLAGS_enable_quic_stateless_reject_support = 123 FLAGS_enable_quic_stateless_reject_support =
123 GetParam().enable_stateless_rejects; 124 GetParam().enable_stateless_rejects;
124 use_stateless_rejects_ = GetParam().use_stateless_rejects; 125 use_stateless_rejects_ = GetParam().use_stateless_rejects;
125 } 126 }
126 127
127 void SetUp() override { 128 void SetUp() override {
128 QuicCryptoServerConfig::ConfigOptions old_config_options; 129 QuicCryptoServerConfig::ConfigOptions old_config_options;
129 old_config_options.id = kOldConfigId; 130 old_config_options.id = kOldConfigId;
130 delete config_.AddDefaultConfig(rand_, &clock_, old_config_options); 131 delete config_.AddDefaultConfig(rand_, &clock_, old_config_options);
131 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000)); 132 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const char* error_substr, 194 const char* error_substr,
194 bool* called) 195 bool* called)
195 : test_(test), 196 : test_(test),
196 should_succeed_(should_succeed), 197 should_succeed_(should_succeed),
197 error_substr_(error_substr), 198 error_substr_(error_substr),
198 called_(called) { 199 called_(called) {
199 *called_ = false; 200 *called_ = false;
200 } 201 }
201 202
202 void RunImpl(const CryptoHandshakeMessage& client_hello, 203 void RunImpl(const CryptoHandshakeMessage& client_hello,
203 const Result& result) override { 204 const Result& result,
205 std::unique_ptr<ProofSource::Details> /* details */) override {
204 { 206 {
205 // Ensure that the strike register client lock is not held. 207 // Ensure that the strike register client lock is not held.
206 QuicCryptoServerConfigPeer peer(&test_->config_); 208 QuicCryptoServerConfigPeer peer(&test_->config_);
207 base::Lock* m = peer.GetStrikeRegisterClientLock(); 209 base::Lock* m = peer.GetStrikeRegisterClientLock();
208 // In Chromium, we will dead lock if the lock is held by the current 210 // In Chromium, we will dead lock if the lock is held by the current
209 // thread. Chromium doesn't have AssertNotHeld API call. 211 // thread. Chromium doesn't have AssertNotHeld API call.
210 // m->AssertNotHeld(); 212 // m->AssertNotHeld();
211 base::AutoLock lock(*m); 213 base::AutoLock lock(*m);
212 } 214 }
213 ASSERT_FALSE(*called_); 215 ASSERT_FALSE(*called_);
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 ASSERT_FALSE(called); 1169 ASSERT_FALSE(called);
1168 EXPECT_EQ(1, strike_register_client_->PendingVerifications()); 1170 EXPECT_EQ(1, strike_register_client_->PendingVerifications());
1169 1171
1170 strike_register_client_->RunPendingVerifications(); 1172 strike_register_client_->RunPendingVerifications();
1171 ASSERT_TRUE(called); 1173 ASSERT_TRUE(called);
1172 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); 1174 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1173 // The message should be rejected now. 1175 // The message should be rejected now.
1174 CheckRejectTag(); 1176 CheckRejectTag();
1175 } 1177 }
1176 1178
1179 TEST_P(AsyncStrikeServerVerificationTest, RequireHandshakeCofirmationPre33) {
1180 FLAGS_quic_require_handshake_confirmation = false;
1181 FLAGS_quic_require_handshake_confirmation_pre33 = true;
1182 // clang-format off
1183 CryptoHandshakeMessage msg = CryptoTestUtils::Message(
1184 "CHLO",
1185 "PDMD", "X509",
1186 "AEAD", "AESG",
1187 "KEXS", "C255",
1188 "SNI", "foobar1.example.com",
1189 "SCID", scid_hex_.c_str(),
1190 "#004b5453", srct_hex_.c_str(),
1191 "PUBS", pub_hex_.c_str(),
1192 "NONC", nonce_hex_.c_str(),
1193 "VER\0", client_version_string_.c_str(),
1194 "XLCT", XlctHexString().c_str(),
1195 "$padding", static_cast<int>(kClientHelloMinimumSize),
1196 nullptr);
1197 // clang-format on
1198
1199 ShouldSucceed(msg);
1200
1201 if (client_version_ <= QUIC_VERSION_32) {
1202 // clang-format off
1203 const HandshakeFailureReason kRejectReasons[] = {
1204 SERVER_NONCE_REQUIRED_FAILURE
1205 };
1206 // clang-format on
1207 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
1208 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1209 } else {
1210 // version 33.
1211 ASSERT_EQ(kSHLO, out_.tag());
1212 CheckServerHello(out_);
1213 }
1214 }
1215
1177 } // namespace test 1216 } // namespace test
1178 } // namespace net 1217 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/proof_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698