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 "net/quic/crypto/crypto_handshake.h" | 5 #include "net/quic/crypto/crypto_handshake.h" |
6 | 6 |
7 #include "net/quic/crypto/aes_128_gcm_encrypter.h" | 7 #include "net/quic/crypto/aes_128_gcm_encrypter.h" |
8 #include "net/quic/crypto/quic_random.h" | 8 #include "net/quic/crypto/quic_random.h" |
9 #include "net/quic/quic_time.h" | 9 #include "net/quic/quic_time.h" |
10 #include "net/quic/test_tools/mock_clock.h" | 10 #include "net/quic/test_tools/mock_clock.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 private: | 38 private: |
39 QuicCryptoServerConfig* const server_config_; | 39 QuicCryptoServerConfig* const server_config_; |
40 }; | 40 }; |
41 | 41 |
42 TEST(QuicCryptoServerConfigTest, ServerConfig) { | 42 TEST(QuicCryptoServerConfigTest, ServerConfig) { |
43 QuicCryptoServerConfig server("source address token secret"); | 43 QuicCryptoServerConfig server("source address token secret"); |
44 MockClock clock; | 44 MockClock clock; |
45 CryptoHandshakeMessage extra_tags; | 45 CryptoHandshakeMessage extra_tags; |
46 | 46 |
47 scoped_ptr<CryptoHandshakeMessage>( | 47 scoped_ptr<CryptoHandshakeMessage>( |
48 server.AddTestingConfig(QuicRandom::GetInstance(), &clock, extra_tags)); | 48 server.AddDefaultConfig(QuicRandom::GetInstance(), &clock, extra_tags)); |
49 } | 49 } |
50 | 50 |
51 TEST(QuicCryptoServerConfigTest, SourceAddressTokens) { | 51 TEST(QuicCryptoServerConfigTest, SourceAddressTokens) { |
52 if (!Aes128GcmEncrypter::IsSupported()) { | 52 if (!Aes128GcmEncrypter::IsSupported()) { |
53 LOG(INFO) << "AES GCM not supported. Test skipped."; | 53 LOG(INFO) << "AES GCM not supported. Test skipped."; |
54 return; | 54 return; |
55 } | 55 } |
56 | 56 |
57 QuicCryptoServerConfig server("source address token secret"); | 57 QuicCryptoServerConfig server("source address token secret"); |
58 IPAddressNumber ip; | 58 IPAddressNumber ip; |
(...skipping 16 matching lines...) Expand all Loading... |
75 | 75 |
76 now = original_time.Add(QuicTime::Delta::FromSeconds(86400 * 7)); | 76 now = original_time.Add(QuicTime::Delta::FromSeconds(86400 * 7)); |
77 EXPECT_FALSE(peer.ValidateSourceAddressToken(token4, ip4, now)); | 77 EXPECT_FALSE(peer.ValidateSourceAddressToken(token4, ip4, now)); |
78 | 78 |
79 now = original_time.Subtract(QuicTime::Delta::FromSeconds(3600 * 2)); | 79 now = original_time.Subtract(QuicTime::Delta::FromSeconds(3600 * 2)); |
80 EXPECT_FALSE(peer.ValidateSourceAddressToken(token4, ip4, now)); | 80 EXPECT_FALSE(peer.ValidateSourceAddressToken(token4, ip4, now)); |
81 } | 81 } |
82 | 82 |
83 } // namespace test | 83 } // namespace test |
84 } // namespace net | 84 } // namespace net |
OLD | NEW |