[quic] Clean up single-arg `testing::Invoke()`s in rest of `core/`

`core/quic*` is handled in a separate CL.

Deprecated by cl/795969677. This CL should be a no-op.

PiperOrigin-RevId: 803179244
diff --git a/quiche/quic/core/batch_writer/quic_gso_batch_writer_test.cc b/quiche/quic/core/batch_writer/quic_gso_batch_writer_test.cc
index f26ad28..2911f81 100644
--- a/quiche/quic/core/batch_writer/quic_gso_batch_writer_test.cc
+++ b/quiche/quic/core/batch_writer/quic_gso_batch_writer_test.cc
@@ -18,7 +18,6 @@
 #include "quiche/quic/test_tools/quic_mock_syscall_wrapper.h"
 
 using testing::_;
-using testing::Invoke;
 using testing::StrictMock;
 
 namespace quic {
@@ -270,10 +269,10 @@
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 0), WritePacket(&writer, 1000));
 
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(1100u, PacketLength(msg));
         return 1100;
-      }));
+      });
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 1100), WritePacket(&writer, 100));
   ASSERT_EQ(0u, writer.batch_buffer().SizeInUse());
   ASSERT_EQ(0u, writer.buffered_writes().size());
@@ -286,11 +285,11 @@
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 0), WritePacket(&writer, 100));
 
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(200u, PacketLength(msg));
         errno = EWOULDBLOCK;
         return -1;
-      }));
+      });
   ASSERT_EQ(WriteResult(WRITE_STATUS_BLOCKED, EWOULDBLOCK),
             WritePacket(&writer, 150));
   ASSERT_EQ(200u, writer.batch_buffer().SizeInUse());
@@ -304,11 +303,11 @@
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 0), WritePacket(&writer, 100));
 
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(250u, PacketLength(msg));
         errno = EWOULDBLOCK;
         return -1;
-      }));
+      });
   ASSERT_EQ(WriteResult(WRITE_STATUS_BLOCKED_DATA_BUFFERED, EWOULDBLOCK),
             WritePacket(&writer, 50));
 
@@ -325,11 +324,11 @@
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 0), WritePacket(&writer, 100));
 
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(200u, PacketLength(msg));
         errno = EPERM;
         return -1;
-      }));
+      });
   WriteResult error_result = WritePacket(&writer, 150);
   ASSERT_EQ(WriteResult(WRITE_STATUS_ERROR, EPERM), error_result);
 
@@ -345,11 +344,11 @@
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 0), WritePacket(&writer, 100));
 
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(250u, PacketLength(msg));
         errno = EPERM;
         return -1;
-      }));
+      });
   WriteResult error_result = WritePacket(&writer, 50);
   ASSERT_EQ(WriteResult(WRITE_STATUS_ERROR, EPERM), error_result);
 
@@ -365,11 +364,11 @@
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 0), WritePacket(&writer, 100));
 
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(200u, PacketLength(msg));
         errno = EINVAL;
         return -1;
-      }));
+      });
   WriteResult error_result = writer.Flush();
   ASSERT_EQ(WriteResult(WRITE_STATUS_ERROR, EINVAL), error_result);
 
@@ -406,11 +405,11 @@
   // The 3rd packet has more delay and does not allow burst.
   // The first 2 packets are flushed due to different release time.
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(2700u, PacketLength(msg));
         errno = 0;
         return 0;
-      }));
+      });
   params.release_time_delay = QuicTime::Delta::FromMilliseconds(5);
   params.allow_burst = false;
   result = WritePacketWithParams(writer.get(), params);
@@ -428,11 +427,11 @@
   // The 5th packet has same delay, allows burst, but is shorter.
   // Packets 3,4 and 5 are flushed.
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         EXPECT_EQ(3000u, PacketLength(msg));
         errno = 0;
         return 0;
-      }));
+      });
   params.allow_burst = true;
   EXPECT_EQ(MillisToNanos(6),
             writer->GetReleaseTime(params).actual_release_time);
