diff --git a/api/test/network_emulation_manager.h b/api/test/network_emulation_manager.h index dd4c83549b..a45545141e 100644 --- a/api/test/network_emulation_manager.h +++ b/api/test/network_emulation_manager.h @@ -167,6 +167,8 @@ class NetworkEmulationManager { virtual ~NetworkEmulationManager() = default; virtual TimeController* time_controller() = 0; + // Returns a mode in which underlying time controller operates. + virtual TimeMode time_mode() const = 0; // Creates an emulated network node, which represents single network in // the emulated network layer. Uses default implementation on network behavior diff --git a/test/network/network_emulation_manager.cc b/test/network/network_emulation_manager.cc index 93bcda133e..57c2703d2d 100644 --- a/test/network/network_emulation_manager.cc +++ b/test/network/network_emulation_manager.cc @@ -46,7 +46,8 @@ std::unique_ptr CreateTimeController(TimeMode mode) { } // namespace NetworkEmulationManagerImpl::NetworkEmulationManagerImpl(TimeMode mode) - : time_controller_(CreateTimeController(mode)), + : time_mode_(mode), + time_controller_(CreateTimeController(mode)), clock_(time_controller_->GetClock()), next_node_id_(1), next_ip4_address_(kMinIPv4Address), diff --git a/test/network/network_emulation_manager.h b/test/network/network_emulation_manager.h index d6e8786c4f..e89a67f46e 100644 --- a/test/network/network_emulation_manager.h +++ b/test/network/network_emulation_manager.h @@ -82,6 +82,8 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager { TimeController* time_controller() override { return time_controller_.get(); } + TimeMode time_mode() const override { return time_mode_; } + Timestamp Now() const; EmulatedTURNServerInterface* CreateTURNServer( @@ -92,6 +94,8 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager { std::pair, RepeatingTaskHandle>; absl::optional GetNextIPv4Address(); + + const TimeMode time_mode_; const std::unique_ptr time_controller_; Clock* const clock_; int next_node_id_;