Add ClearControlFrame() to quic_test_utils.
This function does not have to live in a class and does not need seven identical
definitions.
gfe-relnote: n/a, test-only refactoring.
PiperOrigin-RevId: 254999491
Change-Id: I1173acb47388e3a5ca010c927c4e886d3b6ab387
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index 6ffcb8c..99c7511 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -153,6 +153,11 @@
return std::string(buffer, QUIC_ARRAYSIZE(buffer));
}
+bool ClearControlFrame(const QuicFrame& frame) {
+ DeleteFrame(&const_cast<QuicFrame&>(frame));
+ return true;
+}
+
uint64_t SimpleRandom::RandUint64() {
uint64_t result;
RandBytes(&result, sizeof(result));
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 4acc275..85611d0 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -208,6 +208,9 @@
// Compute SHA-1 hash of the supplied std::string.
std::string Sha1Hash(QuicStringPiece data);
+// Delete |frame| and return true.
+bool ClearControlFrame(const QuicFrame& frame);
+
// Simple random number generator used to compute random numbers suitable
// for pseudo-randomly dropping packets in tests.
class SimpleRandom : public QuicRandom {