Remove InvokeWithoutArgs

Bug: None
Change-Id: Ied1f1b89f808115d9cf4d3c5c3f9d353519ef858
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/491020
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#48219}
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_unittest.cc b/modules/rtp_rtcp/source/rtcp_transceiver_unittest.cc
index 32e2bda..3f0baf2 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_unittest.cc
@@ -38,7 +38,6 @@
 
 using ::testing::_;
 using ::testing::AtLeast;
-using ::testing::InvokeWithoutArgs;
 using ::testing::IsNull;
 using ::testing::MockFunction;
 using ::testing::NiceMock;
@@ -69,9 +68,9 @@
   config.clock = &clock;
   config.rtcp_transport = outgoing_transport.AsStdFunction();
   config.task_queue = queue.Get();
-  EXPECT_CALL(outgoing_transport, Call).WillRepeatedly(InvokeWithoutArgs([&] {
+  EXPECT_CALL(outgoing_transport, Call).WillRepeatedly([&] {
     EXPECT_TRUE(queue.IsCurrent());
-  }));
+  });
 
   RtcpTransceiver rtcp_transceiver(config);
   rtcp_transceiver.SendCompoundPacket();
@@ -86,9 +85,9 @@
   config.clock = &clock;
   config.rtcp_transport = outgoing_transport.AsStdFunction();
   config.task_queue = queue.Get();
-  EXPECT_CALL(outgoing_transport, Call).WillRepeatedly(InvokeWithoutArgs([&] {
+  EXPECT_CALL(outgoing_transport, Call).WillRepeatedly([&] {
     EXPECT_TRUE(queue.IsCurrent());
-  }));
+  });
 
   std::unique_ptr<RtcpTransceiver> rtcp_transceiver;
   queue.PostTask([&] {
@@ -234,8 +233,7 @@
   EXPECT_CALL(outgoing_transport, Call)
       // If test is slow, a periodic task may send an extra packet.
       .Times(AtLeast(3))
-      .WillRepeatedly(
-          InvokeWithoutArgs([&] { EXPECT_TRUE(queue.IsCurrent()); }));
+      .WillRepeatedly([&] { EXPECT_TRUE(queue.IsCurrent()); });
 
   RtcpTransceiver rtcp_transceiver(config);
 
diff --git a/video/call_stats2_unittest.cc b/video/call_stats2_unittest.cc
index e6a950a..1ef6ea2 100644
--- a/video/call_stats2_unittest.cc
+++ b/video/call_stats2_unittest.cc
@@ -25,7 +25,6 @@
 #include "test/run_loop.h"
 
 using ::testing::AnyNumber;
-using ::testing::InvokeWithoutArgs;
 using ::testing::Return;
 
 namespace webrtc {
@@ -76,7 +75,7 @@
   MockStatsObserver stats_observer;
   EXPECT_CALL(stats_observer, OnRttUpdate(kRtt, kRtt))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] { loop_.Quit(); }));
+      .WillOnce([this] { loop_.Quit(); });
 
   call_stats_.RegisterStatsObserver(&stats_observer);
   EXPECT_EQ(-1, call_stats_.LastProcessedRtt());
@@ -97,23 +96,23 @@
 
   EXPECT_CALL(stats_observer, OnRttUpdate(kRtt, kRtt))
       .Times(2)
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         // Advance clock and verify we get an update.
         fake_clock_.AdvanceTimeMilliseconds(CallStats::kUpdateInterval.ms());
-      }))
-      .WillRepeatedly(InvokeWithoutArgs([this] {
+      })
+      .WillRepeatedly([this] {
         AsyncSimulateRttUpdate(kRtt2);
         // Advance clock just too little to get an update.
         fake_clock_.AdvanceTimeMilliseconds(CallStats::kUpdateInterval.ms() -
                                             1);
-      }));
+      });
 
   // In case you're reading this and wondering how this number is arrived at,
   // please see comments in the ChangeRtt test that go into some detail.
   static constexpr const int64_t kLastAvg = 94;
   EXPECT_CALL(stats_observer, OnRttUpdate(kLastAvg, kRtt2))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] { loop_.Quit(); }));
+      .WillOnce([this] { loop_.Quit(); });
 
   call_stats_.RegisterStatsObserver(&stats_observer);
 
