Reland "Using simulated rtc::Thread for peer connection scenario tests."
This is a reland of b70c5c5ce97e7dcf2e1d8453f5ea0639d4b60453
Original change's description:
> Using simulated rtc::Thread for peer connection scenario tests.
>
> Bug: webrtc:11255
> Change-Id: I5d29e997a7209ffc64595082358cca9b2115d07a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165689
> Commit-Queue: Sebastian Jansson <srte@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30258}
Bug: webrtc:11255
Change-Id: If65cd56b59158cebec5609407a721fbdb47cfd1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166046
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30294}
diff --git a/api/test/time_controller.h b/api/test/time_controller.h
index 70aabda..6c47e91 100644
--- a/api/test/time_controller.h
+++ b/api/test/time_controller.h
@@ -12,12 +12,14 @@
#include <functional>
#include <memory>
+#include <string>
#include "api/task_queue/task_queue_factory.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "modules/utility/include/process_thread.h"
#include "rtc_base/synchronization/yield_policy.h"
+#include "rtc_base/thread.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
@@ -37,6 +39,15 @@
// Creates a process thread.
virtual std::unique_ptr<ProcessThread> CreateProcessThread(
const char* thread_name) = 0;
+ // Creates an rtc::Thread instance. If |socket_server| is nullptr, a default
+ // noop socket server is created.
+ virtual std::unique_ptr<rtc::Thread> CreateThread(
+ const std::string& name,
+ std::unique_ptr<rtc::SocketServer> socket_server = nullptr) = 0;
+
+ // Creates an rtc::Thread instance that ensure that it's set as the current
+ // thread.
+ virtual rtc::Thread* GetMainThread() = 0;
// Allow task queues and process threads created by this instance to execute
// for the given |duration|.
virtual void AdvanceTime(TimeDelta duration) = 0;