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

Side by Side Diff: net/quic/core/crypto/cert_compressor_test.cc

Issue 2681793002: Landing Recent QUIC changes until 5:30 PM, Feb 3, 2017 UTC-5 (Closed)
Patch Set: sync and rebase Created 3 years, 10 months 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
OLDNEW
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/core/crypto/cert_compressor.h" 5 #include "net/quic/core/crypto/cert_compressor.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "net/quic/core/quic_utils.h" 9 #include "net/quic/core/quic_utils.h"
10 #include "net/quic/platform/api/quic_text_utils.h" 10 #include "net/quic/platform/api/quic_text_utils.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 &chain2)); 42 &chain2));
43 EXPECT_EQ(chain.size(), chain2.size()); 43 EXPECT_EQ(chain.size(), chain2.size());
44 EXPECT_EQ(chain[0], chain2[0]); 44 EXPECT_EQ(chain[0], chain2[0]);
45 } 45 }
46 46
47 TEST(CertCompressor, Common) { 47 TEST(CertCompressor, Common) {
48 std::vector<string> chain; 48 std::vector<string> chain;
49 chain.push_back("testcert"); 49 chain.push_back("testcert");
50 static const uint64_t set_hash = 42; 50 static const uint64_t set_hash = 42;
51 std::unique_ptr<CommonCertSets> common_sets( 51 std::unique_ptr<CommonCertSets> common_sets(
52 CryptoTestUtils::MockCommonCertSets(chain[0], set_hash, 1)); 52 crypto_test_utils::MockCommonCertSets(chain[0], set_hash, 1));
53 const string compressed = CertCompressor::CompressChain( 53 const string compressed = CertCompressor::CompressChain(
54 chain, 54 chain,
55 StringPiece(reinterpret_cast<const char*>(&set_hash), sizeof(set_hash)), 55 StringPiece(reinterpret_cast<const char*>(&set_hash), sizeof(set_hash)),
56 StringPiece(), common_sets.get()); 56 StringPiece(), common_sets.get());
57 EXPECT_EQ( 57 EXPECT_EQ(
58 "03" /* common */ 58 "03" /* common */
59 "2a00000000000000" /* set hash 42 */ 59 "2a00000000000000" /* set hash 42 */
60 "01000000" /* index 1 */ 60 "01000000" /* index 1 */
61 "00" /* end of list */, 61 "00" /* end of list */,
62 QuicTextUtils::HexEncode(compressed)); 62 QuicTextUtils::HexEncode(compressed));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 cached_certs, nullptr, &chain)); 108 cached_certs, nullptr, &chain));
109 109
110 /* without a CommonCertSets */ 110 /* without a CommonCertSets */
111 EXPECT_FALSE(CertCompressor::DecompressChain( 111 EXPECT_FALSE(CertCompressor::DecompressChain(
112 QuicTextUtils::HexEncode("03" 112 QuicTextUtils::HexEncode("03"
113 "0000000000000000" 113 "0000000000000000"
114 "00000000"), 114 "00000000"),
115 cached_certs, nullptr, &chain)); 115 cached_certs, nullptr, &chain));
116 116
117 std::unique_ptr<CommonCertSets> common_sets( 117 std::unique_ptr<CommonCertSets> common_sets(
118 CryptoTestUtils::MockCommonCertSets("foo", 42, 1)); 118 crypto_test_utils::MockCommonCertSets("foo", 42, 1));
119 119
120 /* incorrect hash and index */ 120 /* incorrect hash and index */
121 EXPECT_FALSE(CertCompressor::DecompressChain( 121 EXPECT_FALSE(CertCompressor::DecompressChain(
122 QuicTextUtils::HexEncode("03" 122 QuicTextUtils::HexEncode("03"
123 "a200000000000000" 123 "a200000000000000"
124 "00000000"), 124 "00000000"),
125 cached_certs, nullptr, &chain)); 125 cached_certs, nullptr, &chain));
126 } 126 }
127 127
128 } // namespace test 128 } // namespace test
129 } // namespace net 129 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc ('k') | net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698