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));
}
diff --git a/quic/core/http/http_encoder_test.cc b/quic/core/http/http_encoder_test.cc
index 062df95..5c99b7d 100644
--- a/quic/core/http/http_encoder_test.cc
+++ b/quic/core/http/http_encoder_test.cc
@@ -7,6 +7,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 {
@@ -20,8 +21,8 @@
// length
0x05};
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("DATA", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError("DATA", buffer.get(), length,
+ output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializeHeadersFrameHeader) {
@@ -33,8 +34,8 @@
// length
0x07};
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("HEADERS", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError("HEADERS", buffer.get(), length,
+ output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializePriorityFrame) {
@@ -61,8 +62,8 @@
std::unique_ptr<char[]> buffer;
uint64_t length = HttpEncoder::SerializePriorityFrame(priority, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("PRIORITY", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError("PRIORITY", buffer.get(), length,
+ output, QUICHE_ARRAYSIZE(output));
PriorityFrame priority2;
priority2.prioritized_type = ROOT_OF_TREE;
@@ -82,8 +83,8 @@
0xff};
length = HttpEncoder::SerializePriorityFrame(priority2, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output2), length);
- CompareCharArraysWithHexError("PRIORITY", buffer.get(), length, output2,
- QUICHE_ARRAYSIZE(output2));
+ quiche::test::CompareCharArraysWithHexError(
+ "PRIORITY", buffer.get(), length, output2, QUICHE_ARRAYSIZE(output2));
PriorityFrame priority3;
priority3.prioritized_type = ROOT_OF_TREE;
@@ -100,8 +101,8 @@
0xff};
length = HttpEncoder::SerializePriorityFrame(priority3, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output3), length);
- CompareCharArraysWithHexError("PRIORITY", buffer.get(), length, output3,
- QUICHE_ARRAYSIZE(output3));
+ quiche::test::CompareCharArraysWithHexError(
+ "PRIORITY", buffer.get(), length, output3, QUICHE_ARRAYSIZE(output3));
}
TEST(HttpEncoderTest, SerializeCancelPushFrame) {
@@ -116,8 +117,8 @@
std::unique_ptr<char[]> buffer;
uint64_t length = HttpEncoder::SerializeCancelPushFrame(cancel_push, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("CANCEL_PUSH", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError(
+ "CANCEL_PUSH", buffer.get(), length, output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializeSettingsFrame) {
@@ -144,8 +145,8 @@
std::unique_ptr<char[]> buffer;
uint64_t length = HttpEncoder::SerializeSettingsFrame(settings, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("SETTINGS", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError("SETTINGS", buffer.get(), length,
+ output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializePushPromiseFrameWithOnlyPushId) {
@@ -162,8 +163,8 @@
uint64_t length = HttpEncoder::SerializePushPromiseFrameWithOnlyPushId(
push_promise, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("PUSH_PROMISE", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError(
+ "PUSH_PROMISE", buffer.get(), length, output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializeGoAwayFrame) {
@@ -178,8 +179,8 @@
std::unique_ptr<char[]> buffer;
uint64_t length = HttpEncoder::SerializeGoAwayFrame(goaway, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("GOAWAY", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError("GOAWAY", buffer.get(), length,
+ output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializeMaxPushIdFrame) {
@@ -194,8 +195,8 @@
std::unique_ptr<char[]> buffer;
uint64_t length = HttpEncoder::SerializeMaxPushIdFrame(max_push_id, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("MAX_PUSH_ID", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError(
+ "MAX_PUSH_ID", buffer.get(), length, output, QUICHE_ARRAYSIZE(output));
}
TEST(HttpEncoderTest, SerializeDuplicatePushFrame) {
@@ -211,8 +212,8 @@
uint64_t length =
HttpEncoder::SerializeDuplicatePushFrame(duplicate_push, &buffer);
EXPECT_EQ(QUICHE_ARRAYSIZE(output), length);
- CompareCharArraysWithHexError("DUPLICATE_PUSH", buffer.get(), length, output,
- QUICHE_ARRAYSIZE(output));
+ quiche::test::CompareCharArraysWithHexError(
+ "DUPLICATE_PUSH", buffer.get(), length, output, QUICHE_ARRAYSIZE(output));
}
} // namespace test
diff --git a/quic/core/quic_coalesced_packet_test.cc b/quic/core/quic_coalesced_packet_test.cc
index 8213480..6e7c32a 100644
--- a/quic/core/quic_coalesced_packet_test.cc
+++ b/quic/core/quic_coalesced_packet_test.cc
@@ -7,6 +7,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
#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/test_tools/quiche_test_utils.h"
namespace quic {
namespace test {
@@ -105,8 +106,8 @@
char expected[1000];
memset(expected, 'a', 500);
memset(expected + 500, 'b', 500);
- test::CompareCharArraysWithHexError("copied buffers", copy_buffer,
- length_copied, expected, 1000);
+ quiche::test::CompareCharArraysWithHexError("copied buffers", copy_buffer,
+ length_copied, expected, 1000);
}
} // namespace
diff --git a/quic/core/quic_crypto_client_stream_test.cc b/quic/core/quic_crypto_client_stream_test.cc
index 576eb57..a2e40c4 100644
--- a/quic/core/quic_crypto_client_stream_test.cc
+++ b/quic/core/quic_crypto_client_stream_test.cc
@@ -23,6 +23,7 @@
#include "net/third_party/quiche/src/quic/test_tools/simple_quic_framer.h"
#include "net/third_party/quiche/src/quic/test_tools/simple_session_cache.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"
using testing::_;
@@ -296,7 +297,7 @@
EXPECT_EQ("xstk", state->source_address_token());
const std::string& cached_scfg = state->server_config();
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"scfg", cached_scfg.data(), cached_scfg.length(),
reinterpret_cast<char*>(scfg), QUICHE_ARRAYSIZE(scfg));
diff --git a/quic/core/quic_data_writer_test.cc b/quic/core/quic_data_writer_test.cc
index 3c38673..e655905 100644
--- a/quic/core/quic_data_writer_test.cc
+++ b/quic/core/quic_data_writer_test.cc
@@ -18,6 +18,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.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 {
@@ -272,9 +273,9 @@
char buffer[255];
QuicDataWriter writer(connection_id.length(), buffer, GetParam().endianness);
EXPECT_TRUE(writer.WriteConnectionId(connection_id));
- test::CompareCharArraysWithHexError("connection_id", buffer,
- connection_id.length(), big_endian,
- connection_id.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "connection_id", buffer, connection_id.length(), big_endian,
+ connection_id.length());
QuicConnectionId read_connection_id;
QuicDataReader reader(buffer, connection_id.length(), GetParam().endianness);
@@ -294,7 +295,7 @@
char buffer[kConnectionIdLengthSize + 255] = {};
QuicDataWriter writer(QUICHE_ARRAYSIZE(buffer), buffer);
EXPECT_TRUE(writer.WriteLengthPrefixedConnectionId(connection_id));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"WriteLengthPrefixedConnectionId", buffer, writer.length(),
length_prefixed_connection_id,
QUICHE_ARRAYSIZE(length_prefixed_connection_id));
@@ -304,7 +305,7 @@
QuicDataWriter writer2(QUICHE_ARRAYSIZE(buffer), buffer);
EXPECT_TRUE(writer2.WriteUInt8(connection_id.length()));
EXPECT_TRUE(writer2.WriteConnectionId(connection_id));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"Write length then ConnectionId", buffer, writer2.length(),
length_prefixed_connection_id,
QUICHE_ARRAYSIZE(length_prefixed_connection_id));
@@ -372,8 +373,8 @@
char buffer[kBufferLength];
QuicDataWriter writer(kBufferLength, buffer, GetParam().endianness);
writer.WriteTag(kCHLO);
- test::CompareCharArraysWithHexError("CHLO", buffer, kBufferLength, CHLO,
- kBufferLength);
+ quiche::test::CompareCharArraysWithHexError("CHLO", buffer, kBufferLength,
+ CHLO, kBufferLength);
QuicTag read_chlo;
QuicDataReader reader(buffer, kBufferLength, GetParam().endianness);
@@ -389,7 +390,7 @@
uint16_t in_memory16 = 0x1122;
QuicDataWriter writer(2, buffer16, GetParam().endianness);
writer.WriteUInt16(in_memory16);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint16_t", buffer16, 2,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian16
: little_endian16,
@@ -405,7 +406,7 @@
uint64_t in_memory16 = 0x0000000000001122;
QuicDataWriter writer(2, buffer16, GetParam().endianness);
writer.WriteBytesToUInt64(2, in_memory16);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint16_t", buffer16, 2,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian16
: little_endian16,
@@ -425,7 +426,7 @@
uint64_t in_memory24 = 0x0000000000112233;
QuicDataWriter writer(3, buffer24, GetParam().endianness);
writer.WriteBytesToUInt64(3, in_memory24);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint24", buffer24, 3,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian24
: little_endian24,
@@ -445,7 +446,7 @@
uint32_t in_memory32 = 0x11223344;
QuicDataWriter writer(4, buffer32, GetParam().endianness);
writer.WriteUInt32(in_memory32);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint32_t", buffer32, 4,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian32
: little_endian32,
@@ -461,7 +462,7 @@
uint64_t in_memory32 = 0x11223344;
QuicDataWriter writer(4, buffer32, GetParam().endianness);
writer.WriteBytesToUInt64(4, in_memory32);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint32_t", buffer32, 4,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian32
: little_endian32,
@@ -481,7 +482,7 @@
char buffer40[5];
QuicDataWriter writer(5, buffer40, GetParam().endianness);
writer.WriteBytesToUInt64(5, in_memory40);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint40", buffer40, 5,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian40
: little_endian40,
@@ -500,7 +501,7 @@
char buffer48[6];
QuicDataWriter writer(6, buffer48, GetParam().endianness);
writer.WriteBytesToUInt64(6, in_memory48);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint48", buffer48, 6,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian48
: little_endian48,
@@ -519,7 +520,7 @@
char buffer56[7];
QuicDataWriter writer(7, buffer56, GetParam().endianness);
writer.WriteBytesToUInt64(7, in_memory56);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint56", buffer56, 7,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER ? big_endian56
: little_endian56,
@@ -540,7 +541,7 @@
char buffer64[8];
QuicDataWriter writer(8, buffer64, GetParam().endianness);
writer.WriteBytesToUInt64(8, in_memory64);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint64_t", buffer64, 8,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER
? AsChars(big_endian64)
@@ -554,7 +555,7 @@
QuicDataWriter writer2(8, buffer64, GetParam().endianness);
writer2.WriteUInt64(in_memory64);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"uint64_t", buffer64, 8,
GetParam().endianness == quiche::NETWORK_BYTE_ORDER
? AsChars(big_endian64)
@@ -1134,7 +1135,8 @@
EXPECT_FALSE(writer.WriteRandomBytes(&random, 30));
EXPECT_TRUE(writer.WriteRandomBytes(&random, 20));
- test::CompareCharArraysWithHexError("random", buffer, 20, expected, 20);
+ quiche::test::CompareCharArraysWithHexError("random", buffer, 20, expected,
+ 20);
}
TEST_P(QuicDataWriterTest, PeekVarInt62Length) {
@@ -1261,30 +1263,30 @@
QuicDataReader reader(buffer, sizeof(buffer));
char first_read_buffer[4] = {};
EXPECT_TRUE(reader.ReadBytes(first_read_buffer, sizeof(first_read_buffer)));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"first read", first_read_buffer, sizeof(first_read_buffer),
expected_first_read, sizeof(expected_first_read));
quiche::QuicheStringPiece peeked_remaining_payload =
reader.PeekRemainingPayload();
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"peeked_remaining_payload", peeked_remaining_payload.data(),
peeked_remaining_payload.length(), expected_remaining,
sizeof(expected_remaining));
quiche::QuicheStringPiece full_payload = reader.FullPayload();
- test::CompareCharArraysWithHexError("full_payload", full_payload.data(),
- full_payload.length(), buffer,
- sizeof(buffer));
+ quiche::test::CompareCharArraysWithHexError(
+ "full_payload", full_payload.data(), full_payload.length(), buffer,
+ sizeof(buffer));
quiche::QuicheStringPiece read_remaining_payload =
reader.ReadRemainingPayload();
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"read_remaining_payload", read_remaining_payload.data(),
read_remaining_payload.length(), expected_remaining,
sizeof(expected_remaining));
EXPECT_TRUE(reader.IsDoneReading());
quiche::QuicheStringPiece full_payload2 = reader.FullPayload();
- test::CompareCharArraysWithHexError("full_payload2", full_payload2.data(),
- full_payload2.length(), buffer,
- sizeof(buffer));
+ quiche::test::CompareCharArraysWithHexError(
+ "full_payload2", full_payload2.data(), full_payload2.length(), buffer,
+ sizeof(buffer));
}
} // namespace
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index dc0b4a7..83bb756 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -35,6 +35,7 @@
#include "net/third_party/quiche/src/quic/tools/quic_simple_crypto_server_stream_helper.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
+#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
using testing::_;
using testing::ByMove;
@@ -1122,7 +1123,7 @@
// The source connection ID of the probe response should match the
// destination connection ID of the probe request.
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"parsed probe", source_connection_id_bytes, source_connection_id_length,
destination_connection_id_bytes, sizeof(destination_connection_id_bytes));
}
@@ -1166,7 +1167,7 @@
// The source connection ID of the probe response should match the
// destination connection ID of the probe request.
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"parsed probe", source_connection_id_bytes, source_connection_id_length,
destination_connection_id_bytes, sizeof(destination_connection_id_bytes));
}
@@ -1211,7 +1212,7 @@
0x75, 0x76, 0x77, 0x78};
ASSERT_GE((*(saving_writer->packets()))[0]->length(),
1u + sizeof(connection_id_bytes));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"response connection ID", &(*(saving_writer->packets()))[0]->data()[1],
sizeof(connection_id_bytes), connection_id_bytes,
sizeof(connection_id_bytes));
@@ -1259,7 +1260,7 @@
0x75, 0x76, 0x77, 0x78};
ASSERT_GE((*(saving_writer->packets()))[0]->length(),
1u + sizeof(connection_id_bytes));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"response connection ID", &(*(saving_writer->packets()))[0]->data()[1],
sizeof(connection_id_bytes), connection_id_bytes,
sizeof(connection_id_bytes));
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index 2daac1e..17779bd 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -33,6 +33,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"
using testing::_;
using testing::Return;
@@ -5815,7 +5816,7 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(), AsChars(p),
framer_.transport_version() > QUIC_VERSION_43 ? QUICHE_ARRAYSIZE(packet46)
: QUICHE_ARRAYSIZE(packet));
@@ -5931,8 +5932,8 @@
}
QuicEncryptedPacket encrypted(AsChars(p), p_size, false);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, Build4ByteSequenceNumberPaddingFramePacket) {
@@ -6004,7 +6005,7 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(), AsChars(p),
framer_.transport_version() > QUIC_VERSION_43 ? QUICHE_ARRAYSIZE(packet46)
: QUICHE_ARRAYSIZE(packet));
@@ -6079,7 +6080,7 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(), AsChars(p),
framer_.transport_version() > QUIC_VERSION_43 ? QUICHE_ARRAYSIZE(packet46)
: QUICHE_ARRAYSIZE(packet));
@@ -6154,7 +6155,7 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(), AsChars(p),
framer_.transport_version() > QUIC_VERSION_43 ? QUICHE_ARRAYSIZE(packet46)
: QUICHE_ARRAYSIZE(packet));
@@ -6253,8 +6254,8 @@
p = packet46;
p_size = QUICHE_ARRAYSIZE(packet46);
}
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildStreamFramePacketWithVersionFlag) {
@@ -6386,8 +6387,8 @@
p = packet46;
p_size = QUICHE_ARRAYSIZE(packet46);
}
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildCryptoFramePacket) {
@@ -6465,9 +6466,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet),
- packet_size);
+ quiche::test::CompareCharArraysWithHexError("constructed packet",
+ data->data(), data->length(),
+ AsChars(packet), packet_size);
}
TEST_P(QuicFramerTest, CryptoFrame) {
@@ -6612,8 +6613,8 @@
framer_.transport_version() > QUIC_VERSION_43,
framer_.version().HasLengthPrefixedConnectionIds(),
SupportedVersions(GetParam())));
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildVersionNegotiationPacketWithClientConnectionId) {
@@ -6647,9 +6648,9 @@
QuicFramer::BuildVersionNegotiationPacket(
server_connection_id, client_connection_id, true, true,
SupportedVersions(GetParam())));
- 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_P(QuicFramerTest, BuildAckFramePacketOneAckBlock) {
@@ -6741,8 +6742,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildAckFramePacketOneAckBlockMaxLength) {
@@ -6834,8 +6835,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildAckFramePacketMultipleAckBlocks) {
@@ -6983,8 +6984,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildAckFramePacketMaxAckBlocks) {
@@ -7292,8 +7293,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildNewStopWaitingPacket) {
@@ -7332,9 +7333,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
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_P(QuicFramerTest, BuildRstFramePacketQuic) {
@@ -7428,8 +7429,8 @@
}
QuicEncryptedPacket encrypted(AsChars(p), p_size, false);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildCloseFramePacket) {
@@ -7529,8 +7530,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildCloseFramePacketExtendedInfo) {
@@ -7634,8 +7635,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildTruncatedCloseFramePacket) {
@@ -7819,8 +7820,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildApplicationCloseFramePacket) {
@@ -7870,9 +7871,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildTruncatedApplicationCloseFramePacket) {
@@ -7952,9 +7953,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildGoAwayPacket) {
@@ -8035,8 +8036,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildTruncatedGoAwayPacket) {
@@ -8172,8 +8173,8 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildWindowUpdatePacket) {
@@ -8256,8 +8257,8 @@
p_size = QUICHE_ARRAYSIZE(packet46);
}
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildMaxStreamDataPacket) {
@@ -8300,9 +8301,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildMaxDataPacket) {
@@ -8344,9 +8345,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildBlockedPacket) {
@@ -8428,8 +8429,8 @@
p_size = QUICHE_ARRAYSIZE(packet46);
}
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p), p_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p), p_size);
}
TEST_P(QuicFramerTest, BuildPingPacket) {
@@ -8490,7 +8491,7 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(), AsChars(p),
framer_.transport_version() > QUIC_VERSION_43 ? QUICHE_ARRAYSIZE(packet46)
: QUICHE_ARRAYSIZE(packet));
@@ -8562,9 +8563,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(p),
- QUICHE_ARRAYSIZE(packet46));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(p),
+ QUICHE_ARRAYSIZE(packet46));
}
@@ -8627,7 +8628,7 @@
p = packet46;
}
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(), AsChars(p),
framer_.transport_version() > QUIC_VERSION_43 ? QUICHE_ARRAYSIZE(packet46)
: QUICHE_ARRAYSIZE(packet));
@@ -8665,9 +8666,9 @@
std::unique_ptr<QuicEncryptedPacket> data(
framer_.BuildPublicResetPacket(reset_packet));
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_P(QuicFramerTest, BuildPublicResetPacketWithClientAddress) {
@@ -8714,9 +8715,9 @@
framer_.BuildPublicResetPacket(reset_packet));
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_P(QuicFramerTest, BuildPublicResetPacketWithEndpointId) {
@@ -8788,11 +8789,11 @@
// Variant 1 ends with char 'd'. Variant 1 ends with char 0xAB.
if ('d' == data->data()[data->length() - 1]) {
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(),
AsChars(packet_variant1), QUICHE_ARRAYSIZE(packet_variant1));
} else {
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data->data(), data->length(),
AsChars(packet_variant2), QUICHE_ARRAYSIZE(packet_variant2));
}
@@ -8816,13 +8817,13 @@
kTestStatelessResetToken));
ASSERT_TRUE(data != nullptr);
// Skip packet number byte which is random in stateless reset packet.
- test::CompareCharArraysWithHexError("constructed packet", data->data(), 1,
- AsChars(packet), 1);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), 1, AsChars(packet), 1);
const size_t random_bytes_length =
data->length() - kPacketHeaderTypeSize - sizeof(kTestStatelessResetToken);
EXPECT_EQ(kMinRandomBytesLengthInStatelessReset, random_bytes_length);
// Verify stateless reset token is correct.
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet",
data->data() + data->length() - sizeof(kTestStatelessResetToken),
sizeof(kTestStatelessResetToken),
@@ -9436,9 +9437,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, IetfStreamBlockedFrame) {
@@ -9524,9 +9525,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BiDiMaxStreamsFrame) {
@@ -10173,9 +10174,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildUniStreamsBlockedPacket) {
@@ -10215,9 +10216,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildBiDiMaxStreamsPacket) {
@@ -10257,9 +10258,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, BuildUniDiMaxStreamsPacket) {
@@ -10302,9 +10303,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, NewConnectionIdFrame) {
@@ -10576,9 +10577,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, NewTokenFrame) {
@@ -10670,9 +10671,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
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_P(QuicFramerTest, IetfStopSendingFrame) {
@@ -10758,9 +10759,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, IetfPathChallengeFrame) {
@@ -10841,9 +10842,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, IetfPathResponseFrame) {
@@ -10924,9 +10925,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, GetRetransmittableControlFrameSize) {
@@ -11729,9 +11730,9 @@
std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet", data->data(),
- data->length(), AsChars(packet99),
- QUICHE_ARRAYSIZE(packet99));
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data->data(), data->length(), AsChars(packet99),
+ QUICHE_ARRAYSIZE(packet99));
}
TEST_P(QuicFramerTest, AckFrameWithInvalidLargestObserved) {
@@ -12259,7 +12260,7 @@
ASSERT_EQ(1u, visitor_.undecryptable_packets_.size());
ASSERT_EQ(1u, visitor_.undecryptable_decryption_levels_.size());
ASSERT_EQ(1u, visitor_.undecryptable_has_decryption_keys_.size());
- CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"undecryptable packet", visitor_.undecryptable_packets_[0]->data(),
visitor_.undecryptable_packets_[0]->length(), AsChars(p), p_length);
if (framer_.version().KnowsWhichDecrypterToUse()) {
@@ -12361,7 +12362,7 @@
ASSERT_EQ(1u, visitor_.undecryptable_packets_.size());
ASSERT_EQ(1u, visitor_.undecryptable_decryption_levels_.size());
ASSERT_EQ(1u, visitor_.undecryptable_has_decryption_keys_.size());
- CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"undecryptable packet", visitor_.undecryptable_packets_[0]->data(),
visitor_.undecryptable_packets_[0]->length(), AsChars(p), p_length);
if (framer_.version().KnowsWhichDecrypterToUse()) {
@@ -12527,10 +12528,10 @@
ASSERT_EQ(1u, visitor_.undecryptable_has_decryption_keys_.size());
// Make sure we only receive the first undecryptable packet and not the
// full packet including the second coalesced packet.
- CompareCharArraysWithHexError("undecryptable packet",
- visitor_.undecryptable_packets_[0]->data(),
- visitor_.undecryptable_packets_[0]->length(),
- AsChars(p), length_of_first_coalesced_packet);
+ quiche::test::CompareCharArraysWithHexError(
+ "undecryptable packet", visitor_.undecryptable_packets_[0]->data(),
+ visitor_.undecryptable_packets_[0]->length(), AsChars(p),
+ length_of_first_coalesced_packet);
EXPECT_EQ(ENCRYPTION_HANDSHAKE, visitor_.undecryptable_decryption_levels_[0]);
EXPECT_TRUE(visitor_.undecryptable_has_decryption_keys_[0]);
@@ -13254,9 +13255,9 @@
EXPECT_TRUE(QuicFramer::WriteClientVersionNegotiationProbePacket(
packet, sizeof(packet), destination_connection_id_bytes,
sizeof(destination_connection_id_bytes)));
- test::CompareCharArraysWithHexError("constructed packet", packet,
- sizeof(packet), expected_packet,
- sizeof(expected_packet));
+ quiche::test::CompareCharArraysWithHexError("constructed packet", packet,
+ sizeof(packet), expected_packet,
+ sizeof(expected_packet));
QuicEncryptedPacket encrypted(reinterpret_cast<const char*>(packet),
sizeof(packet), false);
// Make sure we fail to parse this packet for the version under test.
@@ -13354,9 +13355,9 @@
EXPECT_TRUE(QuicFramer::WriteClientVersionNegotiationProbePacket(
packet, sizeof(packet), destination_connection_id_bytes,
sizeof(destination_connection_id_bytes)));
- test::CompareCharArraysWithHexError("constructed packet", packet,
- sizeof(packet), expected_packet,
- sizeof(expected_packet));
+ quiche::test::CompareCharArraysWithHexError("constructed packet", packet,
+ sizeof(packet), expected_packet,
+ sizeof(expected_packet));
QuicEncryptedPacket encrypted(reinterpret_cast<const char*>(packet),
sizeof(packet), false);
if (!framer_.version().HasLengthPrefixedConnectionIds()) {
@@ -13555,7 +13556,7 @@
reinterpret_cast<char*>(parsed_probe_payload_bytes),
&parsed_probe_payload_length, &parse_detailed_error));
EXPECT_EQ("", parse_detailed_error);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"parsed probe", parsed_probe_payload_bytes, parsed_probe_payload_length,
probe_payload_bytes, sizeof(probe_payload_bytes));
}
@@ -13586,7 +13587,7 @@
reinterpret_cast<char*>(parsed_probe_payload_bytes),
&parsed_probe_payload_length, &parse_detailed_error));
EXPECT_EQ("", parse_detailed_error);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"parsed probe", parsed_probe_payload_bytes, parsed_probe_payload_length,
probe_payload_bytes, sizeof(probe_payload_bytes));
}
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc
index cbf18a4..0f3a778 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -33,6 +33,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.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"
using testing::_;
using testing::DoAll;
@@ -656,7 +657,7 @@
QuicPacket data(creator_.transport_version(), buffer.release(), length, true,
header);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data.data(), data.length(),
reinterpret_cast<char*>(packet), QUICHE_ARRAYSIZE(packet));
}
@@ -734,9 +735,9 @@
QuicPacket data(creator_.transport_version(), buffer.release(), length, true,
header);
- test::CompareCharArraysWithHexError("constructed packet", data.data(),
- data.length(), reinterpret_cast<char*>(p),
- packet_size);
+ quiche::test::CompareCharArraysWithHexError(
+ "constructed packet", data.data(), data.length(),
+ reinterpret_cast<char*>(p), packet_size);
}
// Several tests that the path response connectivity probing packet is
@@ -783,7 +784,7 @@
QuicPacket data(creator_.transport_version(), buffer.release(), length, true,
header);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data.data(), data.length(),
reinterpret_cast<char*>(packet), QUICHE_ARRAYSIZE(packet));
}
@@ -830,7 +831,7 @@
QuicPacket data(creator_.transport_version(), buffer.release(), length, true,
header);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data.data(), data.length(),
reinterpret_cast<char*>(packet), QUICHE_ARRAYSIZE(packet));
}
@@ -882,7 +883,7 @@
QuicPacket data(creator_.transport_version(), buffer.release(), length, true,
header);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data.data(), data.length(),
reinterpret_cast<char*>(packet), QUICHE_ARRAYSIZE(packet));
}
@@ -936,7 +937,7 @@
QuicPacket data(creator_.transport_version(), buffer.release(), length, true,
header);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"constructed packet", data.data(), data.length(),
reinterpret_cast<char*>(packet), QUICHE_ARRAYSIZE(packet));
}
@@ -1968,7 +1969,7 @@
ASSERT_TRUE(header.version_flag);
ASSERT_EQ(header.long_packet_type, INITIAL);
ASSERT_EQ(header.retry_token.length(), sizeof(retry_token_bytes));
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"retry token", header.retry_token.data(), header.retry_token.length(),
retry_token_bytes, sizeof(retry_token_bytes));
DeleteFrames(&frames_);
diff --git a/quic/core/quic_packets_test.cc b/quic/core/quic_packets_test.cc
index e080cd8..1ccaabc 100644
--- a/quic/core/quic_packets_test.cc
+++ b/quic/core/quic_packets_test.cc
@@ -7,6 +7,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
#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/test_tools/quiche_test_utils.h"
namespace quic {
namespace test {
@@ -97,7 +98,7 @@
EXPECT_EQ(ACK_FRAME, copy->nonretransmittable_frames[0].type);
EXPECT_EQ(PADDING_FRAME, copy->nonretransmittable_frames[1].type);
EXPECT_EQ(1000u, copy->encrypted_length);
- test::CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"encrypted_buffer", copy->encrypted_buffer, copy->encrypted_length,
packet.encrypted_buffer, packet.encrypted_length);
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc
index 7197427..a28f85c 100644
--- a/quic/test_tools/crypto_test_utils.cc
+++ b/quic/test_tools/crypto_test_utils.cc
@@ -39,6 +39,7 @@
#include "net/third_party/quiche/src/quic/test_tools/simple_quic_framer.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 quic {
namespace test {
@@ -558,12 +559,12 @@
quiche::QuicheStringPiece encrypter_iv = encrypter->GetNoncePrefix();
quiche::QuicheStringPiece decrypter_key = decrypter->GetKey();
quiche::QuicheStringPiece decrypter_iv = decrypter->GetNoncePrefix();
- CompareCharArraysWithHexError(label + " key", encrypter_key.data(),
- encrypter_key.length(), decrypter_key.data(),
- decrypter_key.length());
- CompareCharArraysWithHexError(label + " iv", encrypter_iv.data(),
- encrypter_iv.length(), decrypter_iv.data(),
- decrypter_iv.length());
+ quiche::test::CompareCharArraysWithHexError(
+ label + " key", encrypter_key.data(), encrypter_key.length(),
+ decrypter_key.data(), decrypter_key.length());
+ quiche::test::CompareCharArraysWithHexError(
+ label + " iv", encrypter_iv.data(), encrypter_iv.length(),
+ decrypter_iv.data(), decrypter_iv.length());
}
} // namespace
@@ -601,10 +602,10 @@
client->crypto_negotiated_params().subkey_secret;
quiche::QuicheStringPiece server_subkey_secret =
server->crypto_negotiated_params().subkey_secret;
- CompareCharArraysWithHexError("subkey secret", client_subkey_secret.data(),
- client_subkey_secret.length(),
- server_subkey_secret.data(),
- server_subkey_secret.length());
+ quiche::test::CompareCharArraysWithHexError(
+ "subkey secret", client_subkey_secret.data(),
+ client_subkey_secret.length(), server_subkey_secret.data(),
+ server_subkey_secret.length());
const char kSampleLabel[] = "label";
const char kSampleContext[] = "context";
@@ -617,7 +618,7 @@
EXPECT_TRUE(server->ExportKeyingMaterial(kSampleLabel, kSampleContext,
kSampleOutputLength,
&server_key_extraction));
- CompareCharArraysWithHexError(
+ quiche::test::CompareCharArraysWithHexError(
"sample key extraction", client_key_extraction.data(),
client_key_extraction.length(), server_key_extraction.data(),
server_key_extraction.length());
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index f86f2b5..2e01c66 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -767,50 +767,6 @@
MockNetworkChangeVisitor::~MockNetworkChangeVisitor() {}
-namespace {
-
-std::string HexDumpWithMarks(const char* data,
- int length,
- const bool* marks,
- int mark_length) {
- static const char kHexChars[] = "0123456789abcdef";
- static const int kColumns = 4;
-
- const int kSizeLimit = 1024;
- if (length > kSizeLimit || mark_length > kSizeLimit) {
- QUIC_LOG(ERROR) << "Only dumping first " << kSizeLimit << " bytes.";
- length = std::min(length, kSizeLimit);
- mark_length = std::min(mark_length, kSizeLimit);
- }
-
- std::string hex;
- for (const char* row = data; length > 0;
- row += kColumns, length -= kColumns) {
- for (const char* p = row; p < row + 4; ++p) {
- if (p < row + length) {
- const bool mark =
- (marks && (p - data) < mark_length && marks[p - data]);
- hex += mark ? '*' : ' ';
- hex += kHexChars[(*p & 0xf0) >> 4];
- hex += kHexChars[*p & 0x0f];
- hex += mark ? '*' : ' ';
- } else {
- hex += " ";
- }
- }
- hex = hex + " ";
-
- for (const char* p = row; p < row + 4 && p < row + length; ++p) {
- hex += (*p >= 0x20 && *p <= 0x7f) ? (*p) : '.';
- }
-
- hex = hex + '\n';
- }
- return hex;
-}
-
-} // namespace
-
QuicIpAddress TestPeerIPAddress() {
return QuicIpAddress::Loopback4();
}
@@ -1067,37 +1023,6 @@
return new QuicEncryptedPacket(buffer, encrypted_length, true);
}
-void CompareCharArraysWithHexError(const std::string& description,
- const char* actual,
- const int actual_len,
- const char* expected,
- const int expected_len) {
- EXPECT_EQ(actual_len, expected_len);
- const int min_len = std::min(actual_len, expected_len);
- const int max_len = std::max(actual_len, expected_len);
- std::unique_ptr<bool[]> marks(new bool[max_len]);
- bool identical = (actual_len == expected_len);
- for (int i = 0; i < min_len; ++i) {
- if (actual[i] != expected[i]) {
- marks[i] = true;
- identical = false;
- } else {
- marks[i] = false;
- }
- }
- for (int i = min_len; i < max_len; ++i) {
- marks[i] = true;
- }
- if (identical)
- return;
- ADD_FAILURE() << "Description:\n"
- << description << "\n\nExpected:\n"
- << HexDumpWithMarks(expected, expected_len, marks.get(),
- max_len)
- << "\nActual:\n"
- << HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
-}
-
QuicConfig DefaultQuicConfig() {
QuicConfig config;
config.SetInitialMaxStreamDataBytesIncomingBidirectionalToSend(
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 15d8111..7a59f7d 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -168,12 +168,6 @@
ParsedQuicVersion version,
Perspective perspective);
-void CompareCharArraysWithHexError(const std::string& description,
- const char* actual,
- const int actual_len,
- const char* expected,
- const int expected_len);
-
// Returns QuicConfig set to default values.
QuicConfig DefaultQuicConfig();