Replace QuicString with std::string, pass 1
This replaces QuicString with std::string in all of the "QUIC proper". I will
delete QuicString once all code using it is gone.
gfe-relnote: n/a (no functional change)
PiperOrigin-RevId: 237872023
Change-Id: I82de62c9855516b15039734d05155917e68ff4ee
diff --git a/quic/core/crypto/crypto_secret_boxer_test.cc b/quic/core/crypto/crypto_secret_boxer_test.cc
index d060051..8739977 100644
--- a/quic/core/crypto/crypto_secret_boxer_test.cc
+++ b/quic/core/crypto/crypto_secret_boxer_test.cc
@@ -17,29 +17,30 @@
QuicStringPiece message("hello world");
CryptoSecretBoxer boxer;
- boxer.SetKeys({QuicString(CryptoSecretBoxer::GetKeySize(), 0x11)});
+ boxer.SetKeys({std::string(CryptoSecretBoxer::GetKeySize(), 0x11)});
- const QuicString box = boxer.Box(QuicRandom::GetInstance(), message);
+ const std::string box = boxer.Box(QuicRandom::GetInstance(), message);
- QuicString storage;
+ std::string storage;
QuicStringPiece result;
EXPECT_TRUE(boxer.Unbox(box, &storage, &result));
EXPECT_EQ(result, message);
- EXPECT_FALSE(boxer.Unbox(QuicString(1, 'X') + box, &storage, &result));
- EXPECT_FALSE(boxer.Unbox(box.substr(1, QuicString::npos), &storage, &result));
- EXPECT_FALSE(boxer.Unbox(QuicString(), &storage, &result));
+ EXPECT_FALSE(boxer.Unbox(std::string(1, 'X') + box, &storage, &result));
+ EXPECT_FALSE(
+ boxer.Unbox(box.substr(1, std::string::npos), &storage, &result));
+ EXPECT_FALSE(boxer.Unbox(std::string(), &storage, &result));
EXPECT_FALSE(boxer.Unbox(
- QuicString(1, box[0] ^ 0x80) + box.substr(1, QuicString::npos), &storage,
- &result));
+ std::string(1, box[0] ^ 0x80) + box.substr(1, std::string::npos),
+ &storage, &result));
}
// Helper function to test whether one boxer can decode the output of another.
static bool CanDecode(const CryptoSecretBoxer& decoder,
const CryptoSecretBoxer& encoder) {
QuicStringPiece message("hello world");
- const QuicString boxed = encoder.Box(QuicRandom::GetInstance(), message);
- QuicString storage;
+ const std::string boxed = encoder.Box(QuicRandom::GetInstance(), message);
+ std::string storage;
QuicStringPiece result;
bool ok = decoder.Unbox(boxed, &storage, &result);
if (ok) {
@@ -49,8 +50,8 @@
}
TEST_F(CryptoSecretBoxerTest, MultipleKeys) {
- QuicString key_11(CryptoSecretBoxer::GetKeySize(), 0x11);
- QuicString key_12(CryptoSecretBoxer::GetKeySize(), 0x12);
+ std::string key_11(CryptoSecretBoxer::GetKeySize(), 0x11);
+ std::string key_12(CryptoSecretBoxer::GetKeySize(), 0x12);
CryptoSecretBoxer boxer_11, boxer_12, boxer;
boxer_11.SetKeys({key_11});