Chromium Code Reviews| 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; |
|
wtc
2014/06/20 23:21:01
We should also COMPILE_ASSERT sizeof(QuicTag) == s
ramant (doing other things)
2014/06/20 23:33:25
Done.
| |
| 274 size_t num_reject_reasons; | 274 size_t num_reject_reasons; |
| 275 QuicErrorCode error_code = out_.GetTaglist(kRREJ, &reject_reason_tags, | 275 QuicErrorCode error_code = out_.GetTaglist(kRREJ, &reject_reasons, |
| 276 &num_reject_reasons); | 276 &num_reject_reasons); |
| 277 if (!FLAGS_send_quic_crypto_reject_reason) { | 277 if (!FLAGS_send_quic_crypto_reject_reason) { |
| 278 ASSERT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error_code); | 278 ASSERT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error_code); |
| 279 return; | 279 return; |
| 280 } | 280 } |
| 281 ASSERT_EQ(QUIC_NO_ERROR, error_code); | 281 ASSERT_EQ(QUIC_NO_ERROR, error_code); |
| 282 | 282 |
| 283 if (FLAGS_use_early_return_when_verifying_chlo) { | 283 if (FLAGS_use_early_return_when_verifying_chlo) { |
| 284 EXPECT_EQ(1u, num_reject_reasons); | 284 EXPECT_EQ(1u, num_reject_reasons); |
| 285 } else { | 285 } else { |
| 286 EXPECT_EQ(expected_count, num_reject_reasons); | 286 EXPECT_EQ(expected_count, num_reject_reasons); |
| 287 } | 287 } |
| 288 for (size_t i = 0; i < num_reject_reasons; ++i) { | 288 for (size_t i = 0; i < num_reject_reasons; ++i) { |
| 289 EXPECT_EQ(expected_handshake_failures[i], reject_reason_tags[i]); | 289 EXPECT_EQ(expected_handshake_failures[i], reject_reasons[i]); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 protected: | 293 protected: |
| 294 QuicRandom* const rand_; | 294 QuicRandom* const rand_; |
| 295 MockClock clock_; | 295 MockClock clock_; |
| 296 const IPEndPoint client_address_; | 296 const IPEndPoint client_address_; |
| 297 QuicVersionVector supported_versions_; | 297 QuicVersionVector supported_versions_; |
| 298 string client_version_; | 298 string client_version_; |
| 299 QuicCryptoServerConfig config_; | 299 QuicCryptoServerConfig config_; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 | 717 |
| 718 strike_register_client_->RunPendingVerifications(); | 718 strike_register_client_->RunPendingVerifications(); |
| 719 ASSERT_TRUE(called); | 719 ASSERT_TRUE(called); |
| 720 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); | 720 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); |
| 721 // The message should be rejected now. | 721 // The message should be rejected now. |
| 722 EXPECT_EQ(kREJ, out_.tag()); | 722 EXPECT_EQ(kREJ, out_.tag()); |
| 723 } | 723 } |
| 724 | 724 |
| 725 } // namespace test | 725 } // namespace test |
| 726 } // namespace net | 726 } // namespace net |
| OLD | NEW |