Use RunLoop in media/ tests

Bug: webrtc:469327588
Change-Id: Ife8aeee90aeabfb2a123a85f125358746a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/461343
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47309}
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 15c2cf9..dcdb269 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -1128,6 +1128,7 @@
           "../net/dcsctp/public:factory",
           "../net/dcsctp/public:mocks",
           "../net/dcsctp/public:socket",
+          "../test:run_loop",
         ]
       }
     }
diff --git a/media/sctp/dcsctp_transport_unittest.cc b/media/sctp/dcsctp_transport_unittest.cc
index dffbc7a..bfe797c 100644
--- a/media/sctp/dcsctp_transport_unittest.cc
+++ b/media/sctp/dcsctp_transport_unittest.cc
@@ -31,6 +31,7 @@
 #include "system_wrappers/include/clock.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
+#include "test/run_loop.h"
 
 using ::testing::_;
 using ::testing::ByMove;
@@ -100,7 +101,7 @@
 }  // namespace
 
 TEST(DcSctpTransportTest, OpenSequence) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
   peer_a.fake_dtls_transport_.SetWritable(true);
 
@@ -118,7 +119,7 @@
 // Tests that the close sequence invoked from one end results in the stream to
 // be reset from both ends and all the proper signals are sent.
 TEST(DcSctpTransportTest, CloseSequence) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
   Peer peer_b;
   peer_a.fake_dtls_transport_.SetDestination(&peer_b.fake_dtls_transport_,
@@ -168,7 +169,7 @@
 // terminates properly. Both peers will think they initiated it, so no
 // OnClosingProcedureStartedRemotely should be called.
 TEST(DcSctpTransportTest, CloseSequenceSimultaneous) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
   Peer peer_b;
   peer_a.fake_dtls_transport_.SetDestination(&peer_b.fake_dtls_transport_,
@@ -212,7 +213,7 @@
 }
 
 TEST(DcSctpTransportTest, SetStreamPriority) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
 
   {
@@ -236,7 +237,7 @@
 }
 
 TEST(DcSctpTransportTest, DiscardMessageClosedChannel) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
 
   EXPECT_CALL(*peer_a.socket_, Send(_, _)).Times(0);
@@ -252,7 +253,7 @@
 }
 
 TEST(DcSctpTransportTest, DiscardMessageClosingChannel) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
 
   EXPECT_CALL(*peer_a.socket_, Send(_, _)).Times(0);
@@ -270,7 +271,7 @@
 }
 
 TEST(DcSctpTransportTest, SendDataOpenChannel) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
   dcsctp::DcSctpOptions options;
 
@@ -288,7 +289,7 @@
 }
 
 TEST(DcSctpTransportTest, DeliversMessage) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
 
   EXPECT_CALL(peer_a.sink_, OnDataReceived(1, DataMessageType::kBinary, _))
@@ -305,7 +306,7 @@
 }
 
 TEST(DcSctpTransportTest, DropMessageWithUnknownPpid) {
-  AutoThread main_thread;
+  test::RunLoop main_thread;
   Peer peer_a;
 
   EXPECT_CALL(peer_a.sink_, OnDataReceived(_, _, _)).Times(0);