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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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 | « net/quic/crypto/crypto_secret_boxer.cc ('k') | net/quic/crypto/null_decrypter.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 <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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 scoped_ptr<CryptoHandshakeMessage> server_config_; 295 scoped_ptr<CryptoHandshakeMessage> server_config_;
296 }; 296 };
297 297
298 // Run all CryptoServerTest with both values of 298 // Run all CryptoServerTest with both values of
299 // FLAGS_use_early_return_when_verifying_chlo 299 // FLAGS_use_early_return_when_verifying_chlo
300 INSTANTIATE_TEST_CASE_P(CryptoServerTests, 300 INSTANTIATE_TEST_CASE_P(CryptoServerTests,
301 CryptoServerTest, 301 CryptoServerTest,
302 ::testing::ValuesIn(GetTestParams())); 302 ::testing::ValuesIn(GetTestParams()));
303 303
304 TEST_P(CryptoServerTest, BadSNI) { 304 TEST_P(CryptoServerTest, BadSNI) {
305 static const char* kBadSNIs[] = { 305 static const char* const kBadSNIs[] = {
306 "", 306 "",
307 "foo", 307 "foo",
308 "#00", 308 "#00",
309 "#ff00", 309 "#ff00",
310 "127.0.0.1", 310 "127.0.0.1",
311 "ffee::1", 311 "ffee::1",
312 }; 312 };
313 313
314 string client_version = QuicUtils::TagToString( 314 string client_version = QuicUtils::TagToString(
315 QuicVersionToQuicTag(supported_versions_.front())); 315 QuicVersionToQuicTag(supported_versions_.front()));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 "VER\0", client_version_.data(), 361 "VER\0", client_version_.data(),
362 nullptr)); 362 nullptr));
363 const HandshakeFailureReason kRejectReasons[] = { 363 const HandshakeFailureReason kRejectReasons[] = {
364 SERVER_CONFIG_INCHOATE_HELLO_FAILURE 364 SERVER_CONFIG_INCHOATE_HELLO_FAILURE
365 }; 365 };
366 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); 366 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
367 } 367 }
368 368
369 TEST_P(CryptoServerTest, BadSourceAddressToken) { 369 TEST_P(CryptoServerTest, BadSourceAddressToken) {
370 // Invalid source-address tokens should be ignored. 370 // Invalid source-address tokens should be ignored.
371 static const char* kBadSourceAddressTokens[] = { 371 static const char* const kBadSourceAddressTokens[] = {
372 "", 372 "",
373 "foo", 373 "foo",
374 "#0000", 374 "#0000",
375 "#0000000000000000000000000000000000000000", 375 "#0000000000000000000000000000000000000000",
376 }; 376 };
377 377
378 for (size_t i = 0; i < arraysize(kBadSourceAddressTokens); i++) { 378 for (size_t i = 0; i < arraysize(kBadSourceAddressTokens); i++) {
379 ShouldSucceed(InchoateClientHello( 379 ShouldSucceed(InchoateClientHello(
380 "CHLO", 380 "CHLO",
381 "STK", kBadSourceAddressTokens[i], 381 "STK", kBadSourceAddressTokens[i],
382 "VER\0", client_version_.data(), 382 "VER\0", client_version_.data(),
383 nullptr)); 383 nullptr));
384 const HandshakeFailureReason kRejectReasons[] = { 384 const HandshakeFailureReason kRejectReasons[] = {
385 SERVER_CONFIG_INCHOATE_HELLO_FAILURE 385 SERVER_CONFIG_INCHOATE_HELLO_FAILURE
386 }; 386 };
387 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); 387 CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons));
388 } 388 }
389 } 389 }
390 390
391 TEST_P(CryptoServerTest, BadClientNonce) { 391 TEST_P(CryptoServerTest, BadClientNonce) {
392 // Invalid nonces should be ignored. 392 // Invalid nonces should be ignored.
393 static const char* kBadNonces[] = { 393 static const char* const kBadNonces[] = {
394 "", 394 "",
395 "#0000", 395 "#0000",
396 "#0000000000000000000000000000000000000000", 396 "#0000000000000000000000000000000000000000",
397 }; 397 };
398 398
399 for (size_t i = 0; i < arraysize(kBadNonces); i++) { 399 for (size_t i = 0; i < arraysize(kBadNonces); i++) {
400 ShouldSucceed(InchoateClientHello( 400 ShouldSucceed(InchoateClientHello(
401 "CHLO", 401 "CHLO",
402 "NONC", kBadNonces[i], 402 "NONC", kBadNonces[i],
403 "VER\0", client_version_.data(), 403 "VER\0", client_version_.data(),
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 703
704 strike_register_client_->RunPendingVerifications(); 704 strike_register_client_->RunPendingVerifications();
705 ASSERT_TRUE(called); 705 ASSERT_TRUE(called);
706 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); 706 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
707 // The message should be rejected now. 707 // The message should be rejected now.
708 EXPECT_EQ(kREJ, out_.tag()); 708 EXPECT_EQ(kREJ, out_.tag());
709 } 709 }
710 710
711 } // namespace test 711 } // namespace test
712 } // namespace net 712 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/crypto_secret_boxer.cc ('k') | net/quic/crypto/null_decrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698