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_decrypter.h" | 5 #include "net/quic/core/crypto/null_decrypter.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 NullDecrypterTest : public ::testing::TestWithParam<bool> {}; | 12 class NullDecrypterTest : public QuicTestWithParam<bool> {}; |
12 | 13 |
13 TEST_F(NullDecrypterTest, DecryptClient) { | 14 TEST_F(NullDecrypterTest, DecryptClient) { |
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 const char* data = reinterpret_cast<const char*>(expected); | 21 const char* data = reinterpret_cast<const char*>(expected); |
21 size_t len = arraysize(expected); | 22 size_t len = arraysize(expected); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 NullDecrypter decrypter(Perspective::IS_CLIENT); | 114 NullDecrypter decrypter(Perspective::IS_CLIENT); |
114 char buffer[256]; | 115 char buffer[256]; |
115 size_t length = 0; | 116 size_t length = 0; |
116 ASSERT_FALSE(decrypter.DecryptPacket(QUIC_VERSION_35, 0, "hello world!", | 117 ASSERT_FALSE(decrypter.DecryptPacket(QUIC_VERSION_35, 0, "hello world!", |
117 QuicStringPiece(data, len), buffer, | 118 QuicStringPiece(data, len), buffer, |
118 &length, 256)); | 119 &length, 256)); |
119 } | 120 } |
120 | 121 |
121 } // namespace test | 122 } // namespace test |
122 } // namespace net | 123 } // namespace net |
OLD | NEW |