@@ -476,7 +475,7 @@
   // The first 2 packets are flushed due to different codepoint.
   params.ecn_codepoint = ECN_ECT1;
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         const int kEct0 = 0x02;
         EXPECT_EQ(2700u, PacketLength(msg));
         msghdr mutable_msg;
@@ -490,7 +489,7 @@
         }
         errno = 0;
         return 0;
-      }));
+      });
   result = WritePacketWithParams(writer.get(), params);
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 2700), result);
 }
@@ -522,7 +521,7 @@
   // The first 2 packets are flushed due to different codepoint.
   params.ecn_codepoint = ECN_ECT1;
   EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
-      .WillOnce(Invoke([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+      .WillOnce([](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
         const int kEct0 = 0x02;
         EXPECT_EQ(2700u, PacketLength(msg));
         msghdr mutable_msg;
@@ -537,7 +536,7 @@
         }
         errno = 0;
         return 0;
-      }));
+      });
   result = WritePacketWithParams(writer.get(), params);
   ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 2700), result);
 }
@@ -562,7 +561,7 @@
 
     EXPECT_CALL(mock_syscalls_, Sendmsg(_, _, _))
         .WillOnce(
-            Invoke([&params](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
+            [&params](int /*sockfd*/, const msghdr* msg, int /*flags*/) {
               EXPECT_EQ(1350u, PacketLength(msg));
               msghdr mutable_msg;
               memcpy(&mutable_msg, msg, sizeof(*msg));
@@ -582,7 +581,7 @@
               EXPECT_EQ(params.flow_label != 0, found_flow_label);
               errno = 0;
               return 0;
-            }));
+            });
     WriteResult error_result = writer->Flush();
     ASSERT_EQ(WriteResult(WRITE_STATUS_OK, 1350), error_result);
   }
diff --git a/quiche/quic/core/http/end_to_end_test.cc b/quiche/quic/core/http/end_to_end_test.cc
index 5103cae..e756308 100644
--- a/quiche/quic/core/http/end_to_end_test.cc
+++ b/quiche/quic/core/http/end_to_end_test.cc
@@ -129,7 +129,6 @@
 using ::testing::_;
 using ::testing::Assign;
 using ::testing::HasSubstr;
-using ::testing::Invoke;
 using ::testing::NiceMock;
 using ::testing::UnorderedElementsAreArray;
 
@@ -2519,7 +2518,7 @@
 
   // The 0-RTT handshake should succeed.
   ON_CALL(visitor, OnCryptoFrame(_))
-      .WillByDefault(Invoke([this](const QuicCryptoFrame& frame) {
+      .WillByDefault([this](const QuicCryptoFrame& frame) {
         if (frame.level != ENCRYPTION_HANDSHAKE) {
           return;
         }
@@ -2540,7 +2539,7 @@
         EXPECT_GT(
             client_->SendMessage(headers, "", /*fin*/ true, /*flush*/ false),
             0);
-      }));
+      });
   client_->Connect();
   ASSERT_TRUE(client_->client()->WaitForOneRttKeysAvailable());
   client_->WaitForWriteToFlush();
@@ -2594,9 +2593,9 @@
   server_writer_ = new PacketDroppingTestWriter();
   StartServer();
 
-  ON_CALL(visitor, OnZeroRttRejected(_)).WillByDefault(Invoke([this]() {
+  ON_CALL(visitor, OnZeroRttRejected(_)).WillByDefault([this]() {
     EXPECT_FALSE(GetClientSession()->IsEncryptionEstablished());
-  }));
+  });
 
   // The 0-RTT handshake should fail.
   client_->Connect();
@@ -6767,12 +6766,12 @@
   NiceMock<MockQuicConnectionDebugVisitor> visitor;
   connection_debug_visitor_ = &visitor;
   EXPECT_CALL(visitor, OnTransportParametersSent(_))
