Introduce TaskQueueForTest.

This class adds a convenience method that allows *sending* a task
to the queue (as opposed to posting). Sending is essentially
Post+Wait, a pattern that we don't want to encourage use of
in production code, but is convenient to have from a testing
perspective and there are already several places in the
source code where we use it.

Change-Id: I6efd1b2257e6c641294bb6e4eb53b0021d9553ca
Bug: webrtc:8848
Reviewed-on: https://webrtc-review.googlesource.com/50441
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22022}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index d3ec1eb..6dccc48 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -996,6 +996,21 @@
     ]
   }
 
+  rtc_source_set("rtc_task_queue_for_test") {
+    visibility = [ "*" ]
+    testonly = true
+
+    sources = [
+      "task_queue_for_test.cc",
+      "task_queue_for_test.h",
+    ]
+    deps = [
+      ":checks",
+      ":rtc_base_approved",
+      ":rtc_task_queue",
+    ]
+  }
+
   rtc_source_set("rtc_task_queue_unittests") {
     visibility = [ "*" ]
     testonly = true
@@ -1008,6 +1023,7 @@
       ":rtc_base_tests_main",
       ":rtc_base_tests_utils",
       ":rtc_task_queue",
+      ":rtc_task_queue_for_test",
       "../test:test_support",
     ]
   }