Use RunLoop in test/ tests Bug: webrtc:469327588 Change-Id: I5306d9aaa98e12522d829f85cd405ce76a6a6964 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/461341 Commit-Queue: Jeremy Leconte <jleconte@google.com> Reviewed-by: Jeremy Leconte <jleconte@google.com> Auto-Submit: Evan Shrubsole <eshr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47305}
diff --git a/test/wait_until.cc b/test/wait_until.cc index 56ce22c..36ca1ba 100644 --- a/test/wait_until.cc +++ b/test/wait_until.cc
@@ -28,7 +28,7 @@ WaitUntilSettings settings) { if (std::holds_alternative<std::monostate>(settings.clock)) { RTC_CHECK(Thread::Current()) << "A current thread is required. An " - "webrtc::AutoThread can work for tests."; + "webrtc::test::RunLoop can work for tests."; } auto now = [&] {
diff --git a/test/wait_until_unittest.cc b/test/wait_until_unittest.cc index a78a377..b0391cc 100644 --- a/test/wait_until_unittest.cc +++ b/test/wait_until_unittest.cc
@@ -21,10 +21,10 @@ #include "api/units/time_delta.h" #include "api/units/timestamp.h" #include "rtc_base/fake_clock.h" -#include "rtc_base/thread.h" #include "system_wrappers/include/clock.h" #include "test/gmock.h" #include "test/gtest.h" +#include "test/run_loop.h" namespace webrtc { namespace { @@ -39,7 +39,7 @@ using ::testing::Property; TEST(WaitUntilTest, ReturnsTrueWhenConditionIsMet) { - AutoThread thread; + test::RunLoop thread; int counter = 0; EXPECT_TRUE(WaitUntil([&] { return ++counter == 3; })); @@ -49,7 +49,7 @@ } TEST(WaitUntilTest, ReturnsWhenConditionIsMet) { - AutoThread thread; + test::RunLoop thread; int counter = 0; RTCErrorOr<int> result = WaitUntil([&] { return ++counter; }, Eq(3)); @@ -57,7 +57,7 @@ } TEST(WaitUntilTest, ReturnsErrorWhenTimeoutIsReached) { - AutoThread thread; + test::RunLoop thread; int counter = 0; RTCErrorOr<int> result = WaitUntil([&] { return --counter; }, Eq(1), @@ -73,7 +73,7 @@ } TEST(WaitUntilTest, ErrorContainsMatcherExplanation) { - AutoThread thread; + test::RunLoop thread; int counter = 0; auto matcher = AllOf(Gt(0), Lt(10)); RTCErrorOr<int> result = @@ -153,7 +153,7 @@ }; TEST(WaitUntilTest, RequiresOnlyMoveCopyConstructionForReturnedType) { - AutoThread thread; + test::RunLoop thread; int counter = 0; RTCErrorOr<CustomType> result =