| Index: net/quic/crypto/cert_compressor_test.cc
|
| diff --git a/net/quic/crypto/cert_compressor_test.cc b/net/quic/crypto/cert_compressor_test.cc
|
| index 5bfef8f56eaff804ea2f265c85187fb62c174e0e..83ae5c458daab2b7cae0cc143911e7c5eee46e36 100644
|
| --- a/net/quic/crypto/cert_compressor_test.cc
|
| +++ b/net/quic/crypto/cert_compressor_test.cc
|
| @@ -52,17 +52,19 @@ TEST(CertCompressor, Common) {
|
| const string compressed = CertCompressor::CompressChain(
|
| chain,
|
| StringPiece(reinterpret_cast<const char*>(&set_hash), sizeof(set_hash)),
|
| - StringPiece(), common_sets.get());
|
| - const string common("03" /* common */
|
| - "2A00000000000000" /* set hash 42 */
|
| - "01000000" /* index 1 */
|
| - "00" /* end of list */);
|
| + StringPiece(),
|
| + common_sets.get());
|
| + const string common(
|
| + "03" /* common */
|
| + "2A00000000000000" /* set hash 42 */
|
| + "01000000" /* index 1 */
|
| + "00" /* end of list */);
|
| EXPECT_EQ(common.data(),
|
| base::HexEncode(compressed.data(), compressed.size()));
|
|
|
| vector<string> chain2, cached_certs;
|
| - ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs,
|
| - common_sets.get(), &chain2));
|
| + ASSERT_TRUE(CertCompressor::DecompressChain(
|
| + compressed, cached_certs, common_sets.get(), &chain2));
|
| EXPECT_EQ(chain.size(), chain2.size());
|
| EXPECT_EQ(chain[0], chain2[0]);
|
| }
|
| @@ -76,8 +78,8 @@ TEST(CertCompressor, Cached) {
|
| CertCompressor::CompressChain(chain, StringPiece(), hash_bytes, NULL);
|
|
|
| EXPECT_EQ("02" /* cached */ +
|
| - base::HexEncode(hash_bytes.data(), hash_bytes.size()) +
|
| - "00" /* end of list */,
|
| + base::HexEncode(hash_bytes.data(), hash_bytes.size()) +
|
| + "00" /* end of list */,
|
| base::HexEncode(compressed.data(), compressed.size()));
|
|
|
| vector<string> cached_certs, chain2;
|
| @@ -95,45 +97,61 @@ TEST(CertCompressor, BadInputs) {
|
| const string bad_entry("04");
|
| EXPECT_FALSE(CertCompressor::DecompressChain(
|
| base::HexEncode(bad_entry.data(), bad_entry.size()),
|
| - cached_certs, NULL, &chain));
|
| + cached_certs,
|
| + NULL,
|
| + &chain));
|
|
|
| /* no terminator */
|
| const string no_terminator("01");
|
| EXPECT_FALSE(CertCompressor::DecompressChain(
|
| base::HexEncode(no_terminator.data(), no_terminator.size()),
|
| - cached_certs, NULL, &chain));
|
| + cached_certs,
|
| + NULL,
|
| + &chain));
|
|
|
| /* hash truncated */
|
| const string hash_truncated("0200");
|
| EXPECT_FALSE(CertCompressor::DecompressChain(
|
| base::HexEncode(hash_truncated.data(), hash_truncated.size()),
|
| - cached_certs, NULL, &chain));
|
| + cached_certs,
|
| + NULL,
|
| + &chain));
|
|
|
| /* hash and index truncated */
|
| const string hash_and_index_truncated("0300");
|
| EXPECT_FALSE(CertCompressor::DecompressChain(
|
| base::HexEncode(hash_and_index_truncated.data(),
|
| hash_and_index_truncated.size()),
|
| - cached_certs, NULL, &chain));
|
| + cached_certs,
|
| + NULL,
|
| + &chain));
|
|
|
| /* without a CommonCertSets */
|
| const string without_a_common_cert_set(
|
| - "03" "0000000000000000" "00000000");
|
| + "03"
|
| + "0000000000000000"
|
| + "00000000");
|
| EXPECT_FALSE(CertCompressor::DecompressChain(
|
| base::HexEncode(without_a_common_cert_set.data(),
|
| without_a_common_cert_set.size()),
|
| - cached_certs, NULL, &chain));
|
| + cached_certs,
|
| + NULL,
|
| + &chain));
|
|
|
| scoped_ptr<CommonCertSets> common_sets(
|
| CryptoTestUtils::MockCommonCertSets("foo", 42, 1));
|
|
|
| /* incorrect hash and index */
|
| const string incorrect_hash_and_index(
|
| - "03" "a200000000000000" "00000000");
|
| + "03"
|
| + "a200000000000000"
|
| + "00000000");
|
| EXPECT_FALSE(CertCompressor::DecompressChain(
|
| base::HexEncode(incorrect_hash_and_index.data(),
|
| incorrect_hash_and_index.size()),
|
| - cached_certs, NULL, &chain));
|
| + cached_certs,
|
| + NULL,
|
| + &chain));
|
| }
|
|
|
| } // namespace test
|
|
|