OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/core/crypto/null_encrypter.h" | 5 #include "net/quic/core/crypto/null_encrypter.h" |
| 6 #include "net/quic/platform/api/quic_test.h" |
6 #include "net/quic/test_tools/quic_test_utils.h" | 7 #include "net/quic/test_tools/quic_test_utils.h" |
7 | 8 |
8 namespace net { | 9 namespace net { |
9 namespace test { | 10 namespace test { |
10 | 11 |
11 class NullEncrypterTest : public ::testing::TestWithParam<bool> {}; | 12 class NullEncrypterTest : public QuicTestWithParam<bool> {}; |
12 | 13 |
13 TEST_F(NullEncrypterTest, EncryptClient) { | 14 TEST_F(NullEncrypterTest, EncryptClient) { |
14 unsigned char expected[] = { | 15 unsigned char expected[] = { |
15 // fnv hash | 16 // fnv hash |
16 0x97, 0xdc, 0x27, 0x2f, 0x18, 0xa8, 0x56, 0x73, 0xdf, 0x8d, 0x1d, 0xd0, | 17 0x97, 0xdc, 0x27, 0x2f, 0x18, 0xa8, 0x56, 0x73, 0xdf, 0x8d, 0x1d, 0xd0, |
17 // payload | 18 // payload |
18 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', | 19 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', |
19 }; | 20 }; |
20 char encrypted[256]; | 21 char encrypted[256]; |
21 size_t encrypted_len = 0; | 22 size_t encrypted_len = 0; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 92 |
92 TEST_F(NullEncrypterTest, GetCiphertextSize) { | 93 TEST_F(NullEncrypterTest, GetCiphertextSize) { |
93 NullEncrypter encrypter(Perspective::IS_CLIENT); | 94 NullEncrypter encrypter(Perspective::IS_CLIENT); |
94 EXPECT_EQ(1012u, encrypter.GetCiphertextSize(1000)); | 95 EXPECT_EQ(1012u, encrypter.GetCiphertextSize(1000)); |
95 EXPECT_EQ(112u, encrypter.GetCiphertextSize(100)); | 96 EXPECT_EQ(112u, encrypter.GetCiphertextSize(100)); |
96 EXPECT_EQ(22u, encrypter.GetCiphertextSize(10)); | 97 EXPECT_EQ(22u, encrypter.GetCiphertextSize(10)); |
97 } | 98 } |
98 | 99 |
99 } // namespace test | 100 } // namespace test |
100 } // namespace net | 101 } // namespace net |
OLD | NEW |