-      .WillOnce(Invoke([kCustomParameter](
-                           const TransportParameters& transport_parameters) {
+      .WillOnce([kCustomParameter](
+                    const TransportParameters& transport_parameters) {
         auto it = transport_parameters.custom_parameters.find(kCustomParameter);
         ASSERT_NE(it, transport_parameters.custom_parameters.end());
         EXPECT_EQ(it->second, "test");
-      }));
+      });
   EXPECT_CALL(visitor, OnTransportParametersReceived(_)).Times(1);
   ASSERT_TRUE(Initialize());
 
@@ -8440,9 +8439,9 @@
   NiceMock<MockQuicConnectionDebugVisitor> visitor;
   connection_debug_visitor_ = &visitor;
   EXPECT_CALL(visitor, OnTransportParametersReceived(_))
-      .WillOnce(Invoke([](const TransportParameters& transport_parameters) {
+      .WillOnce([](const TransportParameters& transport_parameters) {
         EXPECT_EQ(nullptr, transport_parameters.preferred_address);
-      }));
+      });
   ASSERT_TRUE(Initialize());
   EXPECT_TRUE(client_->client()->WaitForHandshakeConfirmed());
 }
diff --git a/quiche/quic/core/http/quic_send_control_stream_test.cc b/quiche/quic/core/http/quic_send_control_stream_test.cc
index fabeb1b..7f9a58d 100644
--- a/quiche/quic/core/http/quic_send_control_stream_test.cc
+++ b/quiche/quic/core/http/quic_send_control_stream_test.cc
@@ -223,7 +223,7 @@
       };
 
   EXPECT_CALL(session_, WritevData(send_control_stream_->id(), _, _, _, _, _))
-      .WillRepeatedly(Invoke(save_write_data));
+      .WillRepeatedly(save_write_data);
 
   send_control_stream_->MaybeSendSettingsFrame();
   quiche::test::CompareCharArraysWithHexError(
diff --git a/quiche/quic/core/http/quic_spdy_client_session_test.cc b/quiche/quic/core/http/quic_spdy_client_session_test.cc
index 057f918..d1c2d52 100644
--- a/quiche/quic/core/http/quic_spdy_client_session_test.cc
+++ b/quiche/quic/core/http/quic_spdy_client_session_test.cc
@@ -338,7 +338,7 @@
 
   EXPECT_CALL(*connection_, SendControlFrame(_))
       .Times(AtLeast(1))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*connection_, OnStreamReset(_, _)).Times(1);
   session_->ResetStream(stream_id, QUIC_STREAM_PEER_GOING_AWAY);
 
@@ -389,7 +389,7 @@
   QuicStreamId stream_id = stream->id();
   EXPECT_CALL(*connection_, SendControlFrame(_))
       .Times(AtLeast(1))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*connection_, OnStreamReset(_, _)).Times(1);
   session_->ResetStream(stream_id, QUIC_STREAM_PEER_GOING_AWAY);
 
diff --git a/quiche/quic/core/http/quic_spdy_session_test.cc b/quiche/quic/core/http/quic_spdy_session_test.cc
index 34e532b..996daa2 100644
--- a/quiche/quic/core/http/quic_spdy_session_test.cc
+++ b/quiche/quic/core/http/quic_spdy_session_test.cc
@@ -481,12 +481,12 @@
   void CloseStream(QuicStreamId id) {
     if (!VersionHasIetfQuicFrames(transport_version())) {
       EXPECT_CALL(*connection_, SendControlFrame(_))
-          .WillOnce(Invoke(&ClearControlFrame));
+          .WillOnce(&ClearControlFrame);
     } else {
       // IETF QUIC has two frames, RST_STREAM and STOP_SENDING
       EXPECT_CALL(*connection_, SendControlFrame(_))
           .Times(2)
-          .WillRepeatedly(Invoke(&ClearControlFrame));
+          .WillRepeatedly(&ClearControlFrame);
     }
     EXPECT_CALL(*connection_, OnStreamReset(id, _));
 
@@ -542,7 +542,7 @@
         connection_->perspective() == Perspective::IS_SERVER) {
       // HANDSHAKE_DONE frame.
       EXPECT_CALL(*connection_, SendControlFrame(_))
-          .WillOnce(Invoke(&ClearControlFrame));
+          .WillOnce(&ClearControlFrame);
     }
 
     CryptoHandshakeMessage message;
