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

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

Issue 11299023: Add real support for uint128. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more try Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/null_decrypter_test.cc ('k') | net/quic/quic_data_reader.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 (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_encrypter.h" 5 #include "net/quic/crypto/null_encrypter.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 11
12 namespace test { 12 namespace test {
13 13
14 TEST(NullEncrypterTest, Encrypt) { 14 TEST(NullEncrypterTest, Encrypt) {
15 unsigned char expected[] = { 15 unsigned char expected[] = {
16 // fnv hash 16 // fnv hash
17 0x07, 0x2d, 0x42, 0xf0,
18 0xbe, 0x69, 0x12, 0x3d,
19 0x20, 0x80, 0x5f, 0x9a,
20 0x84, 0x9d, 0xd6, 0x0a,
21 /* TODO(rch): use this when uint128 multiplication is implemented.
22 0x47, 0x11, 0xea, 0x5f, 17 0x47, 0x11, 0xea, 0x5f,
23 0xcf, 0x1d, 0x66, 0x5b, 18 0xcf, 0x1d, 0x66, 0x5b,
24 0xba, 0xf0, 0xbc, 0xfd, 19 0xba, 0xf0, 0xbc, 0xfd,
25 0x88, 0x79, 0xca, 0x37, 20 0x88, 0x79, 0xca, 0x37,
26 */
27 // payload 21 // payload
28 'g', 'o', 'o', 'd', 22 'g', 'o', 'o', 'd',
29 'b', 'y', 'e', '!', 23 'b', 'y', 'e', '!',
30 }; 24 };
31 NullEncrypter encrypter; 25 NullEncrypter encrypter;
32 scoped_ptr<QuicData> encrypted(encrypter.Encrypt("hello world!", 26 scoped_ptr<QuicData> encrypted(encrypter.Encrypt("hello world!",
33 "goodbye!")); 27 "goodbye!"));
34 ASSERT_TRUE(encrypted.get()); 28 ASSERT_TRUE(encrypted.get());
35 test::CompareCharArraysWithHexError( 29 test::CompareCharArraysWithHexError(
36 "encrypted data", encrypted->data(), encrypted->length(), 30 "encrypted data", encrypted->data(), encrypted->length(),
(...skipping 10 matching lines...) Expand all
47 TEST(NullEncrypterTest, GetCiphertextSize) { 41 TEST(NullEncrypterTest, GetCiphertextSize) {
48 NullEncrypter encrypter; 42 NullEncrypter encrypter;
49 EXPECT_EQ(1016u, encrypter.GetCiphertextSize(1000)); 43 EXPECT_EQ(1016u, encrypter.GetCiphertextSize(1000));
50 EXPECT_EQ(116u, encrypter.GetCiphertextSize(100)); 44 EXPECT_EQ(116u, encrypter.GetCiphertextSize(100));
51 EXPECT_EQ(26u, encrypter.GetCiphertextSize(10)); 45 EXPECT_EQ(26u, encrypter.GetCiphertextSize(10));
52 } 46 }
53 47
54 } // namespace test 48 } // namespace test
55 49
56 } // namespace net 50 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/null_decrypter_test.cc ('k') | net/quic/quic_data_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698