[quic] Clean up single-arg `testing::Invoke()`s in `core/quic_[d-z]*`
Deprecated by cl/795969677. This CL should be a no-op.
PiperOrigin-RevId: 803138127
diff --git a/quiche/quic/core/quic_dispatcher_test.cc b/quiche/quic/core/quic_dispatcher_test.cc
index 3260f9c..f20c4c8 100644
--- a/quiche/quic/core/quic_dispatcher_test.cc
+++ b/quiche/quic/core/quic_dispatcher_test.cc
@@ -561,9 +561,9 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.WillOnce(WithArg<2>(
- Invoke([this, connection_id](const QuicEncryptedPacket& packet) {
+ [this, connection_id](const QuicEncryptedPacket& packet) {
ValidatePacket(connection_id, packet);
- })));
+ }));
ProcessFirstFlight(version, client_address, connection_id);
}
@@ -654,9 +654,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
OnParsedClientHelloInfo(MatchParsedClientHello()))
.Times(1);
@@ -713,9 +713,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, old_id);
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
@@ -822,9 +822,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
EXPECT_CALL(
@@ -837,17 +837,17 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session2_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session2_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(2), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(2));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.Times(1)
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessPacket(client_address, TestConnectionId(1), false, "data");
}
@@ -866,10 +866,9 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.Times(2)
- .WillRepeatedly(
- WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
- ValidatePacket(TestConnectionId(1), packet);
- })));
+ .WillRepeatedly(WithArg<2>([this](const QuicEncryptedPacket& packet) {
+ ValidatePacket(TestConnectionId(1), packet);
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
// Packet number 256 with packet number length 1 would be considered as 0 in
// dispatcher.
@@ -1005,9 +1004,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
@@ -1031,9 +1030,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, connection_id);
@@ -1218,9 +1217,9 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.WillOnce(WithArg<2>(
- Invoke([this, bad_connection_id](const QuicEncryptedPacket& packet) {
+ [this, bad_connection_id](const QuicEncryptedPacket& packet) {
ValidatePacket(bad_connection_id, packet);
- })));
+ }));
ProcessFirstFlight(client_address, bad_connection_id);
}
@@ -1243,9 +1242,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
generated_connection_id_ = kReturnConnectionId;
@@ -1259,17 +1258,17 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session2_->connection()),
ProcessUdpPacket(_, _, _))
.WillOnce(WithArg<2>(
- Invoke([this, bad_connection_id](const QuicEncryptedPacket& packet) {
+ [this, bad_connection_id](const QuicEncryptedPacket& packet) {
ValidatePacket(bad_connection_id, packet);
- })));
+ }));
ProcessFirstFlight(client_address, bad_connection_id);
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.Times(1)
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessPacket(client_address, TestConnectionId(1), false, "data");
}
@@ -1831,9 +1830,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
dispatcher_->StopAcceptingNewConnections();
@@ -1851,9 +1850,9 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.Times(1u)
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessPacket(client_address, TestConnectionId(1), false, "data");
}
@@ -1882,9 +1881,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
}
@@ -1992,9 +1991,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, client_address,
@@ -2005,9 +2004,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session2_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session2_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(2), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(2));
blocked_list_ = QuicDispatcherPeer::GetWriteBlockedList(dispatcher_.get());
@@ -2272,9 +2271,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(1), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(1));
}
@@ -2288,9 +2287,9 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session2_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session2_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(Invoke([this](const QuicEncryptedPacket& packet) {
+ .WillOnce(WithArg<2>([this](const QuicEncryptedPacket& packet) {
ValidatePacket(TestConnectionId(2), packet);
- })));
+ }));
ProcessFirstFlight(client_address, TestConnectionId(2));
}
@@ -2589,11 +2588,11 @@
ProcessUdpPacket(_, _, _))
.Times(2) // non-CHLO + CHLO.
.WillRepeatedly(
- WithArg<2>(Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(conn_id, packet);
}
- })));
+ }));
expect_generator_is_called_ = false;
ProcessFirstFlight(conn_id);
}
@@ -2627,11 +2626,11 @@
ProcessUdpPacket(_, _, _))
.Times(kDefaultMaxUndecryptablePackets + 1) // + 1 for CHLO.
.WillRepeatedly(
- WithArg<2>(Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(conn_id, packet);
}
- })));
+ }));
expect_generator_is_called_ = false;
ProcessFirstFlight(conn_id);
}
@@ -2677,12 +2676,12 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, client_address, _))
.Times(num_packet_to_process)
- .WillRepeatedly(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillRepeatedly(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(conn_id, packet);
}
- })));
+ }));
ProcessFirstFlight(client_address, conn_id);
}
}
@@ -2724,11 +2723,11 @@
ProcessUdpPacket(_, _, _))
.Times(3) // Triggered by 1 data packet and 2 CHLOs.
.WillRepeatedly(
- WithArg<2>(Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(conn_id, packet);
}
- })));
+ }));
std::vector<std::unique_ptr<QuicReceivedPacket>> packets =
GetFirstFlightOfPackets(version_, conn_id);
@@ -2800,12 +2799,12 @@
EXPECT_CALL(
*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillOnce(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
}
expect_generator_is_called_ = false;
ProcessFirstFlight(TestConnectionId(conn_id));
@@ -2837,12 +2836,12 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillOnce(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
}
EXPECT_CALL(connection_id_generator_,
MaybeReplaceConnectionId(TestConnectionId(kNumCHLOs), version_))
@@ -2880,12 +2879,12 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillOnce(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
ProcessFirstFlight(TestConnectionId(conn_id));
}
uint64_t conn_id = kNumCHLOs;
@@ -2924,12 +2923,11 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(
- WithArg<2>(Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
- if (version_.UsesQuicCrypto()) {
- ValidatePacket(TestConnectionId(conn_id), packet);
- }
- })));
+ .WillOnce(WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
+ if (version_.UsesQuicCrypto()) {
+ ValidatePacket(TestConnectionId(conn_id), packet);
+ }
+ }));
while (store->HasChlosBuffered()) {
dispatcher_->ProcessBufferedChlos(kMaxNumSessionsToCreate);
}
@@ -2952,12 +2950,12 @@
EXPECT_CALL(
*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillOnce(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
}
ProcessFirstFlight(TestConnectionId(conn_id));
}
@@ -2981,11 +2979,11 @@
ProcessUdpPacket(_, _, _))
.Times(packets_buffered)
.WillRepeatedly(WithArg<2>(
- Invoke([this, last_connection](const QuicEncryptedPacket& packet) {
+ [this, last_connection](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(last_connection, packet);
}
- })));
+ }));
dispatcher_->ProcessBufferedChlos(kMaxNumSessionsToCreate);
}
@@ -3006,12 +3004,12 @@
EXPECT_CALL(
*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillRepeatedly(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillRepeatedly(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
}
ProcessFirstFlight(TestConnectionId(conn_id));
}
@@ -3046,11 +3044,11 @@
ProcessUdpPacket(_, _, _))
.Times(last_connection_buffered_packets->buffered_packets.size())
.WillRepeatedly(WithArg<2>(
- Invoke([this, last_connection_id](const QuicEncryptedPacket& packet) {
+ [this, last_connection_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(last_connection_id, packet);
}
- })));
+ }));
dispatcher_->ProcessBufferedChlos(kMaxNumSessionsToCreate);
}
@@ -3080,12 +3078,12 @@
EXPECT_CALL(
*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillOnce(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
} else if (!version_.UsesTls()) {
expect_generator_is_called_ = false;
}
@@ -3124,12 +3122,12 @@
EXPECT_CALL(
*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillRepeatedly(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillRepeatedly(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
}
ProcessFirstFlight(version, TestConnectionId(conn_id));
}
@@ -3149,12 +3147,12 @@
QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))));
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillRepeatedly(WithArg<2>(
- Invoke([this, conn_id](const QuicEncryptedPacket& packet) {
+ .WillRepeatedly(
+ WithArg<2>([this, conn_id](const QuicEncryptedPacket& packet) {
if (version_.UsesQuicCrypto()) {
ValidatePacket(TestConnectionId(conn_id), packet);
}
- })));
+ }));
}
dispatcher_->ProcessBufferedChlos(kMaxNumSessionsToCreate);
}
@@ -3193,7 +3191,7 @@
EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
.Times(2) // non-CHLO + CHLO.
- .WillRepeatedly(WithArg<2>(Invoke([&](const QuicReceivedPacket& packet) {
+ .WillRepeatedly(WithArg<2>([&](const QuicReceivedPacket& packet) {
switch (packet.ecn_codepoint()) {
case ECN_ECT1:
got_ect1 = true;
@@ -3204,7 +3202,7 @@
default:
break;
}
- })));
+ }));
QuicConnectionId client_connection_id = TestConnectionId(2);
std::vector<std::unique_ptr<QuicReceivedPacket>> packets =
GetFirstFlightOfPackets(version_, DefaultQuicConfig(), conn_id,
diff --git a/quiche/quic/core/quic_flow_controller_test.cc b/quiche/quic/core/quic_flow_controller_test.cc
index 567b120..87207d6 100644
--- a/quiche/quic/core/quic_flow_controller_test.cc
+++ b/quiche/quic/core/quic_flow_controller_test.cc
@@ -17,7 +17,6 @@
#include "quiche/quic/test_tools/quic_test_utils.h"
using testing::_;
-using testing::Invoke;
using testing::StrictMock;
namespace quic {
@@ -251,7 +250,7 @@
// This test will generate two WINDOW_UPDATE frames.
EXPECT_CALL(*session_, WriteControlFrame(_, _))
.Times(2)
- .WillRepeatedly(Invoke(&ClearControlFrameWithTransmissionType));
+ .WillRepeatedly(&ClearControlFrameWithTransmissionType);
EXPECT_FALSE(flow_controller_->auto_tune_receive_window());
// Make sure clock is inititialized.
@@ -361,7 +360,7 @@
// This test will generate two WINDOW_UPDATE frames.
EXPECT_CALL(*session_, WriteControlFrame(_, _))
.Times(2)
- .WillRepeatedly(Invoke(&ClearControlFrameWithTransmissionType));
+ .WillRepeatedly(&ClearControlFrameWithTransmissionType);
EXPECT_FALSE(flow_controller_->auto_tune_receive_window());
// Make sure clock is inititialized.
diff --git a/quiche/quic/core/quic_framer_test.cc b/quiche/quic/core/quic_framer_test.cc
index e43c385..e368fe3 100644
--- a/quiche/quic/core/quic_framer_test.cc
+++ b/quiche/quic/core/quic_framer_test.cc
@@ -8709,8 +8709,7 @@
std::string bytes(len, 0x7c);
memcpy(data, bytes.data(), bytes.size());
};
- EXPECT_CALL(random, InsecureRandBytes(_, _))
- .WillOnce(testing::Invoke(generate_random_bytes));
+ EXPECT_CALL(random, InsecureRandBytes(_, _)).WillOnce(generate_random_bytes);
std::unique_ptr<QuicEncryptedPacket> data(
framer_.BuildIetfStatelessResetPacket(
FramerTestConnectionId(),
diff --git a/quiche/quic/core/quic_linux_socket_utils_test.cc b/quiche/quic/core/quic_linux_socket_utils_test.cc
index 1a910fe..cb37fb1 100644
--- a/quiche/quic/core/quic_linux_socket_utils_test.cc
+++ b/quiche/quic/core/quic_linux_socket_utils_test.cc
@@ -20,7 +20,6 @@
using testing::_;
using testing::InSequence;
-using testing::Invoke;
using testing::SetErrnoAndReturn;
namespace quic {
@@ -224,11 +223,11 @@
QuicSocketAddress(QuicIpAddress::Any4(), 0));
EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _))
- .WillOnce(Invoke([](int /*fd*/, mmsghdr* /*msgvec*/,
- unsigned int /*vlen*/, int /*flags*/) {
+ .WillOnce([](int /*fd*/, mmsghdr* /*msgvec*/, unsigned int /*vlen*/,
+ int /*flags*/) {
errno = EWOULDBLOCK;
return -1;
- }));
+ });
EXPECT_EQ(WriteResult(WRITE_STATUS_BLOCKED, EWOULDBLOCK),
TestWriteMultiplePackets(1, buffered_writes.begin(),
@@ -243,11 +242,11 @@
QuicSocketAddress(QuicIpAddress::Any4(), 0));
EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _))
- .WillOnce(Invoke([](int /*fd*/, mmsghdr* /*msgvec*/,
- unsigned int /*vlen*/, int /*flags*/) {
+ .WillOnce([](int /*fd*/, mmsghdr* /*msgvec*/, unsigned int /*vlen*/,
+ int /*flags*/) {
errno = EPERM;
return -1;
- }));
+ });
EXPECT_EQ(WriteResult(WRITE_STATUS_ERROR, EPERM),
TestWriteMultiplePackets(1, buffered_writes.begin(),
@@ -292,8 +291,8 @@
SCOPED_TRACE(testing::Message()
<< "expected_num_packets_sent=" << expected_num_packets_sent);
EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _))
- .WillOnce(Invoke([&](int /*fd*/, mmsghdr* msgvec, unsigned int vlen,
- int /*flags*/) {
+ .WillOnce([&](int /*fd*/, mmsghdr* msgvec, unsigned int vlen,
+ int /*flags*/) {
EXPECT_LE(static_cast<unsigned int>(expected_num_packets_sent), vlen);
for (unsigned int i = 0; i < vlen; ++i) {
const BufferedWrite& buffered_write = buffered_writes[i];
@@ -309,7 +308,7 @@
hdr.msg_control != nullptr);
}
return expected_num_packets_sent;
- }))
+ })
.RetiresOnSaturation();
int expected_bytes_written = 0;
diff --git a/quiche/quic/core/quic_packet_creator_test.cc b/quiche/quic/core/quic_packet_creator_test.cc
index 176e731..380b3d5 100644
--- a/quiche/quic/core/quic_packet_creator_test.cc
+++ b/quiche/quic/core/quic_packet_creator_test.cc
@@ -1779,9 +1779,9 @@
/*needs_full_padding=*/true, NOT_RETRANSMISSION, &frame));
EXPECT_CALL(delegate_, OnSerializedPacket(_))
- .WillOnce(Invoke([&external_buffer](SerializedPacket serialized_packet) {
+ .WillOnce([&external_buffer](SerializedPacket serialized_packet) {
EXPECT_EQ(external_buffer.buffer, serialized_packet.encrypted_buffer);
- }));
+ });
creator_.FlushCurrentPacket();
}
@@ -2345,9 +2345,9 @@
if (i < ENCRYPTION_FORWARD_SECURE) {
// Save coalesced packet.
EXPECT_CALL(framer_visitor_, OnCoalescedPacket(_))
- .WillOnce(Invoke([i, &packets](const QuicEncryptedPacket& packet) {
+ .WillOnce([i, &packets](const QuicEncryptedPacket& packet) {
packets[i + 1] = packet.Clone();
- }));
+ });
}
EXPECT_CALL(framer_visitor_, OnUnauthenticatedHeader(_));
EXPECT_CALL(framer_visitor_, OnDecryptedPacket(_, _));
@@ -2641,10 +2641,10 @@
frames.push_back(QuicFrame(&ack_frame_));
}
EXPECT_CALL(*delegate_, MaybeBundleOpportunistically(_))
- .WillOnce(Invoke([this, frames = std::move(frames)] {
+ .WillOnce([this, frames = std::move(frames)] {
FlushAckFrame(frames);
return QuicFrames();
- }));
+ });
return QuicPacketCreator::ConsumeRetransmittableControlFrame(frame);
}
@@ -4344,12 +4344,12 @@
// After exiting the scope, the last queued frame should be flushed.
EXPECT_TRUE(creator_.HasPendingFrames());
EXPECT_CALL(delegate_, OnSerializedPacket(_))
- .WillOnce(Invoke([=](SerializedPacket packet) {
+ .WillOnce([=](SerializedPacket packet) {
EXPECT_EQ(peer_addr, packet.peer_address);
ASSERT_EQ(2u, packet.retransmittable_frames.size());
EXPECT_EQ(STREAM_FRAME, packet.retransmittable_frames.front().type);
EXPECT_EQ(STREAM_FRAME, packet.retransmittable_frames.back().type);
- }));
+ });
creator_.FlushCurrentPacket();
}
@@ -4369,16 +4369,16 @@
QuicSocketAddress peer_addr1(QuicIpAddress::Any4(), 12346);
EXPECT_CALL(delegate_, OnSerializedPacket(_))
- .WillOnce(Invoke([=](SerializedPacket packet) {
+ .WillOnce([=](SerializedPacket packet) {
EXPECT_EQ(peer_addr, packet.peer_address);
ASSERT_EQ(1u, packet.retransmittable_frames.size());
EXPECT_EQ(STREAM_FRAME, packet.retransmittable_frames.front().type);
- }))
- .WillOnce(Invoke([=](SerializedPacket packet) {
+ })
+ .WillOnce([=](SerializedPacket packet) {
EXPECT_EQ(peer_addr1, packet.peer_address);
ASSERT_EQ(1u, packet.retransmittable_frames.size());
EXPECT_EQ(STREAM_FRAME, packet.retransmittable_frames.front().type);
- }));
+ });
EXPECT_TRUE(creator_.HasPendingFrames());
{
QuicConnectionId client_connection_id = TestConnectionId(1);
@@ -4426,7 +4426,7 @@
QuicSocketAddress peer_addr1(QuicIpAddress::Any4(), 12346);
EXPECT_CALL(delegate_, OnSerializedPacket(_))
- .WillOnce(Invoke([=, this](SerializedPacket packet) {
+ .WillOnce([=, this](SerializedPacket packet) {
EXPECT_EQ(peer_addr, packet.peer_address);
ASSERT_EQ(1u, packet.retransmittable_frames.size());
EXPECT_EQ(STREAM_FRAME, packet.retransmittable_frames.front().type);
@@ -4451,12 +4451,12 @@
// This should trigger another OnSerializedPacket() with the 2nd
// address.
creator_.FlushCurrentPacket();
- }))
- .WillOnce(Invoke([=](SerializedPacket packet) {
+ })
+ .WillOnce([=](SerializedPacket packet) {
EXPECT_EQ(peer_addr1, packet.peer_address);
ASSERT_EQ(1u, packet.retransmittable_frames.size());
EXPECT_EQ(STREAM_FRAME, packet.retransmittable_frames.front().type);
- }));
+ });
creator_.FlushCurrentPacket();
}
diff --git a/quiche/quic/core/quic_path_validator_test.cc b/quiche/quic/core/quic_path_validator_test.cc
index 62044b1..faca361 100644
--- a/quiche/quic/core/quic_path_validator_test.cc
+++ b/quiche/quic/core/quic_path_validator_test.cc
@@ -18,7 +18,6 @@
#include "quiche/quic/test_tools/quic_test_utils.h"
using testing::_;
-using testing::Invoke;
using testing::Return;
namespace quic {
@@ -76,12 +75,12 @@
EXPECT_CALL(send_delegate_,
SendPathChallenge(_, self_address_, peer_address_,
effective_peer_address_, &writer_))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer& payload,
- const QuicSocketAddress&, const QuicSocketAddress&,
- const QuicSocketAddress&, QuicPacketWriter*) {
+ .WillOnce([&](const QuicPathFrameBuffer& payload,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ const QuicSocketAddress&, QuicPacketWriter*) {
memcpy(challenge_data.data(), payload.data(), payload.size());
return true;
- }));
+ });
EXPECT_CALL(send_delegate_, GetRetryTimeout(peer_address_, &writer_));
const QuicTime expected_start_time = clock_.Now();
path_validator_.StartPathValidation(
@@ -93,12 +92,11 @@
path_validator_.GetPathValidationReason());
EXPECT_TRUE(path_validator_.IsValidatingPeerAddress(effective_peer_address_));
EXPECT_CALL(*result_delegate_, OnPathValidationSuccess(_, _))
- .WillOnce(
- Invoke([=, this](std::unique_ptr<QuicPathValidationContext> context,
- QuicTime start_time) {
- EXPECT_EQ(context.get(), context_);
- EXPECT_EQ(start_time, expected_start_time);
- }));
+ .WillOnce([=, this](std::unique_ptr<QuicPathValidationContext> context,
+ QuicTime start_time) {
+ EXPECT_EQ(context.get(), context_);
+ EXPECT_EQ(start_time, expected_start_time);
+ });
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(kInitialRttMs));
path_validator_.OnPathResponse(challenge_data, self_address_);
EXPECT_FALSE(path_validator_.HasPendingPathValidation());
@@ -111,12 +109,12 @@
EXPECT_CALL(send_delegate_,
SendPathChallenge(_, self_address_, peer_address_,
effective_peer_address_, &writer_))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer payload,
- const QuicSocketAddress&, const QuicSocketAddress&,
- const QuicSocketAddress&, QuicPacketWriter*) {
+ .WillOnce([&](const QuicPathFrameBuffer payload, const QuicSocketAddress&,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ QuicPacketWriter*) {
memcpy(challenge_data.data(), payload.data(), payload.size());
return true;
- }));
+ });
EXPECT_CALL(send_delegate_, GetRetryTimeout(peer_address_, &writer_));
const QuicTime expected_start_time = clock_.Now();
path_validator_.StartPathValidation(
@@ -131,12 +129,11 @@
path_validator_.OnPathResponse(challenge_data, kAlternativeSelfAddress);
EXPECT_CALL(*result_delegate_, OnPathValidationSuccess(_, _))
- .WillOnce(
- Invoke([=, this](std::unique_ptr<QuicPathValidationContext> context,
- QuicTime start_time) {
- EXPECT_EQ(context->self_address(), self_address_);
- EXPECT_EQ(start_time, expected_start_time);
- }));
+ .WillOnce([=, this](std::unique_ptr<QuicPathValidationContext> context,
+ QuicTime start_time) {
+ EXPECT_EQ(context->self_address(), self_address_);
+ EXPECT_EQ(start_time, expected_start_time);
+ });
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(kInitialRttMs));
path_validator_.OnPathResponse(challenge_data, self_address_);
EXPECT_EQ(PathValidationReason::kReasonUnknown,
@@ -148,19 +145,19 @@
EXPECT_CALL(send_delegate_,
SendPathChallenge(_, self_address_, peer_address_,
effective_peer_address_, &writer_))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer& payload,
- const QuicSocketAddress&, const QuicSocketAddress&,
- const QuicSocketAddress&, QuicPacketWriter*) {
+ .WillOnce([&](const QuicPathFrameBuffer& payload,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ const QuicSocketAddress&, QuicPacketWriter*) {
// Store up the 1st PATH_CHALLANGE payload.
memcpy(challenge_data.data(), payload.data(), payload.size());
return true;
- }))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer& payload,
- const QuicSocketAddress&, const QuicSocketAddress&,
- const QuicSocketAddress&, QuicPacketWriter*) {
+ })
+ .WillOnce([&](const QuicPathFrameBuffer& payload,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ const QuicSocketAddress&, QuicPacketWriter*) {
EXPECT_NE(payload, challenge_data);
return true;
- }));
+ });
EXPECT_CALL(send_delegate_, GetRetryTimeout(peer_address_, &writer_))
.Times(2u);
const QuicTime start_time = clock_.Now();
@@ -185,19 +182,19 @@
EXPECT_CALL(send_delegate_,
SendPathChallenge(_, self_address_, peer_address_,
effective_peer_address_, &writer_))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer& payload,
- const QuicSocketAddress&, const QuicSocketAddress&,
- const QuicSocketAddress&, QuicPacketWriter*) {
+ .WillOnce([&](const QuicPathFrameBuffer& payload,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ const QuicSocketAddress&, QuicPacketWriter*) {
memcpy(challenge_data.data(), payload.data(), payload.size());
return true;
- }))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer& payload,
- const QuicSocketAddress&, const QuicSocketAddress&,
- const QuicSocketAddress&, QuicPacketWriter*) {
+ })
+ .WillOnce([&](const QuicPathFrameBuffer& payload,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ const QuicSocketAddress&, QuicPacketWriter*) {
EXPECT_NE(challenge_data, payload);
memcpy(challenge_data.data(), payload.data(), payload.size());
return true;
- }));
+ });
EXPECT_CALL(send_delegate_, GetRetryTimeout(peer_address_, &writer_))
.Times(2u);
path_validator_.StartPathValidation(
@@ -237,10 +234,9 @@
// Retry 3 times. The 3rd time should fail the validation.
EXPECT_CALL(*result_delegate_, OnPathValidationFailure(_))
- .WillOnce(
- Invoke([=, this](std::unique_ptr<QuicPathValidationContext> context) {
- EXPECT_EQ(context_, context.get());
- }));
+ .WillOnce([=, this](std::unique_ptr<QuicPathValidationContext> context) {
+ EXPECT_EQ(context_, context.get());
+ });
for (size_t i = 0; i <= QuicPathValidator::kMaxRetryTimes; ++i) {
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(3 * kInitialRttMs));
alarm_factory_.FireAlarm(
@@ -254,14 +250,14 @@
EXPECT_CALL(send_delegate_,
SendPathChallenge(_, self_address_, peer_address_,
effective_peer_address_, &writer_))
- .WillOnce(Invoke([&](const QuicPathFrameBuffer&, const QuicSocketAddress&,
- const QuicSocketAddress&, const QuicSocketAddress&,
- QuicPacketWriter*) {
+ .WillOnce([&](const QuicPathFrameBuffer&, const QuicSocketAddress&,
+ const QuicSocketAddress&, const QuicSocketAddress&,
+ QuicPacketWriter*) {
// Abandon this validation in the call stack shouldn't cause crash and
// should cancel the alarm.
path_validator_.CancelPathValidation();
return false;
- }));
+ });
EXPECT_CALL(send_delegate_, GetRetryTimeout(peer_address_, &writer_))
.Times(0u);
EXPECT_CALL(*result_delegate_, OnPathValidationFailure(_));
diff --git a/quiche/quic/core/quic_sent_packet_manager_test.cc b/quiche/quic/core/quic_sent_packet_manager_test.cc
index 529d7bd..aa38362 100644
--- a/quiche/quic/core/quic_sent_packet_manager_test.cc
+++ b/quiche/quic/core/quic_sent_packet_manager_test.cc
@@ -47,7 +47,6 @@
using testing::_;
using testing::AnyNumber;
-using testing::Invoke;
using testing::InvokeWithoutArgs;
using testing::IsEmpty;
using testing::Pointwise;
@@ -245,10 +244,10 @@
if (transmission_type == HANDSHAKE_RETRANSMISSION ||
transmission_type == PTO_RETRANSMISSION) {
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(
- Invoke([this, new_packet_number](TransmissionType type) {
+ .WillOnce(
+ WithArgs<1>([this, new_packet_number](TransmissionType type) {
return RetransmitDataPacket(new_packet_number, type);
- })));
+ }));
} else {
EXPECT_CALL(notifier_, OnFrameLost(_)).Times(1);
is_lost = true;
@@ -406,9 +405,9 @@
TEST_F(QuicSentPacketManagerTest, RetransmitThenAckBeforeSend) {
SendDataPacket(1);
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(2, type);
- })));
+ }));
QuicSentPacketManagerPeer::MarkForRetransmission(&manager_, 1,
PTO_RETRANSMISSION);
// Ack 1.
@@ -1550,13 +1549,12 @@
EXPECT_CALL(
*send_algorithm_,
OnCongestionEvent(/*rtt_updated=*/false, kDefaultLength, _, _, _, _, _))
- .WillOnce(testing::WithArg<3>(
- Invoke([](const AckedPacketVector& acked_packets) {
- EXPECT_EQ(1u, acked_packets.size());
- EXPECT_EQ(QuicPacketNumber(1), acked_packets[0].packet_number);
- // The bytes in packet1 shouldn't contribute to congestion control.
- EXPECT_EQ(0u, acked_packets[0].bytes_acked);
- })));
+ .WillOnce(testing::WithArg<3>([](const AckedPacketVector& acked_packets) {
+ EXPECT_EQ(1u, acked_packets.size());
+ EXPECT_EQ(QuicPacketNumber(1), acked_packets[0].packet_number);
+ // The bytes in packet1 shouldn't contribute to congestion control.
+ EXPECT_EQ(0u, acked_packets[0].bytes_acked);
+ }));
EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
manager_.OnAckFrameStart(QuicPacketNumber(1), QuicTime::Delta::Infinite(),
clock_.Now());
@@ -1576,13 +1574,12 @@
EXPECT_CALL(
*send_algorithm_,
OnCongestionEvent(/*rtt_updated=*/true, kDefaultLength, _, _, _, _, _))
- .WillOnce(testing::WithArg<3>(
- Invoke([](const AckedPacketVector& acked_packets) {
- EXPECT_EQ(1u, acked_packets.size());
- EXPECT_EQ(QuicPacketNumber(2), acked_packets[0].packet_number);
- // The bytes in packet2 should contribute to congestion control.
- EXPECT_EQ(kDefaultLength, acked_packets[0].bytes_acked);
- })));
+ .WillOnce(testing::WithArg<3>([](const AckedPacketVector& acked_packets) {
+ EXPECT_EQ(1u, acked_packets.size());
+ EXPECT_EQ(QuicPacketNumber(2), acked_packets[0].packet_number);
+ // The bytes in packet2 should contribute to congestion control.
+ EXPECT_EQ(kDefaultLength, acked_packets[0].bytes_acked);
+ }));
EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
EXPECT_EQ(PACKETS_NEWLY_ACKED,
manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(2),
@@ -1596,10 +1593,10 @@
EXPECT_CALL(*loss_algorithm, GetLossTimeout())
.WillOnce(Return(clock_.Now() + QuicTime::Delta::FromMilliseconds(10)));
EXPECT_CALL(*loss_algorithm, DetectLosses(_, _, _, _, _, _))
- .WillOnce(WithArgs<5>(Invoke([](LostPacketVector* packet_lost) {
+ .WillOnce(WithArgs<5>([](LostPacketVector* packet_lost) {
packet_lost->emplace_back(QuicPacketNumber(3u), kDefaultLength);
return LossDetectionInterface::DetectionStats();
- })));
+ }));
EXPECT_CALL(notifier_, OnFrameLost(_));
EXPECT_CALL(*send_algorithm_,
OnCongestionEvent(false, kDefaultLength, _, _, _, _, _));
@@ -1646,10 +1643,10 @@
EXPECT_CALL(*loss_algorithm, GetLossTimeout())
.WillOnce(Return(clock_.Now() + QuicTime::Delta::FromMilliseconds(10)));
EXPECT_CALL(*loss_algorithm, DetectLosses(_, _, _, _, _, _))
- .WillOnce(WithArgs<5>(Invoke([](LostPacketVector* packet_lost) {
+ .WillOnce(WithArgs<5>([](LostPacketVector* packet_lost) {
packet_lost->emplace_back(QuicPacketNumber(4u), kDefaultLength);
return LossDetectionInterface::DetectionStats();
- })));
+ }));
EXPECT_CALL(notifier_, OnFrameLost(_));
EXPECT_CALL(*send_algorithm_,
OnCongestionEvent(false, kDefaultLength, _, _, _, _, _));
@@ -2027,9 +2024,9 @@
EXPECT_EQ(0u, stats_.max_consecutive_rto_with_forward_progress);
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
+ }));
manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the current value.
QuicTime sent_time = clock_.Now();
@@ -2086,9 +2083,9 @@
// Verify one probe packet gets sent.
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
+ }));
manager_.MaybeSendProbePacket();
}
@@ -2264,9 +2261,9 @@
// Verify probe packet gets sent.
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_HANDSHAKE);
- })));
+ }));
manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the current value.
const QuicTime packet3_sent_time = clock_.Now();
@@ -2412,9 +2409,9 @@
EXPECT_EQ(1u, stats_.pto_count);
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
+ }));
manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the current value and based on packet3.
QuicTime packet3_sent_time = clock_.Now();
@@ -2478,9 +2475,9 @@
EXPECT_EQ(1u, stats_.pto_count);
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
+ }));
manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the expected value and based on
// packet3 (right edge).
@@ -2657,13 +2654,12 @@
SendDataPacket(2, ENCRYPTION_HANDSHAKE);
EXPECT_CALL(notifier_, OnFrameAcked(_, _, _, _))
- .WillOnce(
- Invoke([](const QuicFrame& /*frame*/, QuicTime::Delta ack_delay_time,
- QuicTime receive_timestamp, bool) {
- EXPECT_TRUE(ack_delay_time.IsZero());
- EXPECT_EQ(receive_timestamp, QuicTime::Zero());
- return true;
- }));
+ .WillOnce([](const QuicFrame& /*frame*/, QuicTime::Delta ack_delay_time,
+ QuicTime receive_timestamp, bool) {
+ EXPECT_TRUE(ack_delay_time.IsZero());
+ EXPECT_EQ(receive_timestamp, QuicTime::Zero());
+ return true;
+ });
EXPECT_CALL(*send_algorithm_, OnPacketNeutered(QuicPacketNumber(2))).Times(1);
manager_.SetHandshakeConfirmed();
@@ -2782,9 +2778,9 @@
clock_.AdvanceTime(expected_pto_delay);
manager_.OnRetransmissionTimeout();
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(
- WithArgs<1>(Invoke([this]() { return RetransmitCryptoPacket(3); })));
+ EXPECT_CALL(notifier_, RetransmitFrames(_, _)).WillOnce(WithArgs<1>([this]() {
+ return RetransmitCryptoPacket(3);
+ }));
manager_.MaybeSendProbePacket();
// Verify exponential backoff of the PTO timeout.
EXPECT_EQ(clock_.Now() + 2 * expected_pto_delay,
@@ -2809,9 +2805,9 @@
clock_.AdvanceTime(expected_pto_delay);
manager_.OnRetransmissionTimeout();
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(
- WithArgs<1>(Invoke([this]() { return RetransmitCryptoPacket(3); })));
+ EXPECT_CALL(notifier_, RetransmitFrames(_, _)).WillOnce(WithArgs<1>([this]() {
+ return RetransmitCryptoPacket(3);
+ }));
manager_.MaybeSendProbePacket();
// Verify exponential backoff of the PTO timeout.
EXPECT_EQ(clock_.Now() + 2 * expected_pto_delay,
@@ -2918,9 +2914,9 @@
// Assume connection is going to send INITIAL ACK.
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(4, type, ENCRYPTION_INITIAL);
- })));
+ }));
manager_.RetransmitDataOfSpaceIfAny(INITIAL_DATA);
// Verify PTO is re-armed based on packet 2.
EXPECT_EQ(packet2_sent_time + expected_pto_delay,
@@ -2929,9 +2925,9 @@
// Connection is going to send another INITIAL ACK.
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ .WillOnce(WithArgs<1>([this](TransmissionType type) {
return RetransmitDataPacket(5, type, ENCRYPTION_INITIAL);
- })));
+ }));
manager_.RetransmitDataOfSpaceIfAny(INITIAL_DATA);
// Verify PTO does not change.
EXPECT_EQ(packet2_sent_time + expected_pto_delay,
@@ -3428,40 +3424,40 @@
manager_.SetDebugDelegate(&debug_delegate);
bool correct_report = false;
EXPECT_CALL(debug_delegate, OnIncomingAck(_, _, _, _, _, _, _))
- .WillOnce(Invoke(
- [&](QuicPacketNumber /*ack_packet_number*/,
- EncryptionLevel /*ack_decrypted_level*/,
- const QuicAckFrame& ack_frame, QuicTime /*ack_receive_time*/,
- QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
- QuicPacketNumber /*least_unacked_sent_packet*/) {
- correct_report = (ack_frame.ecn_counters == ecn_counts1);
- }));
+ .WillOnce([&](QuicPacketNumber /*ack_packet_number*/,
+ EncryptionLevel /*ack_decrypted_level*/,
+ const QuicAckFrame& ack_frame,
+ QuicTime /*ack_receive_time*/,
+ QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
+ QuicPacketNumber /*least_unacked_sent_packet*/) {
+ correct_report = (ack_frame.ecn_counters == ecn_counts1);
+ });
manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1), ENCRYPTION_INITIAL,
ecn_counts1);
EXPECT_TRUE(correct_report);
correct_report = false;
EXPECT_CALL(debug_delegate, OnIncomingAck(_, _, _, _, _, _, _))
- .WillOnce(Invoke(
- [&](QuicPacketNumber /*ack_packet_number*/,
- EncryptionLevel /*ack_decrypted_level*/,
- const QuicAckFrame& ack_frame, QuicTime /*ack_receive_time*/,
- QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
- QuicPacketNumber /*least_unacked_sent_packet*/) {
- correct_report = (ack_frame.ecn_counters == ecn_counts2);
- }));
+ .WillOnce([&](QuicPacketNumber /*ack_packet_number*/,
+ EncryptionLevel /*ack_decrypted_level*/,
+ const QuicAckFrame& ack_frame,
+ QuicTime /*ack_receive_time*/,
+ QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
+ QuicPacketNumber /*least_unacked_sent_packet*/) {
+ correct_report = (ack_frame.ecn_counters == ecn_counts2);
+ });
manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(2),
ENCRYPTION_HANDSHAKE, ecn_counts2);
EXPECT_TRUE(correct_report);
correct_report = false;
EXPECT_CALL(debug_delegate, OnIncomingAck(_, _, _, _, _, _, _))
- .WillOnce(Invoke(
- [&](QuicPacketNumber /*ack_packet_number*/,
- EncryptionLevel /*ack_decrypted_level*/,
- const QuicAckFrame& ack_frame, QuicTime /*ack_receive_time*/,
- QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
- QuicPacketNumber /*least_unacked_sent_packet*/) {
- correct_report = (ack_frame.ecn_counters == ecn_counts3);
- }));
+ .WillOnce([&](QuicPacketNumber /*ack_packet_number*/,
+ EncryptionLevel /*ack_decrypted_level*/,
+ const QuicAckFrame& ack_frame,
+ QuicTime /*ack_receive_time*/,
+ QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
+ QuicPacketNumber /*least_unacked_sent_packet*/) {
+ correct_report = (ack_frame.ecn_counters == ecn_counts3);
+ });
manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(3),
ENCRYPTION_FORWARD_SECURE, ecn_counts3);
EXPECT_TRUE(correct_report);
diff --git a/quiche/quic/core/quic_session_test.cc b/quiche/quic/core/quic_session_test.cc
index e5d2ae4..ed37f26 100644
--- a/quiche/quic/core/quic_session_test.cc
+++ b/quiche/quic/core/quic_session_test.cc
@@ -522,7 +522,7 @@
// READ_UNIDIRECTIONAL streams.
EXPECT_CALL(*connection_, SendControlFrame(IsFrame(STOP_SENDING_FRAME)))
.Times(1)
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(id, _)).Times(1);
} else if (QuicUtils::GetStreamType(
id, session_.perspective(), session_.IsIncomingStream(id),
@@ -531,20 +531,20 @@
// stream.
EXPECT_CALL(*connection_, SendControlFrame(IsFrame(RST_STREAM_FRAME)))
.Times(1)
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(id, _));
} else {
// Verify RST_STREAM and STOP_SENDING are sent for BIDIRECTIONAL
// streams.
EXPECT_CALL(*connection_, SendControlFrame(IsFrame(RST_STREAM_FRAME)))
- .WillRepeatedly(Invoke(&ClearControlFrame));
+ .WillRepeatedly(&ClearControlFrame);
EXPECT_CALL(*connection_, SendControlFrame(IsFrame(STOP_SENDING_FRAME)))
- .WillRepeatedly(Invoke(&ClearControlFrame));
+ .WillRepeatedly(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(id, _));
}
} else {
EXPECT_CALL(*connection_, SendControlFrame(_))
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(id, _));
}
session_.ResetStream(id, QUIC_STREAM_CANCELLED);
@@ -557,7 +557,7 @@
connection_->perspective() == Perspective::IS_SERVER) {
// HANDSHAKE_DONE frame.
EXPECT_CALL(*connection_, SendControlFrame(_))
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
}
session_.GetMutableCryptoStream()->OnHandshakeMessage(msg);
}
@@ -633,17 +633,15 @@
EXPECT_CALL(framer_visitor_, OnDecryptedPacket(_, _));
EXPECT_CALL(framer_visitor_, OnPacketHeader(_));
EXPECT_CALL(framer_visitor_, OnPathResponseFrame(_))
- .WillOnce(
- WithArg<0>(Invoke([this](const QuicPathResponseFrame& frame) {
- EXPECT_EQ(path_frame_buffer1_, frame.data_buffer);
- return true;
- })));
+ .WillOnce(WithArg<0>([this](const QuicPathResponseFrame& frame) {
+ EXPECT_EQ(path_frame_buffer1_, frame.data_buffer);
+ return true;
+ }));
EXPECT_CALL(framer_visitor_, OnPathResponseFrame(_))
- .WillOnce(
- WithArg<0>(Invoke([this](const QuicPathResponseFrame& frame) {
- EXPECT_EQ(path_frame_buffer2_, frame.data_buffer);
- return true;
- })));
+ .WillOnce(WithArg<0>([this](const QuicPathResponseFrame& frame) {
+ EXPECT_EQ(path_frame_buffer2_, frame.data_buffer);
+ return true;
+ }));
EXPECT_CALL(framer_visitor_, OnPacketComplete());
}
client_framer_.ProcessPacket(packet);
@@ -1002,10 +1000,10 @@
InSequence s;
// Reregister, to test the loop limit.
- EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
session_.SendStreamData(stream2);
session_.MarkConnectionLevelWriteBlocked(stream2->id());
- }));
+ });
if (!GetQuicReloadableFlag(quic_disable_batch_write) ||
GetQuicReloadableFlag(quic_priority_respect_incremental)) {
@@ -1013,19 +1011,19 @@
// are non-incremental by default, so if the incremental flag is respected,
// then stream 2 will write again. (If it is not respected, then every
// stream is treated as incremental.)
- EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
session_.SendStreamData(stream2);
- }));
- EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(Invoke([this, stream6]() {
+ });
+ EXPECT_CALL(*stream6, OnCanWrite()).WillOnce([this, stream6]() {
session_.SendStreamData(stream6);
- }));
+ });
} else {
- EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(Invoke([this, stream6]() {
+ EXPECT_CALL(*stream6, OnCanWrite()).WillOnce([this, stream6]() {
session_.SendStreamData(stream6);
- }));
- EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+ });
+ EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
session_.SendStreamData(stream4);
- }));
+ });
}
// Stream 4 will not get called, as we exceeded the loop limit.
@@ -1053,75 +1051,72 @@
// With two sessions blocked, we should get two write calls.
InSequence s;
- EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
session_.SendLargeFakeData(stream2, 6000);
session_.MarkConnectionLevelWriteBlocked(stream2->id());
- }));
+ });
if (GetQuicReloadableFlag(quic_disable_batch_write)) {
- EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+ EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
session_.SendLargeFakeData(stream4, 6000);
session_.MarkConnectionLevelWriteBlocked(stream4->id());
- }));
+ });
} else {
// Since stream2 only wrote 6 kB and marked itself blocked again,
// the second write happens on the same stream.
- EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
session_.SendLargeFakeData(stream2, 6000);
session_.MarkConnectionLevelWriteBlocked(stream2->id());
- }));
+ });
}
session_.OnCanWrite();
// If batched write is enabled, stream2 can write a third time in a row.
// If batched write is disabled, stream2 has a turn again after stream4.
- EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
session_.SendLargeFakeData(stream2, 6000);
session_.MarkConnectionLevelWriteBlocked(stream2->id());
- }));
- EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+ });
+ EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
session_.SendLargeFakeData(stream4, 6000);
session_.MarkConnectionLevelWriteBlocked(stream4->id());
- }));
+ });
session_.OnCanWrite();
// The next write adds a block for stream 6.
stream6->SetPriority(QuicStreamPriority(HttpStreamPriority{
kV3HighestPriority, HttpStreamPriority::kDefaultIncremental}));
if (GetQuicReloadableFlag(quic_disable_batch_write)) {
- EXPECT_CALL(*stream2, OnCanWrite())
- .WillOnce(Invoke([this, stream2, stream6]() {
- session_.SendLargeFakeData(stream2, 6000);
- session_.MarkConnectionLevelWriteBlocked(stream2->id());
- session_.MarkConnectionLevelWriteBlocked(stream6->id());
- }));
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2, stream6]() {
+ session_.SendLargeFakeData(stream2, 6000);
+ session_.MarkConnectionLevelWriteBlocked(stream2->id());
+ session_.MarkConnectionLevelWriteBlocked(stream6->id());
+ });
} else {
- EXPECT_CALL(*stream4, OnCanWrite())
- .WillOnce(Invoke([this, stream4, stream6]() {
- session_.SendLargeFakeData(stream4, 6000);
- session_.MarkConnectionLevelWriteBlocked(stream4->id());
- session_.MarkConnectionLevelWriteBlocked(stream6->id());
- }));
+ EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4, stream6]() {
+ session_.SendLargeFakeData(stream4, 6000);
+ session_.MarkConnectionLevelWriteBlocked(stream4->id());
+ session_.MarkConnectionLevelWriteBlocked(stream6->id());
+ });
}
// Stream 6 will write next, because it has higher priority.
// It does not mark itself as blocked.
- EXPECT_CALL(*stream6, OnCanWrite())
- .WillOnce(Invoke([this, stream4, stream6]() {
- session_.SendStreamData(stream6);
- session_.SendLargeFakeData(stream4, 6000);
- }));
+ EXPECT_CALL(*stream6, OnCanWrite()).WillOnce([this, stream4, stream6]() {
+ session_.SendStreamData(stream6);
+ session_.SendLargeFakeData(stream4, 6000);
+ });
session_.OnCanWrite();
// If batched write is enabled, stream4 can continue to write, but will
// exhaust its write limit, so the last write is on stream2.
// If batched write is disabled, stream4 has a turn again, then stream2.
- EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(Invoke([this, stream4]() {
+ EXPECT_CALL(*stream4, OnCanWrite()).WillOnce([this, stream4]() {
session_.SendLargeFakeData(stream4, 12000);
session_.MarkConnectionLevelWriteBlocked(stream4->id());
- }));
- EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(Invoke([this, stream2]() {
+ });
+ EXPECT_CALL(*stream2, OnCanWrite()).WillOnce([this, stream2]() {
session_.SendLargeFakeData(stream2, 6000);
session_.MarkConnectionLevelWriteBlocked(stream2->id());
- }));
+ });
session_.OnCanWrite();
}
@@ -1147,15 +1142,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.
@@ -1185,14 +1180,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.
@@ -1207,9 +1202,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());
@@ -1251,13 +1246,13 @@
}
// Next checking causes STREAMS_BLOCKED to be sent.
EXPECT_CALL(*connection_, SendControlFrame(_))
- .WillOnce(Invoke([](const QuicFrame& frame) {
+ .WillOnce([](const QuicFrame& frame) {
EXPECT_FALSE(frame.streams_blocked_frame.unidirectional);
EXPECT_EQ(kDefaultMaxStreamsPerConnection,
frame.streams_blocked_frame.stream_count);
ClearControlFrame(frame);
return true;
- }));
+ });
EXPECT_FALSE(session_.CanOpenNextOutgoingBidirectionalStream());
for (size_t i = 0; i < kDefaultMaxStreamsPerConnection; ++i) {
@@ -1266,13 +1261,13 @@
}
// Next checking causes STREAM_BLOCKED to be sent.
EXPECT_CALL(*connection_, SendControlFrame(_))
- .WillOnce(Invoke([](const QuicFrame& frame) {
+ .WillOnce([](const QuicFrame& frame) {
EXPECT_TRUE(frame.streams_blocked_frame.unidirectional);
EXPECT_EQ(kDefaultMaxStreamsPerConnection,
frame.streams_blocked_frame.stream_count);
ClearControlFrame(frame);
return true;
- }));
+ });
EXPECT_FALSE(session_.CanOpenNextOutgoingUnidirectionalStream());
}
@@ -1293,11 +1288,11 @@
std::vector<QuicMaxStreamsFrame> max_stream_frames;
EXPECT_CALL(*connection_, SendControlFrame(IsFrame(MAX_STREAMS_FRAME)))
.Times(2)
- .WillRepeatedly(Invoke([&max_stream_frames](const QuicFrame& frame) {
+ .WillRepeatedly([&max_stream_frames](const QuicFrame& frame) {
max_stream_frames.push_back(frame.max_streams_frame);
ClearControlFrame(frame);
return true;
- }));
+ });
for (size_t i = 0; i < kMaxStreams; ++i) {
QuicStreamId stream_id = GetNthClientInitiatedBidirectionalId(i);
QuicStreamFrame data1(stream_id, true, 0, absl::string_view("HT"));
@@ -1326,7 +1321,7 @@
// Now when the outstanding MAX_STREAMS frame is ACK'd a new one will be sent.
EXPECT_CALL(*connection_, SendControlFrame(IsFrame(MAX_STREAMS_FRAME)))
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
session_.OnFrameAcked(QuicFrame(max_stream_frames[0]),
QuicTime::Delta::Zero(), QuicTime::Zero(),
/*is_retransmission=*/false);
@@ -1389,16 +1384,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());
@@ -1419,13 +1414,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());
}
@@ -1503,8 +1498,7 @@
// In IETF QUIC, GOAWAY lives up in the HTTP layer.
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_.transport_goaway_sent());
session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
@@ -1668,7 +1662,7 @@
EXPECT_CALL(*connection_, SendControlFrame(_))
.Times(2)
- .WillRepeatedly(Invoke(&ClearControlFrame));
+ .WillRepeatedly(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(stream->id(), _));
QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream->id(),
@@ -2490,8 +2484,7 @@
QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream2->id(),
QUIC_STREAM_CANCELLED, 1234);
// Just for the RST_STREAM
- EXPECT_CALL(*connection_, SendControlFrame(_))
- .WillOnce(Invoke(&ClearControlFrame));
+ EXPECT_CALL(*connection_, SendControlFrame(_)).WillOnce(&ClearControlFrame);
if (VersionHasIetfQuicFrames(transport_version())) {
EXPECT_CALL(*connection_,
OnStreamReset(stream2->id(), QUIC_STREAM_CANCELLED));
@@ -2517,7 +2510,7 @@
// Once for the RST_STREAM, once for the STOP_SENDING
EXPECT_CALL(*connection_, SendControlFrame(_))
.Times(2)
- .WillRepeatedly(Invoke(&ClearControlFrame));
+ .WillRepeatedly(&ClearControlFrame);
} else {
// Just for the RST_STREAM
EXPECT_CALL(*connection_, SendControlFrame(_)).Times(1);
@@ -2644,7 +2637,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();
@@ -2659,8 +2652,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);
@@ -2676,8 +2668,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(_, _, _, _))
@@ -2701,9 +2692,9 @@
session_.OnFrameLost(QuicFrame(frame));
// Retransmit stream data causes connection close. Stream has not sent fin
// yet, so an RST is sent.
- EXPECT_CALL(*stream, OnCanWrite()).WillOnce(Invoke([this, stream]() {
+ EXPECT_CALL(*stream, OnCanWrite()).WillOnce([this, stream]() {
session_.ResetStream(stream->id(), QUIC_STREAM_CANCELLED);
- }));
+ });
if (VersionHasIetfQuicFrames(transport_version())) {
// Once for the RST_STREAM, once for the STOP_SENDING
EXPECT_CALL(*connection_, SendControlFrame(_))
@@ -2778,7 +2769,7 @@
// Reset stream2 locally.
EXPECT_CALL(*connection_, SendControlFrame(_))
- .WillRepeatedly(Invoke(&ClearControlFrame));
+ .WillRepeatedly(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(stream2->id(), _));
stream2->Reset(QUIC_STREAM_CANCELLED);
@@ -3252,21 +3243,21 @@
EXPECT_CALL(*connection_, SendControlFrame(_))
.Times(1)
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(read_only, _));
session_.ResetStream(read_only, QUIC_STREAM_CANCELLED);
QuicStreamId write_only = GetNthServerInitiatedUnidirectionalId(0);
EXPECT_CALL(*connection_, SendControlFrame(_))
.Times(1)
- .WillOnce(Invoke(&ClearControlFrame));
+ .WillOnce(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(write_only, _));
session_.ResetStream(write_only, QUIC_STREAM_CANCELLED);
QuicStreamId bidirectional = GetNthClientInitiatedBidirectionalId(0);
EXPECT_CALL(*connection_, SendControlFrame(_))
.Times(2)
- .WillRepeatedly(Invoke(&ClearControlFrame));
+ .WillRepeatedly(&ClearControlFrame);
EXPECT_CALL(*connection_, OnStreamReset(bidirectional, _));
session_.ResetStream(bidirectional, QUIC_STREAM_CANCELLED);
}
diff --git a/quiche/quic/core/quic_stream_sequencer_test.cc b/quiche/quic/core/quic_stream_sequencer_test.cc
index 3ac6d88..abd8346 100644
--- a/quiche/quic/core/quic_stream_sequencer_test.cc
+++ b/quiche/quic/core/quic_stream_sequencer_test.cc
@@ -165,9 +165,9 @@
TEST_F(QuicStreamSequencerTest, RejectOldFrame) {
EXPECT_CALL(stream_, AddBytesConsumed(3));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
OnFrame(0, "abc");
@@ -194,9 +194,9 @@
TEST_F(QuicStreamSequencerTest, FullFrameConsumed) {
EXPECT_CALL(stream_, AddBytesConsumed(3));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
OnFrame(0, "abc");
EXPECT_EQ(0u, NumBufferedBytes());
@@ -211,17 +211,17 @@
EXPECT_EQ(0u, sequencer_->NumBytesConsumed());
EXPECT_CALL(stream_, AddBytesConsumed(3));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
sequencer_->SetUnblocked();
EXPECT_EQ(0u, NumBufferedBytes());
EXPECT_EQ(3u, sequencer_->NumBytesConsumed());
EXPECT_CALL(stream_, AddBytesConsumed(3));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
EXPECT_FALSE(sequencer_->IsClosed());
EXPECT_FALSE(sequencer_->IsAllDataAvailable());
OnFinFrame(3, "def");
@@ -237,9 +237,9 @@
EXPECT_EQ(0u, sequencer_->NumBytesConsumed());
EXPECT_CALL(stream_, AddBytesConsumed(3));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
EXPECT_FALSE(sequencer_->IsClosed());
EXPECT_TRUE(sequencer_->IsAllDataAvailable());
sequencer_->SetUnblocked();
@@ -268,9 +268,9 @@
TEST_F(QuicStreamSequencerTest, PartialFrameConsumed) {
EXPECT_CALL(stream_, AddBytesConsumed(2));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(2);
- }));
+ });
OnFrame(0, "abc");
EXPECT_EQ(1u, NumBufferedBytes());
@@ -304,9 +304,9 @@
EXPECT_EQ(6u, sequencer_->NumBytesBuffered());
EXPECT_CALL(stream_, AddBytesConsumed(9));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(9);
- }));
+ });
// Now process all of them at once.
OnFrame(0, "abc");
@@ -319,9 +319,9 @@
TEST_F(QuicStreamSequencerTest, BasicHalfCloseOrdered) {
InSequence s;
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
EXPECT_CALL(stream_, AddBytesConsumed(3));
OnFinFrame(0, "abc");
@@ -334,9 +334,9 @@
OnFrame(3, "def");
EXPECT_CALL(stream_, AddBytesConsumed(6));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(6);
- }));
+ });
EXPECT_FALSE(sequencer_->IsClosed());
OnFrame(0, "abc");
EXPECT_TRUE(sequencer_->IsClosed());
@@ -347,9 +347,9 @@
EXPECT_EQ(3u, QuicStreamSequencerPeer::GetCloseOffset(sequencer_.get()));
EXPECT_CALL(stream_, AddBytesConsumed(3));
- EXPECT_CALL(stream_, OnDataAvailable()).WillOnce(testing::Invoke([this]() {
+ EXPECT_CALL(stream_, OnDataAvailable()).WillOnce([this]() {
ConsumeData(3);
- }));
+ });
EXPECT_FALSE(sequencer_->IsClosed());
OnFrame(0, "abc");
EXPECT_TRUE(sequencer_->IsClosed());
@@ -439,10 +439,9 @@
QuicByteCount total_bytes_consumed = 0;
EXPECT_CALL(stream_, AddBytesConsumed(_))
.Times(AnyNumber())
- .WillRepeatedly(
- testing::Invoke([&total_bytes_consumed](QuicByteCount bytes) {
- total_bytes_consumed += bytes;
- }));
+ .WillRepeatedly([&total_bytes_consumed](QuicByteCount bytes) {
+ total_bytes_consumed += bytes;
+ });
while (!list_.empty()) {
int index = OneToN(list_.size()) - 1;
@@ -469,10 +468,9 @@
QuicByteCount total_bytes_consumed = 0;
EXPECT_CALL(stream_, AddBytesConsumed(_))
.Times(AnyNumber())
- .WillRepeatedly(
- testing::Invoke([&total_bytes_consumed](QuicByteCount bytes) {
- total_bytes_consumed += bytes;
- }));
+ .WillRepeatedly([&total_bytes_consumed](QuicByteCount bytes) {
+ total_bytes_consumed += bytes;
+ });
while (output_.size() != ABSL_ARRAYSIZE(kPayload) - 1) {
if (!list_.empty() && OneToN(2) == 1) { // Send data
diff --git a/quiche/quic/core/quic_stream_test.cc b/quiche/quic/core/quic_stream_test.cc
index 5f0f7fe..548737e 100644
--- a/quiche/quic/core/quic_stream_test.cc
+++ b/quiche/quic/core/quic_stream_test.cc
@@ -745,7 +745,7 @@
.Times(0);
EXPECT_CALL(*session_, WriteControlFrame(_, _))
.Times(AtLeast(1))
- .WillRepeatedly(Invoke(&ClearControlFrameWithTransmissionType));
+ .WillRepeatedly(&ClearControlFrameWithTransmissionType);
std::string data(1000, 'x');
for (QuicStreamOffset offset = 0;
@@ -1076,7 +1076,7 @@
OnStreamReset(stream_->id(), QUIC_STREAM_CANCELLED));
EXPECT_CALL(*session_, WriteControlFrame(_, _))
.Times(AtLeast(1))
- .WillRepeatedly(Invoke(&ClearControlFrameWithTransmissionType));
+ .WillRepeatedly(&ClearControlFrameWithTransmissionType);
EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
diff --git a/quiche/quic/core/quic_unacked_packet_map_test.cc b/quiche/quic/core/quic_unacked_packet_map_test.cc
index 3bfcc37..a94e006 100644
--- a/quiche/quic/core/quic_unacked_packet_map_test.cc
+++ b/quiche/quic/core/quic_unacked_packet_map_test.cc
@@ -21,7 +21,6 @@
#include "quiche/quic/test_tools/quic_unacked_packet_map_peer.h"
using testing::_;
-using testing::Invoke;
using testing::Return;
using testing::StrictMock;
@@ -653,8 +652,7 @@
last_info->retransmittable_frames[0].padding_frame.num_padding_bytes;
EXPECT_CALL(notifier_, OnFrameAcked(_, _, _, _))
- .WillOnce(Invoke([&](const QuicFrame& frame, QuicTime::Delta, QuicTime,
- bool) {
+ .WillOnce([&](const QuicFrame& frame, QuicTime::Delta, QuicTime, bool) {
EXPECT_EQ(frame.type, PADDING_FRAME);
EXPECT_EQ(frame.padding_frame.num_padding_bytes, last_padding_bytes);
// Append one more packet to the unacked packet map.
@@ -663,7 +661,7 @@
unacked_packets_.AddSentPacket(&packet, NOT_RETRANSMISSION, now_, true,
true, ECN_NOT_ECT);
return true;
- }));
+ });
QuicTransmissionInfo* last_info_updated = last_info;
unacked_packets_.NotifyFramesAcked(largest_sent_packet_before_acked,