@@ -880,15 +880,15 @@
   EXPECT_CALL(*send_algorithm, GetCongestionWindow())
       .WillRepeatedly(Return(kMaxOutgoingPacketSize * 10));
   EXPECT_CALL(*send_algorithm, InRecovery()).WillRepeatedly(Return(false));
-  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
     session_->SendStreamData(stream2);
-  }));
-  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+  });
+  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
     session_->SendStreamData(stream4);
-  }));
-  EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(Invoke([this, stream6]() {
+  });
+  EXPECT_CALL(*stream6, OnCanWrite()).WillOnce([this, stream6]() {
     session_->SendStreamData(stream6);
-  }));
+  });
 
   // Expect that we only send one packet, the writes from different streams
   // should be bundled together.
@@ -919,14 +919,14 @@
   session_->MarkConnectionLevelWriteBlocked(stream4->id());
 
   EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true));
-  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
     session_->SendStreamData(stream2);
-  }));
+  });
   EXPECT_CALL(*send_algorithm, GetCongestionWindow()).Times(AnyNumber());
   EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true));
-  EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(Invoke([this, stream6]() {
+  EXPECT_CALL(*stream6, OnCanWrite()).WillOnce([this, stream6]() {
     session_->SendStreamData(stream6);
-  }));
+  });
   EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(false));
   // stream4->OnCanWrite is not called.
 
@@ -941,9 +941,9 @@
   // stream4->OnCanWrite is called once the connection stops being
   // congestion-control blocked.
   EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true));
-  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
     session_->SendStreamData(stream4);
-  }));
+  });
   EXPECT_CALL(*send_algorithm, OnApplicationLimited(_));
   session_->OnCanWrite();
   EXPECT_FALSE(session_->WillingAndAbleToWrite());
@@ -1012,16 +1012,16 @@
   TestCryptoStream* crypto_stream = session_->GetMutableCryptoStream();
   EXPECT_CALL(*crypto_stream, OnCanWrite());
 
-  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
     session_->SendStreamData(stream2);
-  }));
-  EXPECT_CALL(*stream3, OnCanWrite()).WillOnce(Invoke([this, stream3]() {
+  });
+  EXPECT_CALL(*stream3, OnCanWrite()).WillOnce([this, stream3]() {
     session_->SendStreamData(stream3);
-  }));
-  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+  });
+  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
     session_->SendStreamData(stream4);
     session_->MarkConnectionLevelWriteBlocked(stream4->id());
-  }));
+  });
 
   session_->OnCanWrite();
   EXPECT_TRUE(session_->WillingAndAbleToWrite());
@@ -1043,13 +1043,13 @@
 
   InSequence s;
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
-  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+      .WillRepeatedly(&ClearControlFrame);
+  EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
     session_->SendStreamData(stream2);
-  }));
-  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+  });
+  EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
     session_->SendStreamData(stream4);
-  }));
+  });
   session_->OnCanWrite();
   EXPECT_FALSE(session_->WillingAndAbleToWrite());
 }
@@ -1263,8 +1263,7 @@
     // HTTP/3 GOAWAY doesn't have such restriction.
     return;
   }
-  EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillOnce(Invoke(&ClearControlFrame));
+  EXPECT_CALL(*connection_, SendControlFrame(_)).WillOnce(&ClearControlFrame);
   session_->SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
   EXPECT_TRUE(session_->goaway_sent());
   session_->SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
@@ -1530,8 +1529,7 @@
   EXPECT_FALSE(session_->IsStreamFlowControlBlocked());
   QuicStreamId stream_id = 5;
   // Write until the header stream is flow control blocked.