@@ -142,7 +141,7 @@
       .WillRepeatedly(Return());
   EXPECT_CALL(stats_observer_2, OnRttUpdate(kRtt, kRtt))
       .Times(AnyNumber())
-      .WillOnce(InvokeWithoutArgs([this] { loop_.Quit(); }))
+      .WillOnce([this] { loop_.Quit(); })
       .WillRepeatedly(Return());
   AsyncSimulateRttUpdate(kRtt);
   loop_.Run();
@@ -153,7 +152,7 @@
 
   EXPECT_CALL(stats_observer_1, OnRttUpdate(kRtt, kRtt))
       .Times(AnyNumber())
-      .WillOnce(InvokeWithoutArgs([this] { loop_.Quit(); }))
+      .WillOnce([this] { loop_.Quit(); })
       .WillRepeatedly(Return());
   EXPECT_CALL(stats_observer_2, OnRttUpdate(kRtt, kRtt)).Times(0);
   AsyncSimulateRttUpdate(kRtt);
@@ -188,10 +187,10 @@
 
   EXPECT_CALL(stats_observer, OnRttUpdate(kFirstRtt, kFirstRtt))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         fake_clock_.AdvanceTimeMilliseconds(1000);
         AsyncSimulateRttUpdate(kHighRtt);  // Reported at T1 (1000ms).
-      }));
+      });
 
   // NOTE: This relies on the internal algorithms of call_stats.cc.
   // There's a weight factor there (0.3), that weighs the previous average to
@@ -200,12 +199,12 @@
   static constexpr const int64_t kAvgRtt1 = 103;
   EXPECT_CALL(stats_observer, OnRttUpdate(kAvgRtt1, kHighRtt))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         // This interacts with an internal implementation detail in call_stats
         // that decays the oldest rtt value. See more below.
         fake_clock_.AdvanceTimeMilliseconds(1000);
         AsyncSimulateRttUpdate(kLowRtt);  // Reported at T2 (2000ms).
-      }));
+      });
 
   // Increase time enough for a new update, but not too much to make the
   // rtt invalid. Report a lower rtt and verify the old/high value still is sent
@@ -218,16 +217,16 @@
   static constexpr const int64_t kAvgRtt2 = 102;
   EXPECT_CALL(stats_observer, OnRttUpdate(kAvgRtt2, kHighRtt))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         // Advance time to make the high report invalid, the lower rtt should
         // now be in the callback.
         fake_clock_.AdvanceTimeMilliseconds(1000);
-      }));
+      });
 
   static constexpr const int64_t kAvgRtt3 = 95;
   EXPECT_CALL(stats_observer, OnRttUpdate(kAvgRtt3, kLowRtt))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] { loop_.Quit(); }));
+      .WillOnce([this] { loop_.Quit(); });
 
   // Trigger the first rtt value and set off the chain of callbacks.
   AsyncSimulateRttUpdate(kFirstRtt);  // Reported at T0 (0ms).
@@ -249,29 +248,29 @@
 
   EXPECT_CALL(stats_observer, OnRttUpdate(kRttLow, kRttLow))
       .Times(1)
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         EXPECT_EQ(kRttLow, call_stats_.LastProcessedRtt());
         // Don't advance the clock to make sure that low and high rtt values
         // are associated with the same time stamp.
         AsyncSimulateRttUpdate(kRttHigh);
-      }));
+      });
 
   EXPECT_CALL(stats_observer, OnRttUpdate(kAvgRtt1, kRttHigh))
       .Times(AnyNumber())
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         EXPECT_EQ(kAvgRtt1, call_stats_.LastProcessedRtt());
         fake_clock_.AdvanceTimeMilliseconds(CallStats::kUpdateInterval.ms());
         AsyncSimulateRttUpdate(kRttLow);
         AsyncSimulateRttUpdate(kRttHigh);
-      }))
+      })
       .WillRepeatedly(Return());
 
   EXPECT_CALL(stats_observer, OnRttUpdate(kAvgRtt2, kRttHigh))
       .Times(AnyNumber())
-      .WillOnce(InvokeWithoutArgs([this] {
+      .WillOnce([this] {
         EXPECT_EQ(kAvgRtt2, call_stats_.LastProcessedRtt());
         loop_.Quit();
-      }))
+      })
       .WillRepeatedly(Return());
 
   // Set a first values and verify that LastProcessedRtt initially returns the
