Allow injection of custom network models in place of FakeNetworkPipe.
Adds a constructor for DirectTransport that takes a pointer to an instance
of a class derived from FakeNetworkPipe. Said class can override Process()
and SendPacket(...) members thereby emulating any desired network behavior.
Bug: b/67487983
Change-Id: I829fd3506124db61587af19192a14fdf62b06ca5
Reviewed-on: https://webrtc-review.googlesource.com/14620
Commit-Queue: Christoffer Rodbro <crodbro@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20443}diff --git a/test/direct_transport.h b/test/direct_transport.h
index 68a1968..85cd892 100644
--- a/test/direct_transport.h
+++ b/test/direct_transport.h
@@ -46,6 +46,9 @@
Call* send_call,
std::unique_ptr<Demuxer> demuxer);
+ DirectTransport(SingleThreadedTaskQueueForTesting* task_queue,
+ std::unique_ptr<FakeNetworkPipe> pipe, Call* send_call);
+
~DirectTransport() override;
void SetConfig(const FakeNetworkPipe::Config& config);
@@ -64,6 +67,7 @@
private:
void SendPackets();
+ void Start();
Call* const send_call_;
Clock* const clock_;
@@ -72,7 +76,7 @@
SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_
RTC_GUARDED_BY(&sequence_checker_);
- FakeNetworkPipe fake_network_;
+ std::unique_ptr<FakeNetworkPipe> fake_network_;
rtc::SequencedTaskChecker sequence_checker_;
};