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/core/quic_flow_controller_test.cc b/quic/core/quic_flow_controller_test.cc
index 771b2e2..299f922 100644
--- a/quic/core/quic_flow_controller_test.cc
+++ b/quic/core/quic_flow_controller_test.cc
@@ -16,6 +16,7 @@
 #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
 
 using testing::_;
+using testing::Invoke;
 
 namespace quic {
 namespace test {
@@ -45,11 +46,6 @@
         should_auto_tune_receive_window_, &session_flow_controller_);
   }
 
-  bool ClearControlFrame(const QuicFrame& frame) {
-    DeleteFrame(&const_cast<QuicFrame&>(frame));
-    return true;
-  }
-
  protected:
   QuicStreamId stream_id_ = 1234;
   QuicByteCount send_window_ = kInitialSessionFlowControlWindowForTest;
@@ -243,7 +239,7 @@
   // This test will generate two WINDOW_UPDATE frames.
   EXPECT_CALL(*connection_, SendControlFrame(_))
       .Times(2)
-      .WillRepeatedly(Invoke(this, &QuicFlowControllerTest::ClearControlFrame));
+      .WillRepeatedly(Invoke(&ClearControlFrame));
   EXPECT_FALSE(flow_controller_->auto_tune_receive_window());
 
   // Make sure clock is inititialized.
@@ -353,7 +349,7 @@
   // This test will generate two WINDOW_UPDATE frames.
   EXPECT_CALL(*connection_, SendControlFrame(_))
       .Times(2)
-      .WillRepeatedly(Invoke(this, &QuicFlowControllerTest::ClearControlFrame));
+      .WillRepeatedly(Invoke(&ClearControlFrame));
   EXPECT_FALSE(flow_controller_->auto_tune_receive_window());
 
   // Make sure clock is inititialized.