diff --git a/api/BUILD.gn b/api/BUILD.gn index ee162577c8..abefbc90a5 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -643,6 +643,7 @@ if (rtc_include_tests) { "test/create_network_emulation_manager.h", ] deps = [ + ":field_trials_view", ":network_emulation_manager_api", "../test/network:emulated_network", ] diff --git a/api/test/create_network_emulation_manager.cc b/api/test/create_network_emulation_manager.cc index f5d5a1bc88..14a7a6a171 100644 --- a/api/test/create_network_emulation_manager.cc +++ b/api/test/create_network_emulation_manager.cc @@ -13,15 +13,17 @@ #include +#include "api/field_trials_view.h" #include "test/network/network_emulation_manager.h" namespace webrtc { std::unique_ptr CreateNetworkEmulationManager( TimeMode time_mode, - EmulatedNetworkStatsGatheringMode stats_gathering_mode) { + EmulatedNetworkStatsGatheringMode stats_gathering_mode, + const FieldTrialsView* field_trials) { return std::make_unique( - time_mode, stats_gathering_mode); + time_mode, stats_gathering_mode, field_trials); } } // namespace webrtc diff --git a/api/test/create_network_emulation_manager.h b/api/test/create_network_emulation_manager.h index 941b2b1c52..2f2dfeda28 100644 --- a/api/test/create_network_emulation_manager.h +++ b/api/test/create_network_emulation_manager.h @@ -13,6 +13,7 @@ #include +#include "api/field_trials_view.h" #include "api/test/network_emulation_manager.h" namespace webrtc { @@ -21,7 +22,8 @@ namespace webrtc { std::unique_ptr CreateNetworkEmulationManager( TimeMode time_mode = TimeMode::kRealTime, EmulatedNetworkStatsGatheringMode stats_gathering_mode = - EmulatedNetworkStatsGatheringMode::kDefault); + EmulatedNetworkStatsGatheringMode::kDefault, + const FieldTrialsView* field_trials = nullptr); } // namespace webrtc diff --git a/test/network/network_emulation_manager.cc b/test/network/network_emulation_manager.cc index 97c0bc1ba8..46c43e2ce6 100644 --- a/test/network/network_emulation_manager.cc +++ b/test/network/network_emulation_manager.cc @@ -13,6 +13,7 @@ #include #include +#include "api/field_trials_view.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" #include "call/simulated_network.h" @@ -30,10 +31,12 @@ constexpr uint32_t kMinIPv4Address = 0xC0A80000; // uint32_t representation of 192.168.255.255 address constexpr uint32_t kMaxIPv4Address = 0xC0A8FFFF; -std::unique_ptr CreateTimeController(TimeMode mode) { +std::unique_ptr CreateTimeController( + TimeMode mode, + const FieldTrialsView* field_trials) { switch (mode) { case TimeMode::kRealTime: - return std::make_unique(); + return std::make_unique(field_trials); case TimeMode::kSimulated: // Using an offset of 100000 to get nice fixed width and readable // timestamps in typical test scenarios. @@ -46,10 +49,11 @@ std::unique_ptr CreateTimeController(TimeMode mode) { NetworkEmulationManagerImpl::NetworkEmulationManagerImpl( TimeMode mode, - EmulatedNetworkStatsGatheringMode stats_gathering_mode) + EmulatedNetworkStatsGatheringMode stats_gathering_mode, + const FieldTrialsView* field_trials) : time_mode_(mode), stats_gathering_mode_(stats_gathering_mode), - time_controller_(CreateTimeController(mode)), + time_controller_(CreateTimeController(mode, field_trials)), 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 29debca693..4b0a76494f 100644 --- a/test/network/network_emulation_manager.h +++ b/test/network/network_emulation_manager.h @@ -18,6 +18,7 @@ #include #include "api/array_view.h" +#include "api/field_trials_view.h" #include "api/test/network_emulation_manager.h" #include "api/test/simulated_network.h" #include "api/test/time_controller.h" @@ -38,7 +39,8 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager { public: NetworkEmulationManagerImpl( TimeMode mode, - EmulatedNetworkStatsGatheringMode stats_gathering_mode); + EmulatedNetworkStatsGatheringMode stats_gathering_mode, + const FieldTrialsView* field_trials = nullptr); ~NetworkEmulationManagerImpl(); EmulatedNetworkNode* CreateEmulatedNode(BuiltInNetworkBehaviorConfig config, diff --git a/test/time_controller/BUILD.gn b/test/time_controller/BUILD.gn index b4b368a42a..cccb7a46ff 100644 --- a/test/time_controller/BUILD.gn +++ b/test/time_controller/BUILD.gn @@ -24,6 +24,7 @@ rtc_library("time_controller") { ] deps = [ + "../../api:field_trials_view", "../../api:sequence_checker", "../../api:time_controller", "../../api/task_queue", diff --git a/test/time_controller/real_time_controller.cc b/test/time_controller/real_time_controller.cc index 7cc750d6d4..537532d20f 100644 --- a/test/time_controller/real_time_controller.cc +++ b/test/time_controller/real_time_controller.cc @@ -9,6 +9,7 @@ */ #include "test/time_controller/real_time_controller.h" +#include "api/field_trials_view.h" #include "api/task_queue/default_task_queue_factory.h" #include "rtc_base/null_socket_server.h" @@ -30,8 +31,8 @@ class MainThread : public rtc::Thread { CurrentThreadSetter current_setter_; }; } // namespace -RealTimeController::RealTimeController() - : task_queue_factory_(CreateDefaultTaskQueueFactory()), +RealTimeController::RealTimeController(const FieldTrialsView* field_trials) + : task_queue_factory_(CreateDefaultTaskQueueFactory(field_trials)), main_thread_(std::make_unique()) { main_thread_->SetName("Main", this); } diff --git a/test/time_controller/real_time_controller.h b/test/time_controller/real_time_controller.h index 5f02eaf85f..0085732e63 100644 --- a/test/time_controller/real_time_controller.h +++ b/test/time_controller/real_time_controller.h @@ -13,6 +13,7 @@ #include #include +#include "api/field_trials_view.h" #include "api/task_queue/task_queue_factory.h" #include "api/test/time_controller.h" #include "api/units/time_delta.h" @@ -21,7 +22,7 @@ namespace webrtc { class RealTimeController : public TimeController { public: - RealTimeController(); + RealTimeController(const FieldTrialsView* field_trials = nullptr); Clock* GetClock() override; TaskQueueFactory* GetTaskQueueFactory() override;