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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 CryptoUtils::GenerateNonce( | 263 CryptoUtils::GenerateNonce( |
264 clock_.WallNow(), rand_, | 264 clock_.WallNow(), rand_, |
265 StringPiece(reinterpret_cast<const char*>(orbit_), sizeof(orbit_)), | 265 StringPiece(reinterpret_cast<const char*>(orbit_), sizeof(orbit_)), |
266 &nonce); | 266 &nonce); |
267 return nonce; | 267 return nonce; |
268 } | 268 } |
269 | 269 |
270 void CheckRejectReasons( | 270 void CheckRejectReasons( |
271 const HandshakeFailureReason* expected_handshake_failures, | 271 const HandshakeFailureReason* expected_handshake_failures, |
272 size_t expected_count) { | 272 size_t expected_count) { |
273 const QuicTag* reject_reason_tags; | 273 const uint32* reject_reasons; |
274 size_t num_reject_reasons; | 274 size_t num_reject_reasons; |
275 QuicErrorCode error_code = out_.GetTaglist(kRREJ, &reject_reason_tags, | 275 COMPILE_ASSERT(sizeof(QuicTag) == sizeof(uint32), header_out_of_sync); |
| 276 QuicErrorCode error_code = out_.GetTaglist(kRREJ, &reject_reasons, |
276 &num_reject_reasons); | 277 &num_reject_reasons); |
277 if (!FLAGS_send_quic_crypto_reject_reason) { | 278 if (!FLAGS_send_quic_crypto_reject_reason) { |
278 ASSERT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error_code); | 279 ASSERT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error_code); |
279 return; | 280 return; |
280 } | 281 } |
281 ASSERT_EQ(QUIC_NO_ERROR, error_code); | 282 ASSERT_EQ(QUIC_NO_ERROR, error_code); |
282 | 283 |
283 if (FLAGS_use_early_return_when_verifying_chlo) { | 284 if (FLAGS_use_early_return_when_verifying_chlo) { |
284 EXPECT_EQ(1u, num_reject_reasons); | 285 EXPECT_EQ(1u, num_reject_reasons); |
285 } else { | 286 } else { |
286 EXPECT_EQ(expected_count, num_reject_reasons); | 287 EXPECT_EQ(expected_count, num_reject_reasons); |
287 } | 288 } |
288 for (size_t i = 0; i < num_reject_reasons; ++i) { | 289 for (size_t i = 0; i < num_reject_reasons; ++i) { |
289 EXPECT_EQ(expected_handshake_failures[i], reject_reason_tags[i]); | 290 EXPECT_EQ(expected_handshake_failures[i], reject_reasons[i]); |
290 } | 291 } |
291 } | 292 } |
292 | 293 |
293 protected: | 294 protected: |
294 QuicRandom* const rand_; | 295 QuicRandom* const rand_; |
295 MockClock clock_; | 296 MockClock clock_; |
296 const IPEndPoint client_address_; | 297 const IPEndPoint client_address_; |
297 QuicVersionVector supported_versions_; | 298 QuicVersionVector supported_versions_; |
298 string client_version_; | 299 string client_version_; |
299 QuicCryptoServerConfig config_; | 300 QuicCryptoServerConfig config_; |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 718 |
718 strike_register_client_->RunPendingVerifications(); | 719 strike_register_client_->RunPendingVerifications(); |
719 ASSERT_TRUE(called); | 720 ASSERT_TRUE(called); |
720 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); | 721 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); |
721 // The message should be rejected now. | 722 // The message should be rejected now. |
722 EXPECT_EQ(kREJ, out_.tag()); | 723 EXPECT_EQ(kREJ, out_.tag()); |
723 } | 724 } |
724 | 725 |
725 } // namespace test | 726 } // namespace test |
726 } // namespace net | 727 } // namespace net |
OLD | NEW |