-  EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillOnce(Invoke(&ClearControlFrame));
+  EXPECT_CALL(*connection_, SendControlFrame(_)).WillOnce(&ClearControlFrame);
   HttpHeaderBlock headers;
   SimpleRandom random;
   while (!headers_stream->IsFlowControlBlocked() && stream_id < 2000) {
@@ -1575,7 +1573,7 @@
   Initialize();
 
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   CompleteHandshake();
   // Test that when we receive an out of order stream RST we correctly adjust
   // our connection level flow control receive window.
@@ -2215,7 +2213,7 @@
   EXPECT_CALL(*stream2, OnCanWrite());
   EXPECT_CALL(*stream2, HasPendingRetransmission()).WillOnce(Return(false));
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*stream2, OnCanWrite());
   EXPECT_CALL(*stream6, OnCanWrite());
   session_->OnCanWrite();
@@ -2231,8 +2229,7 @@
   TestStream* stream2 = session_->CreateOutgoingBidirectionalStream();
   TestStream* stream4 = session_->CreateOutgoingBidirectionalStream();
   TestStream* stream6 = session_->CreateOutgoingBidirectionalStream();
-  EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillOnce(Invoke(&ClearControlFrame));
+  EXPECT_CALL(*connection_, SendControlFrame(_)).WillOnce(&ClearControlFrame);
   session_->SendWindowUpdate(stream2->id(), 9);
 
   QuicStreamFrame frame1(stream2->id(), false, 0, 9);
@@ -2248,8 +2245,7 @@
 
   EXPECT_CALL(*stream2, RetransmitStreamData(_, _, _, _))
       .WillOnce(Return(true));
-  EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillOnce(Invoke(&ClearControlFrame));
+  EXPECT_CALL(*connection_, SendControlFrame(_)).WillOnce(&ClearControlFrame);
   EXPECT_CALL(*stream4, RetransmitStreamData(_, _, _, _))
       .WillOnce(Return(true));
   EXPECT_CALL(*stream6, RetransmitStreamData(_, _, _, _))
@@ -2457,7 +2453,7 @@
 
     // A STOP_SENDING frame is sent in response to the unknown stream type.
     EXPECT_CALL(*connection_, SendControlFrame(_))
-        .WillOnce(Invoke([stream_id](const QuicFrame& frame) {
+        .WillOnce([stream_id](const QuicFrame& frame) {
           EXPECT_EQ(STOP_SENDING_FRAME, frame.type);
 
           const QuicStopSendingFrame& stop_sending = frame.stop_sending_frame;
@@ -2468,7 +2464,7 @@
               stop_sending.ietf_error_code);
 
           return ClearControlFrame(frame);
-        }));
+        });
     session_->OnStreamFrame(frame);
 
     PendingStream* pending =
@@ -2509,7 +2505,7 @@
     session_->OnStreamFrame(frame2);
     // A STOP_SENDING frame is sent in response to the unknown stream type.
     EXPECT_CALL(*connection_, SendControlFrame(_))
-        .WillOnce(Invoke(&VerifyAndClearStopSendingFrame));
+        .WillOnce(&VerifyAndClearStopSendingFrame);
     session_->OnStreamFrame(frame1);
 
     PendingStream* pending =
@@ -2555,7 +2551,7 @@
     session_->OnStreamFrame(frame1);
     // A STOP_SENDING frame is sent in response to the unknown stream type.
     EXPECT_CALL(*connection_, SendControlFrame(_))
-        .WillOnce(Invoke(&VerifyAndClearStopSendingFrame));
+        .WillOnce(&VerifyAndClearStopSendingFrame);
     session_->OnStreamFrame(frame2);
 
     PendingStream* pending =
@@ -2801,7 +2797,7 @@
 
   // A STOP_SENDING frame is sent in response to the unknown stream type.
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillOnce(Invoke(&VerifyAndClearStopSendingFrame));
+      .WillOnce(&VerifyAndClearStopSendingFrame);
   session_->OnStreamFrame(frame);
 
   // There are no active streams.
