Replace Invoke in tests with SendTask test helper

Bug: webrtc:11318
Change-Id: I14e3fbc694d41c785a61c88d8207005c681576c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271540
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37774}
diff --git a/test/network/network_emulation_pc_unittest.cc b/test/network/network_emulation_pc_unittest.cc
index 7662b1c..0519dd8 100644
--- a/test/network/network_emulation_pc_unittest.cc
+++ b/test/network/network_emulation_pc_unittest.cc
@@ -26,6 +26,7 @@
 #include "pc/peer_connection_wrapper.h"
 #include "pc/test/mock_peer_connection_observers.h"
 #include "rtc_base/gunit.h"
+#include "rtc_base/task_queue_for_test.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 #include "test/network/network_emulation.h"
@@ -146,7 +147,7 @@
   std::unique_ptr<MockPeerConnectionObserver> bob_observer =
       std::make_unique<MockPeerConnectionObserver>();
 
-  signaling_thread->Invoke<void>(RTC_FROM_HERE, [&]() {
+  SendTask(signaling_thread.get(), [&]() {
     alice_pcf = CreatePeerConnectionFactory(signaling_thread.get(),
                                             alice_network->network_thread());
     alice_pc = CreatePeerConnection(alice_pcf, alice_observer.get(),
@@ -167,7 +168,7 @@
       std::make_unique<PeerConnectionWrapper>(bob_pcf, bob_pc,
                                               std::move(bob_observer));
 
-  signaling_thread->Invoke<void>(RTC_FROM_HERE, [&]() {
+  SendTask(signaling_thread.get(), [&]() {
     rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
         alice_pcf->CreateAudioSource(cricket::AudioOptions());
     rtc::scoped_refptr<AudioTrackInterface> track =
@@ -256,7 +257,7 @@
   std::unique_ptr<MockPeerConnectionObserver> bob_observer =
       std::make_unique<MockPeerConnectionObserver>();
 
-  signaling_thread->Invoke<void>(RTC_FROM_HERE, [&]() {
+  SendTask(signaling_thread.get(), [&]() {
     alice_pcf = CreatePeerConnectionFactory(signaling_thread.get(),
                                             alice_network->network_thread());
     alice_pc = CreatePeerConnection(
@@ -277,7 +278,7 @@
       std::make_unique<PeerConnectionWrapper>(bob_pcf, bob_pc,
                                               std::move(bob_observer));
 
-  signaling_thread->Invoke<void>(RTC_FROM_HERE, [&]() {
+  SendTask(signaling_thread.get(), [&]() {
     rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
         alice_pcf->CreateAudioSource(cricket::AudioOptions());
     rtc::scoped_refptr<AudioTrackInterface> track =