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

Unified Diff: net/quic/core/crypto/cert_compressor_test.cc

Issue 2603723002: Add a new QUIC platform API for text utilities. (Closed)
Patch Set: net/tools/quic/quic_packet_printer_bin.cc Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/core/crypto/cert_compressor_test.cc
diff --git a/net/quic/core/crypto/cert_compressor_test.cc b/net/quic/core/crypto/cert_compressor_test.cc
index 9c0e98fb7bbd3baa3975411a3b1eaf5b6241db05..11da03395ff23fb524d676954ee028427d1719b9 100644
--- a/net/quic/core/crypto/cert_compressor_test.cc
+++ b/net/quic/core/crypto/cert_compressor_test.cc
@@ -7,6 +7,7 @@
#include <memory>
#include "net/quic/core/quic_utils.h"
+#include "net/quic/platform/api/quic_text_utils.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,7 +21,7 @@ TEST(CertCompressor, EmptyChain) {
std::vector<string> chain;
const string compressed = CertCompressor::CompressChain(
chain, StringPiece(), StringPiece(), nullptr);
- EXPECT_EQ("00", QuicUtils::HexEncode(compressed));
+ EXPECT_EQ("00", QuicTextUtils::HexEncode(compressed));
std::vector<string> chain2, cached_certs;
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr,
@@ -34,7 +35,7 @@ TEST(CertCompressor, Compressed) {
const string compressed = CertCompressor::CompressChain(
chain, StringPiece(), StringPiece(), nullptr);
ASSERT_GE(compressed.size(), 2u);
- EXPECT_EQ("0100", QuicUtils::HexEncode(compressed.substr(0, 2)));
+ EXPECT_EQ("0100", QuicTextUtils::HexEncode(compressed.substr(0, 2)));
std::vector<string> chain2, cached_certs;
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs, nullptr,
@@ -55,10 +56,10 @@ TEST(CertCompressor, Common) {
StringPiece(), common_sets.get());
EXPECT_EQ(
"03" /* common */
- "2A00000000000000" /* set hash 42 */
+ "2a00000000000000" /* set hash 42 */
"01000000" /* index 1 */
"00" /* end of list */,
- QuicUtils::HexEncode(compressed));
+ QuicTextUtils::HexEncode(compressed));
std::vector<string> chain2, cached_certs;
ASSERT_TRUE(CertCompressor::DecompressChain(compressed, cached_certs,
@@ -75,9 +76,9 @@ TEST(CertCompressor, Cached) {
const string compressed =
CertCompressor::CompressChain(chain, StringPiece(), hash_bytes, nullptr);
- EXPECT_EQ("02" /* cached */ + QuicUtils::HexEncode(hash_bytes) +
+ EXPECT_EQ("02" /* cached */ + QuicTextUtils::HexEncode(hash_bytes) +
"00" /* end of list */,
- QuicUtils::HexEncode(compressed));
+ QuicTextUtils::HexEncode(compressed));
std::vector<string> cached_certs, chain2;
cached_certs.push_back(chain[0]);
@@ -91,37 +92,37 @@ TEST(CertCompressor, BadInputs) {
std::vector<string> cached_certs, chain;
EXPECT_FALSE(CertCompressor::DecompressChain(
- QuicUtils::HexEncode("04") /* bad entry type */, cached_certs, nullptr,
- &chain));
+ QuicTextUtils::HexEncode("04") /* bad entry type */, cached_certs,
+ nullptr, &chain));
EXPECT_FALSE(CertCompressor::DecompressChain(
- QuicUtils::HexEncode("01") /* no terminator */, cached_certs, nullptr,
+ QuicTextUtils::HexEncode("01") /* no terminator */, cached_certs, nullptr,
&chain));
EXPECT_FALSE(CertCompressor::DecompressChain(
- QuicUtils::HexEncode("0200") /* hash truncated */, cached_certs, nullptr,
- &chain));
+ QuicTextUtils::HexEncode("0200") /* hash truncated */, cached_certs,
+ nullptr, &chain));
EXPECT_FALSE(CertCompressor::DecompressChain(
- QuicUtils::HexEncode("0300") /* hash and index truncated */, cached_certs,
- nullptr, &chain));
+ QuicTextUtils::HexEncode("0300") /* hash and index truncated */,
+ cached_certs, nullptr, &chain));
/* without a CommonCertSets */
- EXPECT_FALSE(
- CertCompressor::DecompressChain(QuicUtils::HexEncode("03"
- "0000000000000000"
- "00000000"),
- cached_certs, nullptr, &chain));
+ EXPECT_FALSE(CertCompressor::DecompressChain(
+ QuicTextUtils::HexEncode("03"
+ "0000000000000000"
+ "00000000"),
+ cached_certs, nullptr, &chain));
std::unique_ptr<CommonCertSets> common_sets(
CryptoTestUtils::MockCommonCertSets("foo", 42, 1));
/* incorrect hash and index */
- EXPECT_FALSE(
- CertCompressor::DecompressChain(QuicUtils::HexEncode("03"
- "a200000000000000"
- "00000000"),
- cached_certs, nullptr, &chain));
+ EXPECT_FALSE(CertCompressor::DecompressChain(
+ QuicTextUtils::HexEncode("03"
+ "a200000000000000"
+ "00000000"),
+ cached_certs, nullptr, &chain));
}
} // namespace test
« no previous file with comments | « net/quic/core/crypto/aes_128_gcm_12_encrypter_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