Remove use of std::function from CreateContextForMultiPortPath()
https://quiche.googlesource.com/quiche/+/107316f10996668916ae6166b6cb0725632df2a0 introduced the use of std::function to CreateContextForMultiPortPath(). However, std::function is banned in Chromium code. Hence, this CL removes the use of it to be able to roll into Chromium.
PiperOrigin-RevId: 531511575
diff --git a/quiche/quic/core/quic_connection_test.cc b/quiche/quic/core/quic_connection_test.cc
index 6a0e9d0..88a9fd4 100644
--- a/quiche/quic/core/quic_connection_test.cc
+++ b/quiche/quic/core/quic_connection_test.cc
@@ -13383,9 +13383,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = 1u;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillRepeatedly(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress, connection_.peer_address(), &new_writer)));
+ .WillRepeatedly(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress, connection_.peer_address(), &new_writer)));
}));
connection_.OnNewConnectionIdFrame(frame);
EXPECT_TRUE(connection_.HasPendingPathValidation());
@@ -13519,9 +13520,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = 1u;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillRepeatedly(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress, connection_.peer_address(), &new_writer)));
+ .WillRepeatedly(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress, connection_.peer_address(), &new_writer)));
}));
EXPECT_TRUE(connection_.OnNewConnectionIdFrame(frame));
EXPECT_TRUE(connection_.HasPendingPathValidation());
@@ -13558,9 +13560,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = i + 2;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillRepeatedly(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress, connection_.peer_address(), &new_writer)));
+ .WillRepeatedly(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress, connection_.peer_address(), &new_writer)));
}));
EXPECT_TRUE(connection_.OnNewConnectionIdFrame(frame));
EXPECT_TRUE(connection_.HasPendingPathValidation());
@@ -13630,9 +13633,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = 1u;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillRepeatedly(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress, connection_.peer_address(), &new_writer)));
+ .WillRepeatedly(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress, connection_.peer_address(), &new_writer)));
}));
EXPECT_TRUE(connection_.OnNewConnectionIdFrame(frame));
EXPECT_TRUE(connection_.HasPendingPathValidation());
@@ -13700,9 +13704,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = 1u;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillRepeatedly(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress, connection_.peer_address(), &new_writer)));
+ .WillRepeatedly(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress, connection_.peer_address(), &new_writer)));
}));
EXPECT_TRUE(connection_.OnNewConnectionIdFrame(frame));
EXPECT_TRUE(connection_.HasPendingPathValidation());
@@ -13778,9 +13783,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = 1u;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillRepeatedly(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress, connection_.peer_address(), &new_writer)));
+ .WillRepeatedly(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress, connection_.peer_address(), &new_writer)));
}));
EXPECT_TRUE(connection_.OnNewConnectionIdFrame(frame));
EXPECT_TRUE(connection_.HasPendingPathValidation());
@@ -16849,9 +16855,10 @@
frame.retire_prior_to = 0u;
frame.sequence_number = 2u;
EXPECT_CALL(visitor_, CreateContextForMultiPortPath)
- .WillOnce(testing::WithArgs<0>([&](auto&& fn) {
- fn(std::move(std::make_unique<TestQuicPathValidationContext>(
- kNewSelfAddress2, connection_.peer_address(), &new_writer2)));
+ .WillOnce(testing::WithArgs<0>([&](auto&& observer) {
+ observer->OnMultiPortPathContextAvailable(
+ std::move(std::make_unique<TestQuicPathValidationContext>(
+ kNewSelfAddress2, connection_.peer_address(), &new_writer2)));
}));
connection_.OnNewConnectionIdFrame(frame);
EXPECT_TRUE(connection_.HasPendingPathValidation());