@@ -2850,7 +2846,7 @@
 
   // A STOP_SENDING frame is sent in response to the unknown stream type.
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillOnce(Invoke(&VerifyAndClearStopSendingFrame));
+      .WillOnce(&VerifyAndClearStopSendingFrame);
   session_->OnStreamFrame(frame);
 
   // The pending stream is still around, because it did not receive a FIN.
@@ -3975,7 +3971,7 @@
   EXPECT_EQ(web_transport->NumberOfAssociatedStreams(), 1u);
 
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*connection_, OnStreamReset(session_id, _));
   EXPECT_CALL(
       *connection_,
@@ -3998,7 +3994,7 @@
 
   const int streams_to_send = kMaxUnassociatedWebTransportStreams + 4;
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*connection_,
               OnStreamReset(
                   _, QUIC_STREAM_WEBTRANSPORT_BUFFERED_STREAMS_LIMIT_EXCEEDED))
@@ -4020,7 +4016,7 @@
             kMaxUnassociatedWebTransportStreams);
 
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*connection_, OnStreamReset(_, _))
       .Times(kMaxUnassociatedWebTransportStreams + 1);
   session_->ResetStream(session_id, QUIC_STREAM_INTERNAL_ERROR);
@@ -4082,7 +4078,7 @@
   QuicStreamId stream_id = stream->GetStreamId();
 
   EXPECT_CALL(*connection_, SendControlFrame(_))
-      .WillRepeatedly(Invoke(&ClearControlFrame));
+      .WillRepeatedly(&ClearControlFrame);
   EXPECT_CALL(*connection_, OnStreamReset(session_id, _));
   EXPECT_CALL(*connection_,
               OnStreamReset(stream_id, QUIC_STREAM_WEBTRANSPORT_SESSION_GONE));
diff --git a/quiche/quic/core/http/quic_spdy_stream_test.cc b/quiche/quic/core/http/quic_spdy_stream_test.cc
index c4736fd..32ea045 100644
--- a/quiche/quic/core/http/quic_spdy_stream_test.cc
+++ b/quiche/quic/core/http/quic_spdy_stream_test.cc
@@ -474,7 +474,7 @@
         session_->perspective() == Perspective::IS_SERVER) {
       // HANDSHAKE_DONE frame.
       EXPECT_CALL(*connection_, SendControlFrame(_))
-          .WillOnce(Invoke(&ClearControlFrame));
+          .WillOnce(&ClearControlFrame);
     }
     CryptoHandshakeMessage message;
     session_->GetMutableCryptoStream()->OnHandshakeMessage(message);
@@ -731,18 +731,17 @@
 
   EXPECT_CALL(*connection_,
               CloseConnection(QUIC_HTTP_FRAME_UNEXPECTED_ON_SPDY_STREAM, _, _))
-      .WillOnce(
-          (Invoke([this](QuicErrorCode error, const std::string& error_details,
-                         ConnectionCloseBehavior connection_close_behavior) {
-            connection_->ReallyCloseConnection(error, error_details,
-                                               connection_close_behavior);
-          })));
+      .WillOnce([this](QuicErrorCode error, const std::string& error_details,
+                       ConnectionCloseBehavior connection_close_behavior) {
+        connection_->ReallyCloseConnection(error, error_details,
+                                           connection_close_behavior);
+      });
   EXPECT_CALL(*connection_, SendConnectionClosePacket(_, _, _));
   EXPECT_CALL(*session_, OnConnectionClosed(_, _))
-      .WillOnce(Invoke([this](const QuicConnectionCloseFrame& frame,
-                              ConnectionCloseSource source) {
+      .WillOnce([this](const QuicConnectionCloseFrame& frame,
+                       ConnectionCloseSource source) {
         session_->ReallyOnConnectionClosed(frame, source);
-      }));
+      });
   EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)).Times(2);
 
   stream_->OnStreamFrame(frame);
