Add a FieldTrialsView argument to the NetworkEmulationManager ctor.
Change-Id: Ic4acd04aef9e9f6185d045bc300d8dbea50759fd
Bug: b/314891512
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330001
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Cr-Commit-Position: refs/heads/main@{#41320}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index ee16257..abefbc9 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -643,6 +643,7 @@
"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 f5d5a1b..14a7a6a 100644
--- a/api/test/create_network_emulation_manager.cc
+++ b/api/test/create_network_emulation_manager.cc
@@ -13,15 +13,17 @@
#include <memory>
+#include "api/field_trials_view.h"
#include "test/network/network_emulation_manager.h"
namespace webrtc {
std::unique_ptr<NetworkEmulationManager> CreateNetworkEmulationManager(
TimeMode time_mode,
- EmulatedNetworkStatsGatheringMode stats_gathering_mode) {
+ EmulatedNetworkStatsGatheringMode stats_gathering_mode,
+ const FieldTrialsView* field_trials) {
return std::make_unique<test::NetworkEmulationManagerImpl>(
- 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 941b2b1..2f2dfed 100644
--- a/api/test/create_network_emulation_manager.h
+++ b/api/test/create_network_emulation_manager.h
@@ -13,6 +13,7 @@
#include <memory>
+#include "api/field_trials_view.h"
#include "api/test/network_emulation_manager.h"
namespace webrtc {
@@ -21,7 +22,8 @@
std::unique_ptr<NetworkEmulationManager> 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 97c0bc1..46c43e2 100644
--- a/test/network/network_emulation_manager.cc
+++ b/test/network/network_emulation_manager.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <memory>
+#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 @@
// uint32_t representation of 192.168.255.255 address
constexpr uint32_t kMaxIPv4Address = 0xC0A8FFFF;
-std::unique_ptr<TimeController> CreateTimeController(TimeMode mode) {
+std::unique_ptr<TimeController> CreateTimeController(
+ TimeMode mode,
+ const FieldTrialsView* field_trials) {
switch (mode) {
case TimeMode::kRealTime:
- return std::make_unique<RealTimeController>();
+ return std::make_unique<RealTimeController>(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 @@
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 29debca..4b0a764 100644
--- a/test/network/network_emulation_manager.h
+++ b/test/network/network_emulation_manager.h
@@ -18,6 +18,7 @@
#include <vector>
#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 @@
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 b4b368a..cccb7a4 100644
--- a/test/time_controller/BUILD.gn
+++ b/test/time_controller/BUILD.gn
@@ -24,6 +24,7 @@
]
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 7cc750d..537532d 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 @@
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<MainThread>()) {
main_thread_->SetName("Main", this);
}
diff --git a/test/time_controller/real_time_controller.h b/test/time_controller/real_time_controller.h
index 5f02eaf..0085732 100644
--- a/test/time_controller/real_time_controller.h
+++ b/test/time_controller/real_time_controller.h
@@ -13,6 +13,7 @@
#include <functional>
#include <memory>
+#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;