Move quic::test::CompareCharArraysWithHexError to Quiche
gfe-relnote: n/a, no functional change
PiperOrigin-RevId: 288560303
Change-Id: I82c3d1c60617d3c94abff40ea01ca5c8cecf95e2
diff --git a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
index cfd6812..0319d42 100644
--- a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -13,6 +13,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -277,8 +278,8 @@
EXPECT_TRUE(has_pt);
ASSERT_EQ(pt.length(), decrypted->length());
- test::CompareCharArraysWithHexError("plaintext", decrypted->data(),
- pt.length(), pt.data(), pt.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "plaintext", decrypted->data(), pt.length(), pt.data(), pt.length());
}
}
}
diff --git a/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
index 3241b07..bc3f611 100644
--- a/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
@@ -13,6 +13,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -215,9 +216,9 @@
tag.resize(Aes128Gcm12Encrypter::kAuthTagSize);
ASSERT_EQ(ct.length() + tag.length(), encrypted->length());
- test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
- ct.length(), ct.data(), ct.length());
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
+ "ciphertext", encrypted->data(), ct.length(), ct.data(), ct.length());
+ quiche::test::CompareCharArraysWithHexError(
"authentication tag", encrypted->data() + ct.length(), tag.length(),
tag.data(), tag.length());
}
diff --git a/quic/core/crypto/aes_128_gcm_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_decrypter_test.cc
index 5b9aa5c..a444284 100644
--- a/quic/core/crypto/aes_128_gcm_decrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_decrypter_test.cc
@@ -12,6 +12,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -265,8 +266,8 @@
EXPECT_TRUE(has_pt);
ASSERT_EQ(pt.length(), decrypted->length());
- test::CompareCharArraysWithHexError("plaintext", decrypted->data(),
- pt.length(), pt.data(), pt.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "plaintext", decrypted->data(), pt.length(), pt.data(), pt.length());
}
}
}
@@ -282,9 +283,9 @@
std::string mask = decrypter.GenerateHeaderProtectionMask(&sample_reader);
std::string expected_mask =
quiche::QuicheTextUtils::HexDecode("b132c37d6164da4ea4dc9b763aceec27");
- test::CompareCharArraysWithHexError("header protection mask", mask.data(),
- mask.size(), expected_mask.data(),
- expected_mask.size());
+ quiche::test::CompareCharArraysWithHexError(
+ "header protection mask", mask.data(), mask.size(), expected_mask.data(),
+ expected_mask.size());
}
} // namespace test
diff --git a/quic/core/crypto/aes_128_gcm_encrypter_test.cc b/quic/core/crypto/aes_128_gcm_encrypter_test.cc
index 1fa8a47..69f8c4d 100644
--- a/quic/core/crypto/aes_128_gcm_encrypter_test.cc
+++ b/quic/core/crypto/aes_128_gcm_encrypter_test.cc
@@ -12,6 +12,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -208,9 +209,9 @@
ASSERT_TRUE(encrypted.get());
ASSERT_EQ(ct.length() + tag.length(), encrypted->length());
- test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
- ct.length(), ct.data(), ct.length());
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
+ "ciphertext", encrypted->data(), ct.length(), ct.data(), ct.length());
+ quiche::test::CompareCharArraysWithHexError(
"authentication tag", encrypted->data() + ct.length(), tag.length(),
tag.data(), tag.length());
}
@@ -239,8 +240,8 @@
ASSERT_TRUE(encrypter.EncryptPacket(packet_num, aad, pt, out.data(),
&out_size, out.size()));
EXPECT_EQ(out_size, out.size());
- test::CompareCharArraysWithHexError("ciphertext", out.data(), out.size(),
- ct.data(), ct.size());
+ quiche::test::CompareCharArraysWithHexError("ciphertext", out.data(),
+ out.size(), ct.data(), ct.size());
}
TEST_F(Aes128GcmEncrypterTest, GetMaxPlaintextSize) {
@@ -267,9 +268,9 @@
std::string mask = encrypter.GenerateHeaderProtectionMask(sample);
std::string expected_mask =
quiche::QuicheTextUtils::HexDecode("b132c37d6164da4ea4dc9b763aceec27");
- test::CompareCharArraysWithHexError("header protection mask", mask.data(),
- mask.size(), expected_mask.data(),
- expected_mask.size());
+ quiche::test::CompareCharArraysWithHexError(
+ "header protection mask", mask.data(), mask.size(), expected_mask.data(),
+ expected_mask.size());
}
} // namespace test
diff --git a/quic/core/crypto/aes_256_gcm_decrypter_test.cc b/quic/core/crypto/aes_256_gcm_decrypter_test.cc
index abd2651..7c69724 100644
--- a/quic/core/crypto/aes_256_gcm_decrypter_test.cc
+++ b/quic/core/crypto/aes_256_gcm_decrypter_test.cc
@@ -13,6 +13,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -270,8 +271,8 @@
EXPECT_TRUE(has_pt);
ASSERT_EQ(pt.length(), decrypted->length());
- test::CompareCharArraysWithHexError("plaintext", decrypted->data(),
- pt.length(), pt.data(), pt.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "plaintext", decrypted->data(), pt.length(), pt.data(), pt.length());
}
}
}
@@ -287,9 +288,9 @@
std::string mask = decrypter.GenerateHeaderProtectionMask(&sample_reader);
std::string expected_mask =
quiche::QuicheTextUtils::HexDecode("db9ed4e6ccd033af2eae01407199c56e");
- test::CompareCharArraysWithHexError("header protection mask", mask.data(),
- mask.size(), expected_mask.data(),
- expected_mask.size());
+ quiche::test::CompareCharArraysWithHexError(
+ "header protection mask", mask.data(), mask.size(), expected_mask.data(),
+ expected_mask.size());
}
} // namespace test
diff --git a/quic/core/crypto/aes_256_gcm_encrypter_test.cc b/quic/core/crypto/aes_256_gcm_encrypter_test.cc
index 16c96e2..0899262 100644
--- a/quic/core/crypto/aes_256_gcm_encrypter_test.cc
+++ b/quic/core/crypto/aes_256_gcm_encrypter_test.cc
@@ -13,6 +13,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -216,9 +217,9 @@
ASSERT_TRUE(encrypted.get());
ASSERT_EQ(ct.length() + tag.length(), encrypted->length());
- test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
- ct.length(), ct.data(), ct.length());
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
+ "ciphertext", encrypted->data(), ct.length(), ct.data(), ct.length());
+ quiche::test::CompareCharArraysWithHexError(
"authentication tag", encrypted->data() + ct.length(), tag.length(),
tag.data(), tag.length());
}
@@ -249,9 +250,9 @@
std::string mask = encrypter.GenerateHeaderProtectionMask(sample);
std::string expected_mask =
quiche::QuicheTextUtils::HexDecode("db9ed4e6ccd033af2eae01407199c56e");
- test::CompareCharArraysWithHexError("header protection mask", mask.data(),
- mask.size(), expected_mask.data(),
- expected_mask.size());
+ quiche::test::CompareCharArraysWithHexError(
+ "header protection mask", mask.data(), mask.size(), expected_mask.data(),
+ expected_mask.size());
}
} // namespace test
diff --git a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
index 7be2251..83e52b1 100644
--- a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
@@ -12,6 +12,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -170,8 +171,8 @@
EXPECT_EQ(12u, ct.size() - decrypted->length());
ASSERT_EQ(pt.length(), decrypted->length());
- test::CompareCharArraysWithHexError("plaintext", decrypted->data(),
- pt.length(), pt.data(), pt.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "plaintext", decrypted->data(), pt.length(), pt.data(), pt.length());
}
}
diff --git a/quic/core/crypto/chacha20_poly1305_encrypter_test.cc b/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
index a15fbc5..47ee3d0 100644
--- a/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
@@ -14,6 +14,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -136,9 +137,9 @@
EXPECT_EQ(12u, ct.size() - pt.size());
EXPECT_EQ(12u, encrypted->length() - pt.size());
- test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
- encrypted->length(), ct.data(),
- ct.length());
+ quiche::test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
+ encrypted->length(), ct.data(),
+ ct.length());
}
}
diff --git a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
index d4fcd2b..9127cd4 100644
--- a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
@@ -12,6 +12,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -165,8 +166,8 @@
EXPECT_EQ(16u, ct.size() - decrypted->length());
ASSERT_EQ(pt.length(), decrypted->length());
- test::CompareCharArraysWithHexError("plaintext", decrypted->data(),
- pt.length(), pt.data(), pt.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "plaintext", decrypted->data(), pt.length(), pt.data(), pt.length());
}
}
@@ -180,9 +181,9 @@
ASSERT_TRUE(decrypter.SetHeaderProtectionKey(key));
std::string mask = decrypter.GenerateHeaderProtectionMask(&sample_reader);
std::string expected_mask = quiche::QuicheTextUtils::HexDecode("1cc2cd98dc");
- test::CompareCharArraysWithHexError("header protection mask", mask.data(),
- mask.size(), expected_mask.data(),
- expected_mask.size());
+ quiche::test::CompareCharArraysWithHexError(
+ "header protection mask", mask.data(), mask.size(), expected_mask.data(),
+ expected_mask.size());
}
} // namespace test
diff --git a/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
index 628ecc8..dd642a3 100644
--- a/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
+++ b/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
@@ -14,6 +14,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace {
@@ -136,9 +137,9 @@
EXPECT_EQ(16u, ct.size() - pt.size());
EXPECT_EQ(16u, encrypted->length() - pt.size());
- test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
- encrypted->length(), ct.data(),
- ct.length());
+ quiche::test::CompareCharArraysWithHexError("ciphertext", encrypted->data(),
+ encrypted->length(), ct.data(),
+ ct.length());
}
}
@@ -165,9 +166,9 @@
ASSERT_TRUE(encrypter.SetHeaderProtectionKey(key));
std::string mask = encrypter.GenerateHeaderProtectionMask(sample);
std::string expected_mask = quiche::QuicheTextUtils::HexDecode("1cc2cd98dc");
- test::CompareCharArraysWithHexError("header protection mask", mask.data(),
- mask.size(), expected_mask.data(),
- expected_mask.size());
+ quiche::test::CompareCharArraysWithHexError(
+ "header protection mask", mask.data(), mask.size(), expected_mask.data(),
+ expected_mask.size());
}
} // namespace test
diff --git a/quic/core/crypto/crypto_framer_test.cc b/quic/core/crypto/crypto_framer_test.cc
index fed6b53..d598c49 100644
--- a/quic/core/crypto/crypto_framer_test.cc
+++ b/quic/core/crypto/crypto_framer_test.cc
@@ -17,6 +17,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace quic {
namespace test {
@@ -82,9 +83,9 @@
CryptoFramer framer;
std::unique_ptr<QuicData> data = framer.ConstructHandshakeMessage(message);
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet),
- QUICHE_ARRAYSIZE(packet));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet),
+ QUICHE_ARRAYSIZE(packet));
}
TEST(CryptoFramerTest, ConstructHandshakeMessageWithTwoKeys) {
@@ -118,9 +119,9 @@
std::unique_ptr<QuicData> data = framer.ConstructHandshakeMessage(message);
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet),
- QUICHE_ARRAYSIZE(packet));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet),
+ QUICHE_ARRAYSIZE(packet));
}
TEST(CryptoFramerTest, ConstructHandshakeMessageZeroLength) {
@@ -145,9 +146,9 @@
std::unique_ptr<QuicData> data = framer.ConstructHandshakeMessage(message);
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet),
- QUICHE_ARRAYSIZE(packet));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet),
+ QUICHE_ARRAYSIZE(packet));
}
TEST(CryptoFramerTest, ConstructHandshakeMessageTooManyEntries) {
@@ -195,9 +196,9 @@
std::unique_ptr<QuicData> data = framer.ConstructHandshakeMessage(message);
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet),
- QUICHE_ARRAYSIZE(packet));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet),
+ QUICHE_ARRAYSIZE(packet));
}
TEST(CryptoFramerTest, ConstructHandshakeMessageMinimumSizePadLast) {
@@ -231,9 +232,9 @@
std::unique_ptr<QuicData> data = framer.ConstructHandshakeMessage(message);
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet),
- QUICHE_ARRAYSIZE(packet));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet),
+ QUICHE_ARRAYSIZE(packet));
}
TEST(CryptoFramerTest, ProcessInput) {
diff --git a/quic/core/crypto/crypto_utils_test.cc b/quic/core/crypto/crypto_utils_test.cc
index 247bd5d..edf8051 100644
--- a/quic/core/crypto/crypto_utils_test.cc
+++ b/quic/core/crypto/crypto_utils_test.cc
@@ -11,6 +11,7 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace quic {
namespace test {
@@ -70,9 +71,9 @@
EXPECT_EQ(expect_ok, ok);
if (expect_ok) {
EXPECT_EQ(result_len, result.length());
- test::CompareCharArraysWithHexError("HKDF output", result.data(),
- result.length(), expected.data(),
- expected.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "HKDF output", result.data(), result.length(), expected.data(),
+ expected.length());
}
}
}
diff --git a/quic/core/crypto/null_encrypter_test.cc b/quic/core/crypto/null_encrypter_test.cc
index 83b61ef..c9b00d4 100644
--- a/quic/core/crypto/null_encrypter_test.cc
+++ b/quic/core/crypto/null_encrypter_test.cc
@@ -6,6 +6,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
namespace quic {
namespace test {
@@ -42,7 +43,7 @@
NullEncrypter encrypter(Perspective::IS_CLIENT);
ASSERT_TRUE(encrypter.EncryptPacket(0, "hello world!", "goodbye!", encrypted,
&encrypted_len, 256));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"encrypted data", encrypted, encrypted_len,
reinterpret_cast<const char*>(expected), QUICHE_ARRAYSIZE(expected));
}
@@ -77,7 +78,7 @@
NullEncrypter encrypter(Perspective::IS_SERVER);
ASSERT_TRUE(encrypter.EncryptPacket(0, "hello world!", "goodbye!", encrypted,
&encrypted_len, 256));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"encrypted data", encrypted, encrypted_len,
reinterpret_cast<const char*>(expected), QUICHE_ARRAYSIZE(expected));
}