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/crypto/null_decrypter.h" | 5 #include "net/quic/crypto/null_decrypter.h" |
6 #include "net/quic/test_tools/quic_test_utils.h" | 6 #include "net/quic/test_tools/quic_test_utils.h" |
7 | 7 |
8 using base::StringPiece; | 8 using base::StringPiece; |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 namespace test { | 11 namespace test { |
12 | 12 |
13 TEST(NullDecrypterTest, Decrypt) { | 13 TEST(NullDecrypterTest, Decrypt) { |
14 unsigned char expected[] = { | 14 unsigned char expected[] = { |
15 // fnv hash | 15 // fnv hash |
16 0x47, 0x11, 0xea, 0x5f, | 16 0xa0, 0x6f, 0x44, 0x8a, |
17 0xcf, 0x1d, 0x66, 0x5b, | 17 0x44, 0xf8, 0x18, 0x3b, |
18 0xba, 0xf0, 0xbc, 0xfd, | 18 0x47, 0x91, 0xb2, 0x13, |
19 0x88, 0x79, 0xca, 0x37, | 19 0x6b, 0x09, 0xbb, 0xae, |
20 // payload | 20 // payload |
21 'g', 'o', 'o', 'd', | 21 'g', 'o', 'o', 'd', |
22 'b', 'y', 'e', '!', | 22 'b', 'y', 'e', '!', |
23 }; | 23 }; |
24 NullDecrypter decrypter; | 24 NullDecrypter decrypter; |
25 scoped_ptr<QuicData> decrypted( | 25 scoped_ptr<QuicData> decrypted( |
26 decrypter.Decrypt(0, "hello world!", | 26 decrypter.Decrypt(0, "hello world!", |
27 StringPiece(reinterpret_cast<const char*>(expected), | 27 StringPiece(reinterpret_cast<const char*>(expected), |
28 arraysize(expected)))); | 28 arraysize(expected)))); |
29 ASSERT_TRUE(decrypted.get()); | 29 ASSERT_TRUE(decrypted.get()); |
(...skipping 30 matching lines...) Expand all Loading... |
60 NullDecrypter decrypter; | 60 NullDecrypter decrypter; |
61 scoped_ptr<QuicData> decrypted( | 61 scoped_ptr<QuicData> decrypted( |
62 decrypter.Decrypt(0, "hello world!", | 62 decrypter.Decrypt(0, "hello world!", |
63 StringPiece(reinterpret_cast<const char*>(expected), | 63 StringPiece(reinterpret_cast<const char*>(expected), |
64 arraysize(expected)))); | 64 arraysize(expected)))); |
65 ASSERT_FALSE(decrypted.get()); | 65 ASSERT_FALSE(decrypted.get()); |
66 } | 66 } |
67 | 67 |
68 } // namespace test | 68 } // namespace test |
69 } // namespace net | 69 } // namespace net |
OLD | NEW |