Use RunLoop in modules/ tests Bug: webrtc:469327588 Change-Id: I54e46ccc572d8cf13877b3da3d2380ef6a6a6964 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/461344 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Auto-Submit: Evan Shrubsole <eshr@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47353}
diff --git a/modules/BUILD.gn b/modules/BUILD.gn index 0cad329..20ef9be 100644 --- a/modules/BUILD.gn +++ b/modules/BUILD.gn
@@ -83,6 +83,7 @@ deps = [ ":module_api", ":module_api_public", + "../test:run_loop", "../test:test_support", "audio_coding:audio_coding_unittests", "audio_device:audio_device_unittests",
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn index 3915a10..5a96a14 100644 --- a/modules/rtp_rtcp/BUILD.gn +++ b/modules/rtp_rtcp/BUILD.gn
@@ -691,6 +691,7 @@ "../../test:mock_transport", "../../test:near_matcher", "../../test:rtp_test_utils", + "../../test:run_loop", "../../test:test_support", "../../test/time_controller", "../audio_coding:audio_coding_module_typedefs",
diff --git a/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/modules/rtp_rtcp/source/nack_rtx_unittest.cc index a94dd69..9d3a342 100644 --- a/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
@@ -37,9 +37,9 @@ #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" #include "modules/rtp_rtcp/source/rtp_sender_video.h" #include "rtc_base/rate_limiter.h" -#include "rtc_base/thread.h" #include "system_wrappers/include/clock.h" #include "test/gtest.h" +#include "test/run_loop.h" namespace webrtc { @@ -240,7 +240,7 @@ media_stream_.sequence_numbers_.sort(); } - AutoThread main_thread_; + test::RunLoop main_thread_; SimulatedClock fake_clock_; const Environment env_; std::unique_ptr<ReceiveStatistics> receive_statistics_;
diff --git a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc index abe4761..40f7c92 100644 --- a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc +++ b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
@@ -40,13 +40,13 @@ #include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h" #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" #include "rtc_base/rate_limiter.h" -#include "rtc_base/thread.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/ntp_time.h" #include "test/gmock.h" #include "test/gtest.h" #include "test/mock_transport.h" #include "test/rtcp_packet_parser.h" +#include "test/run_loop.h" namespace webrtc { namespace { @@ -152,7 +152,7 @@ return rtp_rtcp_impl_->GetFeedbackState(); } - AutoThread main_thread_; + test::RunLoop main_thread_; SimulatedClock clock_; const Environment env_; TestTransport test_transport_;
diff --git a/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc index 6962e0f..c0a98d7 100644 --- a/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc
@@ -25,11 +25,11 @@ #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h" -#include "rtc_base/thread.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/ntp_time.h" #include "test/gmock.h" #include "test/gtest.h" +#include "test/run_loop.h" namespace webrtc { @@ -89,7 +89,7 @@ rtp_module_->SetSequenceNumber(kSeqNum); } - AutoThread main_thread_; + test::RunLoop main_thread_; SimulatedClock fake_clock_; const Environment env_; LoopbackTransportTest transport_;
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc index 443b608..9459546 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc
@@ -68,11 +68,11 @@ #include "modules/video_coding/codecs/vp9/include/vp9_globals.h" #include "rtc_base/checks.h" #include "rtc_base/rate_limiter.h" -#include "rtc_base/thread.h" #include "system_wrappers/include/clock.h" #include "system_wrappers/include/ntp_time.h" #include "test/gmock.h" #include "test/gtest.h" +#include "test/run_loop.h" #include "test/time_controller/simulated_time_controller.h" namespace webrtc { @@ -213,7 +213,7 @@ int version); protected: - AutoThread main_thread_; + test::RunLoop main_thread_; SimulatedClock fake_clock_; const Environment env_; LoopbackTransportTest transport_;
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc index 989bedd..b02785e 100644 --- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc
@@ -43,6 +43,7 @@ #include "system_wrappers/include/ntp_time.h" #include "test/gmock.h" #include "test/gtest.h" +#include "test/run_loop.h" namespace webrtc { namespace { @@ -129,7 +130,7 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest, ManageFrameOnTransformedFrame) { - AutoThread main_thread_; + test::RunLoop main_thread_; TestRtpVideoFrameReceiver receiver; auto mock_frame_transformer( make_ref_counted<NiceMock<MockFrameTransformer>>()); @@ -258,7 +259,7 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest, TransformableFrameMetadataHasCorrectValueAfterSetMetadata) { - AutoThread main_thread; + test::RunLoop main_thread; TestRtpVideoFrameReceiver receiver; auto mock_frame_transformer = make_ref_counted<NiceMock<MockFrameTransformer>>(); @@ -321,7 +322,7 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest, SenderFramesAreConvertedToReceiverFrames) { - AutoThread main_thread_; + test::RunLoop main_thread_; TestRtpVideoFrameReceiver receiver; auto mock_frame_transformer = make_ref_counted<NiceMock<MockFrameTransformer>>(); @@ -361,7 +362,7 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest, ManageFrameFromDifferentReceiver) { - AutoThread main_thread_; + test::RunLoop main_thread_; std::vector<uint32_t> csrcs = {234, 345, 456}; const int frame_id = 11; @@ -413,7 +414,7 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest, ShortCircuitingSkipsTransform) { - AutoThread main_thread_; + test::RunLoop main_thread_; TestRtpVideoFrameReceiver receiver; auto mock_frame_transformer = make_ref_counted<NiceMock<MockFrameTransformer>>();
diff --git a/modules/video_coding/nack_requester_unittest.cc b/modules/video_coding/nack_requester_unittest.cc index 85711e2..3ce8263 100644 --- a/modules/video_coding/nack_requester_unittest.cc +++ b/modules/video_coding/nack_requester_unittest.cc
@@ -20,7 +20,6 @@ #include "api/units/time_delta.h" #include "modules/include/module_common_types.h" #include "rtc_base/checks.h" -#include "rtc_base/thread.h" #include "system_wrappers/include/clock.h" #include "test/create_test_field_trials.h" #include "test/gtest.h" @@ -94,7 +93,7 @@ } static constexpr int64_t kDefaultRttMs = 20; - AutoThread main_thread_; + test::RunLoop main_thread_; test::RunLoop loop_; std::unique_ptr<SimulatedClock> clock_; std::unique_ptr<NackPeriodicProcessor> nack_periodic_processor_; @@ -287,7 +286,7 @@ void RequestKeyFrame() override { ++keyframes_requested_; } - AutoThread main_thread_; + test::RunLoop main_thread_; std::unique_ptr<SimulatedClock> clock_; NackPeriodicProcessor nack_periodic_processor_; NackRequester nack_module_;