@@ -291,7 +290,7 @@
   call_stats_.RegisterStatsObserver(&stats_observer);
   EXPECT_CALL(stats_observer, OnRttUpdate(kRtt, kRtt))
       .Times(AnyNumber())
-      .WillRepeatedly(InvokeWithoutArgs([this] { loop_.Quit(); }));
+      .WillRepeatedly([this] { loop_.Quit(); });
 
   AsyncSimulateRttUpdate(kRtt);
   loop_.Run();
diff --git a/video/frame_cadence_adapter_unittest.cc b/video/frame_cadence_adapter_unittest.cc
index a7a31be..b90fb44 100644
--- a/video/frame_cadence_adapter_unittest.cc
+++ b/video/frame_cadence_adapter_unittest.cc
@@ -50,7 +50,6 @@
 using ::testing::_;
 using ::testing::ElementsAre;
 using ::testing::InSequence;
-using ::testing::InvokeWithoutArgs;
 using ::testing::Mock;
 using ::testing::NiceMock;
 using ::testing::Pair;
@@ -250,10 +249,10 @@
   // Expect frame delivery at 1 sec despite target sequence not running
   // callbacks for the time skipped.
   constexpr TimeDelta time_skipped = TimeDelta::Millis(999);
-  EXPECT_CALL(callback, OnFrame).WillOnce(InvokeWithoutArgs([&] {
+  EXPECT_CALL(callback, OnFrame).WillOnce([&] {
     EXPECT_EQ(time_controller.GetClock()->CurrentTime(),
               Timestamp::Zero() + TimeDelta::Seconds(1));
-  }));
+  });
   adapter->OnFrame(CreateFrame());
   time_controller.SkipForwardBy(time_skipped);
   time_controller.AdvanceTime(TimeDelta::Seconds(1) - time_skipped);
@@ -274,10 +273,10 @@
   // is not running callbacks for the initial 1+ sec.
   constexpr TimeDelta time_skipped =
       TimeDelta::Seconds(1) + TimeDelta::Micros(1);
-  EXPECT_CALL(callback, OnFrame).WillOnce(InvokeWithoutArgs([&] {
+  EXPECT_CALL(callback, OnFrame).WillOnce([&] {
     EXPECT_EQ(time_controller.GetClock()->CurrentTime(),
               Timestamp::Zero() + time_skipped);
-  }));
+  });
   adapter->OnFrame(CreateFrame());
   time_controller.SkipForwardBy(time_skipped);
   time_controller.AdvanceTime(TimeDelta::Zero());
@@ -1151,22 +1150,21 @@
     auto frame = CreateFrame();
     constexpr int kSleepMs = 400;
     constexpr TimeDelta kAllowedBelate = TimeDelta::Millis(151);
-    EXPECT_CALL(callback, OnFrame)
-        .WillRepeatedly(InvokeWithoutArgs([&, kAllowedBelate] {
-          ++frame_counter;
-          // Avoid the first OnFrame and sleep on the second.
-          if (frame_counter == 2) {
-            start_time = clock->CurrentTime();
-            Thread::SleepMs(kSleepMs);
-          } else if (frame_counter == 3) {
-            TimeDelta diff =
-                clock->CurrentTime() - (*start_time + TimeDelta::Millis(500));
-            RTC_LOG(LS_ERROR)
-                << "Difference in when frame should vs is appearing: " << diff;
-            EXPECT_LT(diff, kAllowedBelate);
-            event.Set();
-          }
-        }));
+    EXPECT_CALL(callback, OnFrame).WillRepeatedly([&, kAllowedBelate] {
+      ++frame_counter;
+      // Avoid the first OnFrame and sleep on the second.
+      if (frame_counter == 2) {
+        start_time = clock->CurrentTime();
+        Thread::SleepMs(kSleepMs);
+      } else if (frame_counter == 3) {
+        TimeDelta diff =
+            clock->CurrentTime() - (*start_time + TimeDelta::Millis(500));
+        RTC_LOG(LS_ERROR) << "Difference in when frame should vs is appearing: "
+                          << diff;
+        EXPECT_LT(diff, kAllowedBelate);
+        event.Set();
+      }
+    });
     adapter->OnFrame(frame);
   });
   event.Wait(Event::kForever);