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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/quic_crypto_server_config.cc ('k') | net/quic/crypto/quic_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "net/quic/crypto/quic_crypto_server_config.h" 5 #include "net/quic/crypto/quic_crypto_server_config.h"
6 6
7 #include <stdarg.h> 7 #include <stdarg.h>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 424
425 TEST(QuicCryptoServerConfigTest, ValidateServerNonce) { 425 TEST(QuicCryptoServerConfigTest, ValidateServerNonce) {
426 QuicRandom* rand = QuicRandom::GetInstance(); 426 QuicRandom* rand = QuicRandom::GetInstance();
427 QuicCryptoServerConfig server(QuicCryptoServerConfig::TESTING, rand, 427 QuicCryptoServerConfig server(QuicCryptoServerConfig::TESTING, rand,
428 CryptoTestUtils::ProofSourceForTesting()); 428 CryptoTestUtils::ProofSourceForTesting());
429 QuicCryptoServerConfigPeer peer(&server); 429 QuicCryptoServerConfigPeer peer(&server);
430 430
431 StringPiece message("hello world"); 431 StringPiece message("hello world");
432 const size_t key_size = CryptoSecretBoxer::GetKeySize(); 432 const size_t key_size = CryptoSecretBoxer::GetKeySize();
433 scoped_ptr<uint8[]> key(new uint8[key_size]); 433 scoped_ptr<uint8_t[]> key(new uint8_t[key_size]);
434 memset(key.get(), 0x11, key_size); 434 memset(key.get(), 0x11, key_size);
435 435
436 CryptoSecretBoxer boxer; 436 CryptoSecretBoxer boxer;
437 boxer.SetKey(StringPiece(reinterpret_cast<char*>(key.get()), key_size)); 437 boxer.SetKey(StringPiece(reinterpret_cast<char*>(key.get()), key_size));
438 const string box = boxer.Box(rand, message); 438 const string box = boxer.Box(rand, message);
439 MockClock clock; 439 MockClock clock;
440 QuicWallTime now = clock.WallNow(); 440 QuicWallTime now = clock.WallNow();
441 const QuicWallTime original_time = now; 441 const QuicWallTime original_time = now;
442 EXPECT_EQ(SERVER_NONCE_DECRYPTION_FAILURE, 442 EXPECT_EQ(SERVER_NONCE_DECRYPTION_FAILURE,
443 peer.ValidateServerNonce(box, now)); 443 peer.ValidateServerNonce(box, now));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 TEST_F(CryptoServerConfigsTest, InvalidConfigs) { 632 TEST_F(CryptoServerConfigsTest, InvalidConfigs) {
633 // Ensure that invalid configs don't change anything. 633 // Ensure that invalid configs don't change anything.
634 SetConfigs("a", 800, 1, "b", 900, 1, "c", 1100, 1, nullptr); 634 SetConfigs("a", 800, 1, "b", 900, 1, "c", 1100, 1, nullptr);
635 test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr); 635 test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr);
636 SetConfigs("a", 800, 1, "c", 1100, 1, "INVALID1", 1000, 1, nullptr); 636 SetConfigs("a", 800, 1, "c", 1100, 1, "INVALID1", 1000, 1, nullptr);
637 test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr); 637 test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr);
638 } 638 }
639 639
640 } // namespace test 640 } // namespace test
641 } // namespace net 641 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.cc ('k') | net/quic/crypto/quic_decrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698