@@ -2291,18 +2290,17 @@
                       MatchesRegex("Error decoding headers on stream \\d+: "
                                    "Incomplete header block."),
                       _))
-      .WillOnce(
-          (Invoke([this](QuicErrorCode error, const std::string& error_details,
-                         ConnectionCloseBehavior connection_close_behavior) {
-            connection_->ReallyCloseConnection(error, error_details,
-                                               connection_close_behavior);
-          })));
+      .WillOnce([this](QuicErrorCode error, const std::string& error_details,
+                       ConnectionCloseBehavior connection_close_behavior) {
+        connection_->ReallyCloseConnection(error, error_details,
+                                           connection_close_behavior);
+      });
   EXPECT_CALL(*connection_, SendConnectionClosePacket(_, _, _));
   EXPECT_CALL(*session_, OnConnectionClosed(_, _))
-      .WillOnce(Invoke([this](const QuicConnectionCloseFrame& frame,
-                              ConnectionCloseSource source) {
+      .WillOnce([this](const QuicConnectionCloseFrame& frame,
+                       ConnectionCloseSource source) {
         session_->ReallyOnConnectionClosed(frame, source);
-      }));
+      });
   EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)).Times(2);
   stream_->OnStreamFrame(frame);
 }
@@ -2328,18 +2326,17 @@
                         MatchesRegex("Error decoding headers on stream \\d+: "
                                      "Invalid relative index."),
                         _))
-        .WillOnce((
-            Invoke([this](QuicErrorCode error, const std::string& error_details,
-                          ConnectionCloseBehavior connection_close_behavior) {
-              connection_->ReallyCloseConnection(error, error_details,
-                                                 connection_close_behavior);
-            })));
+        .WillOnce([this](QuicErrorCode error, const std::string& error_details,
+                         ConnectionCloseBehavior connection_close_behavior) {
+          connection_->ReallyCloseConnection(error, error_details,
+                                             connection_close_behavior);
+        });
     EXPECT_CALL(*connection_, SendConnectionClosePacket(_, _, _));
     EXPECT_CALL(*session_, OnConnectionClosed(_, _))
-        .WillOnce(Invoke([this](const QuicConnectionCloseFrame& frame,
-                                ConnectionCloseSource source) {
+        .WillOnce([this](const QuicConnectionCloseFrame& frame,
+                         ConnectionCloseSource source) {
           session_->ReallyOnConnectionClosed(frame, source);
-        }));
+        });
   }
   EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), _, _));
   EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream2_->id(), _, _));
@@ -2900,15 +2897,15 @@
   std::string metadata_frame = metadata_frame_header + metadata_frame_payload;
 
   EXPECT_CALL(metadata_visitor, OnMetadataComplete(metadata_frame.size(), _))
-      .WillOnce(testing::WithArgs<1>(
-          Invoke([&headers](const QuicHeaderList& header_list) {
+      .WillOnce(
+          testing::WithArgs<1>([&headers](const QuicHeaderList& header_list) {
             quiche::HttpHeaderBlock actual_headers;
             for (const auto& header : header_list) {
               actual_headers.AppendValueOrAddHeader(header.first,
                                                     header.second);
             }
             EXPECT_EQ(headers, actual_headers);
-          })));
+          }));
   OnStreamFrame(metadata_frame);
 }
 
@@ -2943,7 +2940,7 @@
   // receive a callback about the second.
   EXPECT_CALL(metadata_visitor, OnMetadataComplete(metadata_frame.size(), _))
       .WillOnce(testing::WithArgs<1>(
-          Invoke([&headers, this](const QuicHeaderList& header_list) {
+          [&headers, this](const QuicHeaderList& header_list) {
             quiche::HttpHeaderBlock actual_headers;
             for (const auto& header : header_list) {
               actual_headers.AppendValueOrAddHeader(header.first,
@@ -2951,7 +2948,7 @@
             }
             EXPECT_EQ(headers, actual_headers);
             stream_->Reset(QUIC_STREAM_CANCELLED);
-          })));
+          }));
   std::string data = metadata_frame + metadata_frame;
   OnStreamFrame(data);
 }
