Use field trial parser for BBR Experiment.

Bug: webrtc:8415
Change-Id: If6336b16fa55c6bd891252fc3b9c0bcce56e2fd1
Reviewed-on: https://webrtc-review.googlesource.com/83620
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23761}
This commit is contained in:
Sebastian Jansson
2018-06-27 14:06:00 +02:00
committed by Commit Bot
parent e275174b1b
commit 968b1dd0d7
6 changed files with 151 additions and 239 deletions

View File

@ -13,35 +13,6 @@
#include "test/field_trial.h"
namespace webrtc {
namespace {
void ExpectEquals(CongestionControllerExperiment::BbrExperimentConfig a,
CongestionControllerExperiment::BbrExperimentConfig b) {
EXPECT_EQ(a.exit_startup_on_loss, b.exit_startup_on_loss);
EXPECT_EQ(a.exit_startup_rtt_threshold_ms, b.exit_startup_rtt_threshold_ms);
EXPECT_EQ(a.fully_drain_queue, b.fully_drain_queue);
EXPECT_EQ(a.initial_conservation_in_startup,
b.initial_conservation_in_startup);
EXPECT_EQ(a.num_startup_rtts, b.num_startup_rtts);
EXPECT_EQ(a.probe_rtt_based_on_bdp, b.probe_rtt_based_on_bdp);
EXPECT_EQ(a.probe_rtt_disabled_if_app_limited,
b.probe_rtt_disabled_if_app_limited);
EXPECT_EQ(a.probe_rtt_skipped_if_similar_rtt,
b.probe_rtt_skipped_if_similar_rtt);
EXPECT_EQ(a.rate_based_recovery, b.rate_based_recovery);
EXPECT_EQ(a.rate_based_startup, b.rate_based_startup);
EXPECT_EQ(a.slower_startup, b.slower_startup);
EXPECT_EQ(a.encoder_rate_gain, b.encoder_rate_gain);
EXPECT_EQ(a.encoder_rate_gain_in_probe_rtt, b.encoder_rate_gain_in_probe_rtt);
EXPECT_EQ(a.max_ack_height_window_multiplier,
b.max_ack_height_window_multiplier);
EXPECT_EQ(a.max_aggregation_bytes_multiplier,
b.max_aggregation_bytes_multiplier);
EXPECT_EQ(a.probe_bw_pacing_gain_offset, b.probe_bw_pacing_gain_offset);
EXPECT_EQ(a.probe_rtt_congestion_window_gain,
b.probe_rtt_congestion_window_gain);
}
} // namespace
TEST(CongestionControllerExperimentTest, BbrDisabledByDefault) {
webrtc::test::ScopedFieldTrials field_trials("");
EXPECT_FALSE(CongestionControllerExperiment::BbrControllerEnabled());
@ -52,38 +23,4 @@ TEST(CongestionControllerExperimentTest, BbrEnabledByFieldTrial) {
"WebRTC-BweCongestionController/Enabled,BBR/");
EXPECT_TRUE(CongestionControllerExperiment::BbrControllerEnabled());
}
TEST(CongestionControllerExperimentTest, BbrBadParametersFails) {
webrtc::test::ScopedFieldTrials field_trials(
"WebRTC-BweCongestionController/Enabled,BBR,"
"garbage,here/");
EXPECT_FALSE(CongestionControllerExperiment::GetBbrExperimentConfig());
}
TEST(CongestionControllerExperimentTest, BbrZeroParametersParsed) {
CongestionControllerExperiment::BbrExperimentConfig truth = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
webrtc::test::ScopedFieldTrials field_trials(
"WebRTC-BweCongestionController/Enabled,BBR,"
"0,0,0,0,0,0,0,0,0,0,0,"
"0,0,0,0,0,0/");
auto config = CongestionControllerExperiment::GetBbrExperimentConfig();
EXPECT_TRUE(config);
if (config)
ExpectEquals(truth, *config);
}
TEST(CongestionControllerExperimentTest, BbrNonZeroParametersParsed) {
CongestionControllerExperiment::BbrExperimentConfig truth = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25};
webrtc::test::ScopedFieldTrials field_trials(
"WebRTC-BweCongestionController/Enabled,BBR,"
"1,1,1,1,1,1,1,1,1,1,1,"
"0.25,0.25,0.25,0.25,0.25,0.25/");
auto config = CongestionControllerExperiment::GetBbrExperimentConfig();
EXPECT_TRUE(config);
if (config)
ExpectEquals(truth, *config);
}
} // namespace webrtc