Remove Http2StringPiece; use QuicheStringPiece instead.
gfe-relnote: n/a, no functional change.
PiperOrigin-RevId: 285412823
Change-Id: I907a65813e890ce153b93fe5f07721efb3ecc195
diff --git a/http2/test_tools/frame_parts.cc b/http2/test_tools/frame_parts.cc
index d9dffa1..32d3a97 100644
--- a/http2/test_tools/frame_parts.cc
+++ b/http2/test_tools/frame_parts.cc
@@ -51,14 +51,15 @@
HTTP2_VLOG(1) << "FrameParts, header: " << frame_header_;
}
-FrameParts::FrameParts(const Http2FrameHeader& header, Http2StringPiece payload)
+FrameParts::FrameParts(const Http2FrameHeader& header,
+ quiche::QuicheStringPiece payload)
: FrameParts(header) {
HTTP2_VLOG(1) << "FrameParts with payload.size() = " << payload.size();
this->payload_.append(payload.data(), payload.size());
opt_payload_length_ = payload.size();
}
FrameParts::FrameParts(const Http2FrameHeader& header,
- Http2StringPiece payload,
+ quiche::QuicheStringPiece payload,
size_t total_pad_length)
: FrameParts(header, payload) {
HTTP2_VLOG(1) << "FrameParts with total_pad_length=" << total_pad_length;
@@ -117,8 +118,8 @@
}
}
-void FrameParts::SetAltSvcExpected(Http2StringPiece origin,
- Http2StringPiece value) {
+void FrameParts::SetAltSvcExpected(quiche::QuicheStringPiece origin,
+ quiche::QuicheStringPiece value) {
altsvc_origin_.append(origin.data(), origin.size());
altsvc_value_.append(value.data(), value.size());
opt_altsvc_origin_length_ = origin.size();
@@ -140,7 +141,7 @@
HTTP2_VLOG(1) << "OnDataPayload: len=" << len
<< "; frame_header_: " << frame_header_;
ASSERT_TRUE(InFrameOfType(Http2FrameType::DATA)) << *this;
- ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &payload_,
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(data, len), &payload_,
&opt_payload_length_));
}
@@ -172,7 +173,7 @@
ASSERT_TRUE(got_start_callback_);
ASSERT_FALSE(got_end_callback_);
ASSERT_TRUE(FrameCanHaveHpackPayload(frame_header_)) << *this;
- ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &payload_,
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(data, len), &payload_,
&opt_payload_length_));
}
@@ -216,8 +217,8 @@
HTTP2_VLOG(1) << "OnPadding: skipped_length=" << skipped_length;
ASSERT_TRUE(InPaddedFrame()) << *this;
ASSERT_TRUE(opt_pad_length_);
- ASSERT_TRUE(AppendString(Http2StringPiece(pad, skipped_length), &padding_,
- &opt_pad_length_));
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(pad, skipped_length),
+ &padding_, &opt_pad_length_));
}
void FrameParts::OnRstStream(const Http2FrameHeader& header,
@@ -313,7 +314,7 @@
void FrameParts::OnGoAwayOpaqueData(const char* data, size_t len) {
HTTP2_VLOG(1) << "OnGoAwayOpaqueData: len=" << len;
ASSERT_TRUE(InFrameOfType(Http2FrameType::GOAWAY)) << *this;
- ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &payload_,
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(data, len), &payload_,
&opt_payload_length_));
}
@@ -348,14 +349,14 @@
void FrameParts::OnAltSvcOriginData(const char* data, size_t len) {
HTTP2_VLOG(1) << "OnAltSvcOriginData: len=" << len;
ASSERT_TRUE(InFrameOfType(Http2FrameType::ALTSVC)) << *this;
- ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &altsvc_origin_,
- &opt_altsvc_origin_length_));
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(data, len),
+ &altsvc_origin_, &opt_altsvc_origin_length_));
}
void FrameParts::OnAltSvcValueData(const char* data, size_t len) {
HTTP2_VLOG(1) << "OnAltSvcValueData: len=" << len;
ASSERT_TRUE(InFrameOfType(Http2FrameType::ALTSVC)) << *this;
- ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &altsvc_value_,
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(data, len), &altsvc_value_,
&opt_altsvc_value_length_));
}
@@ -378,7 +379,7 @@
ASSERT_FALSE(IsSupportedHttp2FrameType(frame_header_.type)) << *this;
ASSERT_TRUE(got_start_callback_);
ASSERT_FALSE(got_end_callback_);
- ASSERT_TRUE(AppendString(Http2StringPiece(data, len), &payload_,
+ ASSERT_TRUE(AppendString(quiche::QuicheStringPiece(data, len), &payload_,
&opt_payload_length_));
}
@@ -506,7 +507,7 @@
return AssertionSuccess();
}
-AssertionResult FrameParts::AppendString(Http2StringPiece source,
+AssertionResult FrameParts::AppendString(quiche::QuicheStringPiece source,
std::string* target,
Http2Optional<size_t>* opt_length) {
target->append(source.data(), source.size());
diff --git a/http2/test_tools/frame_parts.h b/http2/test_tools/frame_parts.h
index 598a687..2d54143 100644
--- a/http2/test_tools/frame_parts.h
+++ b/http2/test_tools/frame_parts.h
@@ -22,7 +22,7 @@
#include "net/third_party/quiche/src/http2/http2_structures.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_optional.h"
-#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace http2 {
namespace test {
@@ -34,12 +34,12 @@
explicit FrameParts(const Http2FrameHeader& header);
// For use in tests where the expected frame has a variable size payload.
- FrameParts(const Http2FrameHeader& header, Http2StringPiece payload);
+ FrameParts(const Http2FrameHeader& header, quiche::QuicheStringPiece payload);
// For use in tests where the expected frame has a variable size payload
// and may be padded.
FrameParts(const Http2FrameHeader& header,
- Http2StringPiece payload,
+ quiche::QuicheStringPiece payload,
size_t total_pad_length);
// Copy constructor.
@@ -58,7 +58,8 @@
void SetTotalPadLength(size_t total_pad_length);
// Set the origin and value expected in an ALTSVC frame.
- void SetAltSvcExpected(Http2StringPiece origin, Http2StringPiece value);
+ void SetAltSvcExpected(quiche::QuicheStringPiece origin,
+ quiche::QuicheStringPiece value);
// Http2FrameDecoderListener methods:
bool OnFrameHeader(const Http2FrameHeader& header) override;
@@ -207,7 +208,7 @@
// Append source to target. If opt_length is not nullptr, then verifies that
// the optional has a value (i.e. that the necessary On*Start method has been
// called), and that target is not longer than opt_length->value().
- ::testing::AssertionResult AppendString(Http2StringPiece source,
+ ::testing::AssertionResult AppendString(quiche::QuicheStringPiece source,
std::string* target,
Http2Optional<size_t>* opt_length);
diff --git a/http2/test_tools/http2_random.cc b/http2/test_tools/http2_random.cc
index 6b61a58..df20364 100644
--- a/http2/test_tools/http2_random.cc
+++ b/http2/test_tools/http2_random.cc
@@ -16,7 +16,7 @@
HTTP2_LOG(INFO) << "Initialized test RNG with the following key: " << Key();
}
-Http2Random::Http2Random(Http2StringPiece key) {
+Http2Random::Http2Random(quiche::QuicheStringPiece key) {
std::string decoded_key = Http2HexDecode(key);
CHECK_EQ(sizeof(key_), decoded_key.size());
memcpy(key_, decoded_key.data(), sizeof(key_));
@@ -58,8 +58,9 @@
return value.f - 1.0;
}
-std::string Http2Random::RandStringWithAlphabet(int length,
- Http2StringPiece alphabet) {
+std::string Http2Random::RandStringWithAlphabet(
+ int length,
+ quiche::QuicheStringPiece alphabet) {
std::string result;
result.resize(length);
for (int i = 0; i < length; i++) {
diff --git a/http2/test_tools/http2_random.h b/http2/test_tools/http2_random.h
index 774212c..9f046a1 100644
--- a/http2/test_tools/http2_random.h
+++ b/http2/test_tools/http2_random.h
@@ -11,7 +11,7 @@
#include <random>
#include <string>
-#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace http2 {
namespace test {
@@ -28,7 +28,7 @@
// Reproducible random number generation: by using the same key, the same
// sequence of results is obtained.
- explicit Http2Random(Http2StringPiece key);
+ explicit Http2Random(quiche::QuicheStringPiece key);
std::string Key() const;
void FillRandom(void* buffer, size_t buffer_size);
@@ -67,7 +67,8 @@
// Return a random string consisting of the characters from the specified
// alphabet.
- std::string RandStringWithAlphabet(int length, Http2StringPiece alphabet);
+ std::string RandStringWithAlphabet(int length,
+ quiche::QuicheStringPiece alphabet);
// STL UniformRandomNumberGenerator implementation.
using result_type = uint64_t;