Use quiche string libraries in //third_party/quic/core/crypto
gfe-relnote: n/a, no functional change
PiperOrigin-RevId: 285405224
Change-Id: I4a7f6d34ee42a2929cbbff2f303ee36b5b6ceb8a
diff --git a/quic/core/crypto/common_cert_set_test.cc b/quic/core/crypto/common_cert_set_test.cc
index 04720e1..148914d 100644
--- a/quic/core/crypto/common_cert_set_test.cc
+++ b/quic/core/crypto/common_cert_set_test.cc
@@ -7,6 +7,7 @@
#include <cstdint>
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -192,8 +193,8 @@
class CommonCertSetsTest : public QuicTest {};
TEST_F(CommonCertSetsTest, FindGIA_2) {
- QuicStringPiece gia(reinterpret_cast<const char*>(kGIACertificate2),
- sizeof(kGIACertificate2));
+ quiche::QuicheStringPiece gia(reinterpret_cast<const char*>(kGIACertificate2),
+ sizeof(kGIACertificate2));
const CommonCertSets* sets(CommonCertSets::GetInstanceQUIC());
// Common Cert Set 2's hash.
@@ -202,19 +203,20 @@
uint32_t index;
ASSERT_TRUE(sets->MatchCert(
gia,
- QuicStringPiece(reinterpret_cast<const char*>(&in_hash), sizeof(in_hash)),
+ quiche::QuicheStringPiece(reinterpret_cast<const char*>(&in_hash),
+ sizeof(in_hash)),
&hash, &index));
EXPECT_EQ(in_hash, hash);
- QuicStringPiece gia_copy = sets->GetCert(hash, index);
+ quiche::QuicheStringPiece gia_copy = sets->GetCert(hash, index);
EXPECT_FALSE(gia_copy.empty());
ASSERT_EQ(gia.size(), gia_copy.size());
EXPECT_EQ(0, memcmp(gia.data(), gia_copy.data(), gia.size()));
}
TEST_F(CommonCertSetsTest, FindGIA_3) {
- QuicStringPiece gia(reinterpret_cast<const char*>(kGIACertificate3),
- sizeof(kGIACertificate3));
+ quiche::QuicheStringPiece gia(reinterpret_cast<const char*>(kGIACertificate3),
+ sizeof(kGIACertificate3));
const CommonCertSets* sets(CommonCertSets::GetInstanceQUIC());
// Common Cert Set 3's hash.
@@ -223,11 +225,12 @@
uint32_t index;
ASSERT_TRUE(sets->MatchCert(
gia,
- QuicStringPiece(reinterpret_cast<const char*>(&in_hash), sizeof(in_hash)),
+ quiche::QuicheStringPiece(reinterpret_cast<const char*>(&in_hash),
+ sizeof(in_hash)),
&hash, &index));
EXPECT_EQ(in_hash, hash);
- QuicStringPiece gia_copy = sets->GetCert(hash, index);
+ quiche::QuicheStringPiece gia_copy = sets->GetCert(hash, index);
EXPECT_FALSE(gia_copy.empty());
ASSERT_EQ(gia.size(), gia_copy.size());
EXPECT_EQ(0, memcmp(gia.data(), gia_copy.data(), gia.size()));
@@ -235,13 +238,14 @@
TEST_F(CommonCertSetsTest, NonMatch) {
const CommonCertSets* sets(CommonCertSets::GetInstanceQUIC());
- QuicStringPiece not_a_cert("hello");
+ quiche::QuicheStringPiece not_a_cert("hello");
const uint64_t in_hash = UINT64_C(0xc9fef74053f99f39);
uint64_t hash;
uint32_t index;
EXPECT_FALSE(sets->MatchCert(
not_a_cert,
- QuicStringPiece(reinterpret_cast<const char*>(&in_hash), sizeof(in_hash)),
+ quiche::QuicheStringPiece(reinterpret_cast<const char*>(&in_hash),
+ sizeof(in_hash)),
&hash, &index));
}