diff --git a/quiche/quic/core/qpack/qpack_decoder_test.cc b/quiche/quic/core/qpack/qpack_decoder_test.cc
index b15ffc5..8f83ee9 100644
--- a/quiche/quic/core/qpack/qpack_decoder_test.cc
+++ b/quiche/quic/core/qpack/qpack_decoder_test.cc
@@ -18,7 +18,6 @@
 
 using ::testing::_;
 using ::testing::Eq;
-using ::testing::Invoke;
 using ::testing::Mock;
 using ::testing::Sequence;
 using ::testing::StrictMock;
@@ -50,10 +49,10 @@
     // Destroy QpackProgressiveDecoder on error to test that it does not crash.
     // See https://crbug.com/1025209.
     ON_CALL(handler_, OnDecodingErrorDetected(_, _))
-        .WillByDefault(Invoke([this](QuicErrorCode /* error_code */,
-                                     absl::string_view /* error_message */) {
+        .WillByDefault([this](QuicErrorCode /* error_code */,
+                              absl::string_view /* error_message */) {
           progressive_decoder_.reset();
-        }));
+        });
   }
 
   void DecodeEncoderStreamData(absl::string_view data) {
diff --git a/quiche/quic/core/tls_server_handshaker_test.cc b/quiche/quic/core/tls_server_handshaker_test.cc
index 71721e9..be182a8 100644
--- a/quiche/quic/core/tls_server_handshaker_test.cc
+++ b/quiche/quic/core/tls_server_handshaker_test.cc
@@ -145,14 +145,14 @@
       QuicDelayedSSLConfig dealyed_ssl_config = QuicDelayedSSLConfig()) {
     EXPECT_CALL(*this, MaybeCreateProofSourceHandle())
         .WillOnce(
-            testing::Invoke([this, select_cert_action, compute_signature_action,
-                             dealyed_ssl_config]() {
+            [this, select_cert_action, compute_signature_action,
+             dealyed_ssl_config]() {
               auto handle = std::make_unique<FakeProofSourceHandle>(
                   proof_source_, this, select_cert_action,
                   compute_signature_action, dealyed_ssl_config);
               fake_proof_source_handle_ = handle.get();
               return handle;
-            }));
+            });
   }
 
   FakeProofSourceHandle* fake_proof_source_handle() {
@@ -1268,20 +1268,19 @@
           FAIL_SYNC_DO_NOT_CHECK_CLOSED);
 
   EXPECT_CALL(*server_handshaker_, OverrideQuicConfigDefaults(_))
-      .WillOnce(testing::Invoke([](QuicConfig* config) {
+      .WillOnce([](QuicConfig* config) {
         QuicConfigPeer::SetReceivedMaxUnidirectionalStreams(config,
                                                             /*max_streams=*/0);
-      }));
+      });
 
   EXPECT_CALL(*server_connection_,
               CloseConnection(QUIC_ZERO_RTT_RESUMPTION_LIMIT_REDUCED, _, _))
-      .WillOnce(testing::Invoke(
-          [this](QuicErrorCode error, const std::string& details,
-                 ConnectionCloseBehavior connection_close_behavior) {
-            server_connection_->ReallyCloseConnection(
-                error, details, connection_close_behavior);
-            ASSERT_FALSE(server_connection_->connected());
-          }));
+      .WillOnce([this](QuicErrorCode error, const std::string& details,
+                       ConnectionCloseBehavior connection_close_behavior) {
+        server_connection_->ReallyCloseConnection(error, details,
+                                                  connection_close_behavior);
+        ASSERT_FALSE(server_connection_->connected());
+      });
 
   AdvanceHandshakeWithFakeClient();