From ce6170fcdfa5654fc015e13934bccca4e8997878 Mon Sep 17 00:00:00 2001 From: Per Kjellander Date: Fri, 21 Jan 2022 11:39:02 +0100 Subject: [PATCH] Refactor GoogCC unittests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the refactoring, the test fixture is only used for creating the object under test and dependencies. This leads to more readable code and allows more flexibility when creating the object under test. Bug: none Change-Id: I643330290da17efe0a02fe5dc6b884136705de0b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/248140 Reviewed-by: Björn Terelius Commit-Queue: Per Kjellander Cr-Commit-Position: refs/heads/main@{#35770} --- api/transport/network_types.cc | 4 - api/transport/network_types.h | 3 - .../goog_cc_network_control_unittest.cc | 379 +++++++++--------- 3 files changed, 194 insertions(+), 192 deletions(-) diff --git a/api/transport/network_types.cc b/api/transport/network_types.cc index 7451940151..d6495ce490 100644 --- a/api/transport/network_types.cc +++ b/api/transport/network_types.cc @@ -103,8 +103,4 @@ bool PacedPacketInfo::operator==(const PacedPacketInfo& rhs) const { probe_cluster_min_bytes == rhs.probe_cluster_min_bytes; } -ProcessInterval::ProcessInterval() = default; -ProcessInterval::ProcessInterval(const ProcessInterval&) = default; -ProcessInterval::~ProcessInterval() = default; - } // namespace webrtc diff --git a/api/transport/network_types.h b/api/transport/network_types.h index 4e96b0f12e..29a7cf7705 100644 --- a/api/transport/network_types.h +++ b/api/transport/network_types.h @@ -241,9 +241,6 @@ struct NetworkControlUpdate { // Process control struct ProcessInterval { - ProcessInterval(); - ProcessInterval(const ProcessInterval&); - ~ProcessInterval(); Timestamp at_time = Timestamp::PlusInfinity(); absl::optional pacer_queue; }; diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc index 402afcb4e1..ed80b731bf 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc @@ -19,11 +19,7 @@ #include "test/gtest.h" #include "test/scenario/scenario.h" -using ::testing::_; -using ::testing::Field; -using ::testing::Matcher; using ::testing::NiceMock; -using ::testing::Property; namespace webrtc { namespace test { @@ -75,6 +71,72 @@ CallClient* CreateVideoSendingClient( return client; } +NetworkRouteChange CreateRouteChange( + Timestamp time, + absl::optional start_rate = absl::nullopt, + absl::optional min_rate = absl::nullopt, + absl::optional max_rate = absl::nullopt) { + NetworkRouteChange route_change; + route_change.at_time = time; + route_change.constraints.at_time = time; + route_change.constraints.min_data_rate = min_rate; + route_change.constraints.max_data_rate = max_rate; + route_change.constraints.starting_rate = start_rate; + return route_change; +} + +PacketResult CreatePacketResult(Timestamp arrival_time, + Timestamp send_time, + size_t payload_size, + PacedPacketInfo pacing_info) { + PacketResult packet_result; + packet_result.sent_packet = SentPacket(); + packet_result.sent_packet.send_time = send_time; + packet_result.sent_packet.size = DataSize::Bytes(payload_size); + packet_result.sent_packet.pacing_info = pacing_info; + packet_result.receive_time = arrival_time; + return packet_result; +} + +// Simulate sending packets and receiving transport feedback during +// `runtime_ms`. +absl::optional PacketTransmissionAndFeedbackBlock( + NetworkControllerInterface* controller, + int64_t runtime_ms, + int64_t delay, + Timestamp& current_time) { + NetworkControlUpdate update; + absl::optional target_bitrate; + int64_t delay_buildup = 0; + int64_t start_time_ms = current_time.ms(); + while (current_time.ms() - start_time_ms < runtime_ms) { + constexpr size_t kPayloadSize = 1000; + PacketResult packet = + CreatePacketResult(current_time + TimeDelta::Millis(delay_buildup), + current_time, kPayloadSize, PacedPacketInfo()); + delay_buildup += delay; + update = controller->OnSentPacket(packet.sent_packet); + if (update.target_rate) { + target_bitrate = update.target_rate->target_rate; + } + TransportPacketsFeedback feedback; + feedback.feedback_time = packet.receive_time; + feedback.packet_feedbacks.push_back(packet); + update = controller->OnTransportPacketsFeedback(feedback); + if (update.target_rate) { + target_bitrate = update.target_rate->target_rate; + } + current_time += TimeDelta::Millis(50); + update = controller->OnProcessInterval({.at_time = current_time}); + if (update.target_rate) { + target_bitrate = update.target_rate->target_rate; + } + } + return target_bitrate; +} + +// Scenarios: + void UpdatesTargetRateBasedOnLinkCapacity(std::string test_name = "") { ScopedFieldTrials trial("WebRTC-SendSideBwe-WithOverhead/Enabled/"); auto factory = CreateFeedbackOnlyFactory(); @@ -153,40 +215,27 @@ DataRate RunRembDipScenario(std::string test_name) { return client->send_bandwidth(); } + } // namespace -class GoogCcNetworkControllerTest : public ::testing::Test { - protected: - GoogCcNetworkControllerTest() - : current_time_(Timestamp::Millis(123456)), factory_() {} - ~GoogCcNetworkControllerTest() override {} +class NetworkControllerTestFixture { + public: + NetworkControllerTestFixture() : factory_() {} - void SetUp() override { - controller_ = factory_.Create(InitialConfig()); - NetworkControlUpdate update = - controller_->OnProcessInterval(DefaultInterval()); - EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate); - EXPECT_EQ(update.pacer_config->data_rate(), - kInitialBitrate * kDefaultPacingRate); - - EXPECT_EQ(update.probe_cluster_configs[0].target_data_rate, - kInitialBitrate * 3); - EXPECT_EQ(update.probe_cluster_configs[1].target_data_rate, - kInitialBitrate * 5); - } - // Custom setup - use an observer that tracks the target bitrate, without - // prescribing on which iterations it must change (like a mock would). - void TargetBitrateTrackingSetup() { - controller_ = factory_.Create(InitialConfig()); - OnUpdate(controller_->OnProcessInterval(DefaultInterval())); + std::unique_ptr CreateController() { + NetworkControllerConfig config = InitialConfig(); + std::unique_ptr controller = + factory_.Create(config); + return controller; } + private: NetworkControllerConfig InitialConfig( int starting_bandwidth_kbps = kInitialBitrateKbps, int min_data_rate_kbps = 0, int max_data_rate_kbps = 5 * kInitialBitrateKbps) { NetworkControllerConfig config; - config.constraints.at_time = current_time_; + config.constraints.at_time = Timestamp::Millis(0); config.constraints.min_data_rate = DataRate::KilobitsPerSec(min_data_rate_kbps); config.constraints.max_data_rate = @@ -196,102 +245,122 @@ class GoogCcNetworkControllerTest : public ::testing::Test { config.event_log = &event_log_; return config; } - ProcessInterval DefaultInterval() { - ProcessInterval interval; - interval.at_time = current_time_; - return interval; - } - RemoteBitrateReport CreateBitrateReport(DataRate rate) { - RemoteBitrateReport report; - report.receive_time = current_time_; - report.bandwidth = rate; - return report; - } - PacketResult CreateResult(int64_t arrival_time_ms, - int64_t send_time_ms, - size_t payload_size, - PacedPacketInfo pacing_info) { - PacketResult packet_result; - packet_result.sent_packet = SentPacket(); - packet_result.sent_packet.send_time = Timestamp::Millis(send_time_ms); - packet_result.sent_packet.size = DataSize::Bytes(payload_size); - packet_result.sent_packet.pacing_info = pacing_info; - packet_result.receive_time = Timestamp::Millis(arrival_time_ms); - return packet_result; - } - NetworkRouteChange CreateRouteChange( - absl::optional start_rate = absl::nullopt, - absl::optional min_rate = absl::nullopt, - absl::optional max_rate = absl::nullopt) { - NetworkRouteChange route_change; - route_change.at_time = current_time_; - route_change.constraints.at_time = current_time_; - route_change.constraints.min_data_rate = min_rate; - route_change.constraints.max_data_rate = max_rate; - route_change.constraints.starting_rate = start_rate; - return route_change; - } - - void AdvanceTimeMilliseconds(int timedelta_ms) { - current_time_ += TimeDelta::Millis(timedelta_ms); - } - - void OnUpdate(NetworkControlUpdate update) { - if (update.target_rate) - target_bitrate_ = update.target_rate->target_rate; - } - - void PacketTransmissionAndFeedbackBlock(int64_t runtime_ms, int64_t delay) { - int64_t delay_buildup = 0; - int64_t start_time_ms = current_time_.ms(); - while (current_time_.ms() - start_time_ms < runtime_ms) { - constexpr size_t kPayloadSize = 1000; - PacketResult packet = - CreateResult(current_time_.ms() + delay_buildup, current_time_.ms(), - kPayloadSize, PacedPacketInfo()); - delay_buildup += delay; - OnUpdate(controller_->OnSentPacket(packet.sent_packet)); - TransportPacketsFeedback feedback; - feedback.feedback_time = packet.receive_time; - feedback.packet_feedbacks.push_back(packet); - OnUpdate(controller_->OnTransportPacketsFeedback(feedback)); - AdvanceTimeMilliseconds(50); - OnUpdate(controller_->OnProcessInterval(DefaultInterval())); - } - } - Timestamp current_time_; - absl::optional target_bitrate_; NiceMock event_log_; GoogCcNetworkControllerFactory factory_; - std::unique_ptr controller_; }; -TEST_F(GoogCcNetworkControllerTest, ReactsToChangedNetworkConditions) { - // Test no change. - AdvanceTimeMilliseconds(25); - OnUpdate(controller_->OnProcessInterval(DefaultInterval())); +TEST(GoogCcNetworkControllerTest, InitializeTargetRateOnFirstProcessInterval) { + NetworkControllerTestFixture fixture; + std::unique_ptr controller = + fixture.CreateController(); - NetworkControlUpdate update; - OnUpdate(controller_->OnRemoteBitrateReport( - CreateBitrateReport(kInitialBitrate * 2))); - AdvanceTimeMilliseconds(25); - update = controller_->OnProcessInterval(DefaultInterval()); + NetworkControlUpdate update = + controller->OnProcessInterval({.at_time = Timestamp::Millis(123456)}); + + EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate); + EXPECT_EQ(update.pacer_config->data_rate(), + kInitialBitrate * kDefaultPacingRate); + EXPECT_EQ(update.probe_cluster_configs[0].target_data_rate, + kInitialBitrate * 3); + EXPECT_EQ(update.probe_cluster_configs[1].target_data_rate, + kInitialBitrate * 5); +} + +TEST(GoogCcNetworkControllerTest, ReactsToChangedNetworkConditions) { + NetworkControllerTestFixture fixture; + std::unique_ptr controller = + fixture.CreateController(); + Timestamp current_time = Timestamp::Millis(123); + NetworkControlUpdate update = + controller->OnProcessInterval({.at_time = current_time}); + update = controller->OnRemoteBitrateReport( + {.receive_time = current_time, .bandwidth = kInitialBitrate * 2}); + + current_time += TimeDelta::Millis(25); + update = controller->OnProcessInterval({.at_time = current_time}); EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate * 2); EXPECT_EQ(update.pacer_config->data_rate(), kInitialBitrate * 2 * kDefaultPacingRate); - OnUpdate( - controller_->OnRemoteBitrateReport(CreateBitrateReport(kInitialBitrate))); - AdvanceTimeMilliseconds(25); - update = controller_->OnProcessInterval(DefaultInterval()); + update = controller->OnRemoteBitrateReport( + {.receive_time = current_time, .bandwidth = kInitialBitrate}); + current_time += TimeDelta::Millis(25); + update = controller->OnProcessInterval({.at_time = current_time}); EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate); EXPECT_EQ(update.pacer_config->data_rate(), kInitialBitrate * kDefaultPacingRate); } +TEST(GoogCcNetworkControllerTest, OnNetworkRouteChanged) { + NetworkControllerTestFixture fixture; + std::unique_ptr controller = + fixture.CreateController(); + Timestamp current_time = Timestamp::Millis(123); + DataRate new_bitrate = DataRate::BitsPerSec(200000); + NetworkControlUpdate update = controller->OnNetworkRouteChange( + CreateRouteChange(current_time, new_bitrate)); + EXPECT_EQ(update.target_rate->target_rate, new_bitrate); + EXPECT_EQ(update.pacer_config->data_rate(), new_bitrate * kDefaultPacingRate); + EXPECT_EQ(update.probe_cluster_configs.size(), 2u); + + // If the bitrate is reset to -1, the new starting bitrate will be + // the minimum default bitrate. + const DataRate kDefaultMinBitrate = DataRate::KilobitsPerSec(5); + update = controller->OnNetworkRouteChange(CreateRouteChange(current_time)); + EXPECT_EQ(update.target_rate->target_rate, kDefaultMinBitrate); + EXPECT_NEAR(update.pacer_config->data_rate().bps(), + kDefaultMinBitrate.bps() * kDefaultPacingRate, 10); + EXPECT_EQ(update.probe_cluster_configs.size(), 2u); +} + +TEST(GoogCcNetworkControllerTest, ProbeOnRouteChange) { + NetworkControllerTestFixture fixture; + std::unique_ptr controller = + fixture.CreateController(); + Timestamp current_time = Timestamp::Millis(123); + NetworkControlUpdate update = controller->OnNetworkRouteChange( + CreateRouteChange(current_time, 2 * kInitialBitrate, DataRate::Zero(), + 20 * kInitialBitrate)); + + EXPECT_TRUE(update.pacer_config.has_value()); + EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate * 2); + EXPECT_EQ(update.probe_cluster_configs.size(), 2u); + EXPECT_EQ(update.probe_cluster_configs[0].target_data_rate, + kInitialBitrate * 6); + EXPECT_EQ(update.probe_cluster_configs[1].target_data_rate, + kInitialBitrate * 12); + + update = controller->OnProcessInterval({.at_time = current_time}); +} + +// Bandwidth estimation is updated when feedbacks are received. +// Feedbacks which show an increasing delay cause the estimation to be reduced. +TEST(GoogCcNetworkControllerTest, UpdatesDelayBasedEstimate) { + NetworkControllerTestFixture fixture; + std::unique_ptr controller = + fixture.CreateController(); + const int64_t kRunTimeMs = 6000; + Timestamp current_time = Timestamp::Millis(123); + + // The test must run and insert packets/feedback long enough that the + // BWE computes a valid estimate. This is first done in an environment which + // simulates no bandwidth limitation, and therefore not built-up delay. + absl::optional target_bitrate_before_delay = + PacketTransmissionAndFeedbackBlock(controller.get(), kRunTimeMs, 0, + current_time); + ASSERT_TRUE(target_bitrate_before_delay.has_value()); + + // Repeat, but this time with a building delay, and make sure that the + // estimation is adjusted downwards. + absl::optional target_bitrate_after_delay = + PacketTransmissionAndFeedbackBlock(controller.get(), kRunTimeMs, 50, + current_time); + EXPECT_LT(*target_bitrate_after_delay, *target_bitrate_before_delay); +} + // Test congestion window pushback on network delay happens. -TEST_F(GoogCcNetworkControllerTest, CongestionWindowPushbackOnNetworkDelay) { +TEST(GoogCcScenario, CongestionWindowPushbackOnNetworkDelay) { auto factory = CreateFeedbackOnlyFactory(); ScopedFieldTrials trial( "WebRTC-CongestionWindow/QueueSize:800,MinBitrate:30000/"); @@ -325,8 +394,7 @@ TEST_F(GoogCcNetworkControllerTest, CongestionWindowPushbackOnNetworkDelay) { } // Test congestion window pushback on network delay happens. -TEST_F(GoogCcNetworkControllerTest, - CongestionWindowPushbackDropFrameOnNetworkDelay) { +TEST(GoogCcScenario, CongestionWindowPushbackDropFrameOnNetworkDelay) { auto factory = CreateFeedbackOnlyFactory(); ScopedFieldTrials trial( "WebRTC-CongestionWindow/QueueSize:800,MinBitrate:30000,DropFrame:true/"); @@ -358,61 +426,7 @@ TEST_F(GoogCcNetworkControllerTest, EXPECT_GT(client->target_rate().kbps(), 300); } -TEST_F(GoogCcNetworkControllerTest, OnNetworkRouteChanged) { - NetworkControlUpdate update; - DataRate new_bitrate = DataRate::BitsPerSec(200000); - update = controller_->OnNetworkRouteChange(CreateRouteChange(new_bitrate)); - EXPECT_EQ(update.target_rate->target_rate, new_bitrate); - EXPECT_EQ(update.pacer_config->data_rate(), new_bitrate * kDefaultPacingRate); - EXPECT_EQ(update.probe_cluster_configs.size(), 2u); - - // If the bitrate is reset to -1, the new starting bitrate will be - // the minimum default bitrate. - const DataRate kDefaultMinBitrate = DataRate::KilobitsPerSec(5); - update = controller_->OnNetworkRouteChange(CreateRouteChange()); - EXPECT_EQ(update.target_rate->target_rate, kDefaultMinBitrate); - EXPECT_NEAR(update.pacer_config->data_rate().bps(), - kDefaultMinBitrate.bps() * kDefaultPacingRate, 10); - EXPECT_EQ(update.probe_cluster_configs.size(), 2u); -} - -TEST_F(GoogCcNetworkControllerTest, ProbeOnRouteChange) { - NetworkControlUpdate update; - update = controller_->OnNetworkRouteChange(CreateRouteChange( - 2 * kInitialBitrate, DataRate::Zero(), 20 * kInitialBitrate)); - - EXPECT_TRUE(update.pacer_config.has_value()); - EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate * 2); - EXPECT_EQ(update.probe_cluster_configs.size(), 2u); - EXPECT_EQ(update.probe_cluster_configs[0].target_data_rate, - kInitialBitrate * 6); - EXPECT_EQ(update.probe_cluster_configs[1].target_data_rate, - kInitialBitrate * 12); - - update = controller_->OnProcessInterval(DefaultInterval()); -} - -// Bandwidth estimation is updated when feedbacks are received. -// Feedbacks which show an increasing delay cause the estimation to be reduced. -TEST_F(GoogCcNetworkControllerTest, UpdatesDelayBasedEstimate) { - TargetBitrateTrackingSetup(); - const int64_t kRunTimeMs = 6000; - - // The test must run and insert packets/feedback long enough that the - // BWE computes a valid estimate. This is first done in an environment which - // simulates no bandwidth limitation, and therefore not built-up delay. - PacketTransmissionAndFeedbackBlock(kRunTimeMs, 0); - ASSERT_TRUE(target_bitrate_.has_value()); - - // Repeat, but this time with a building delay, and make sure that the - // estimation is adjusted downwards. - DataRate bitrate_before_delay = *target_bitrate_; - PacketTransmissionAndFeedbackBlock(kRunTimeMs, 50); - EXPECT_LT(*target_bitrate_, bitrate_before_delay); -} - -TEST_F(GoogCcNetworkControllerTest, - PaddingRateLimitedByCongestionWindowInTrial) { +TEST(GoogCcScenario, PaddingRateLimitedByCongestionWindowInTrial) { ScopedFieldTrials trial( "WebRTC-CongestionWindow/QueueSize:200,MinBitrate:30000/"); @@ -447,7 +461,7 @@ TEST_F(GoogCcNetworkControllerTest, EXPECT_NEAR(client->padding_rate().kbps(), client->target_rate().kbps(), 1); } -TEST_F(GoogCcNetworkControllerTest, LimitsToFloorIfRttIsHighInTrial) { +TEST(GoogCcScenario, LimitsToFloorIfRttIsHighInTrial) { // The field trial limits maximum RTT to 2 seconds, higher RTT means that the // controller backs off until it reaches the minimum configured bitrate. This // allows the RTT to recover faster than the regular control mechanism would @@ -484,11 +498,11 @@ TEST_F(GoogCcNetworkControllerTest, LimitsToFloorIfRttIsHighInTrial) { EXPECT_NEAR(client->target_rate().kbps(), kBandwidthFloor.kbps(), 5); } -TEST_F(GoogCcNetworkControllerTest, UpdatesTargetRateBasedOnLinkCapacity) { +TEST(GoogCcScenario, UpdatesTargetRateBasedOnLinkCapacity) { UpdatesTargetRateBasedOnLinkCapacity(); } -TEST_F(GoogCcNetworkControllerTest, StableEstimateDoesNotVaryInSteadyState) { +TEST(GoogCcScenario, StableEstimateDoesNotVaryInSteadyState) { auto factory = CreateFeedbackOnlyFactory(); Scenario s("googcc_unit/stable_target", false); CallClientConfig config; @@ -525,15 +539,13 @@ TEST_F(GoogCcNetworkControllerTest, StableEstimateDoesNotVaryInSteadyState) { EXPECT_GE(min_stable_target / max_stable_target, min_target / max_target); } -TEST_F(GoogCcNetworkControllerTest, - LossBasedControlUpdatesTargetRateBasedOnLinkCapacity) { +TEST(GoogCcScenario, LossBasedControlUpdatesTargetRateBasedOnLinkCapacity) { ScopedFieldTrials trial("WebRTC-Bwe-LossBasedControl/Enabled/"); // TODO(srte): Should the behavior be unaffected at low loss rates? UpdatesTargetRateBasedOnLinkCapacity("_loss_based"); } -TEST_F(GoogCcNetworkControllerTest, - LossBasedControlDoesModestBackoffToHighLoss) { +TEST(GoogCcScenario, LossBasedControlDoesModestBackoffToHighLoss) { ScopedFieldTrials trial("WebRTC-Bwe-LossBasedControl/Enabled/"); Scenario s("googcc_unit/high_loss_channel", false); CallClientConfig config; @@ -600,8 +612,7 @@ DataRate AverageBitrateAfterCrossInducedLoss(std::string name) { s.TimeSinceStart(); } -TEST_F(GoogCcNetworkControllerTest, - LossBasedRecoversFasterAfterCrossInducedLoss) { +TEST(GoogCcScenario, LossBasedRecoversFasterAfterCrossInducedLoss) { // This test acts as a reference for the test below, showing that without the // trial, we have worse behavior. DataRate average_bitrate_without_loss_based = @@ -610,7 +621,6 @@ TEST_F(GoogCcNetworkControllerTest, // We recover bitrate better when subject to loss spikes from cross traffic // when loss based controller is used. ScopedFieldTrials trial("WebRTC-Bwe-LossBasedControl/Enabled/"); - SetUp(); DataRate average_bitrate_with_loss_based = AverageBitrateAfterCrossInducedLoss("googcc_unit/cross_loss_based"); @@ -618,7 +628,7 @@ TEST_F(GoogCcNetworkControllerTest, average_bitrate_without_loss_based * 1.1); } -TEST_F(GoogCcNetworkControllerTest, LossBasedEstimatorCapsRateAtModerateLoss) { +TEST(GoogCcScenario, LossBasedEstimatorCapsRateAtModerateLoss) { ScopedFieldTrials trial("WebRTC-Bwe-LossBasedControl/Enabled/"); Scenario s("googcc_unit/moderate_loss_channel", false); CallClientConfig config; @@ -651,7 +661,7 @@ TEST_F(GoogCcNetworkControllerTest, LossBasedEstimatorCapsRateAtModerateLoss) { EXPECT_LT(client->target_rate().kbps(), 2500); } -TEST_F(GoogCcNetworkControllerTest, MaintainsLowRateInSafeResetTrial) { +TEST(GoogCcScenario, MaintainsLowRateInSafeResetTrial) { const DataRate kLinkCapacity = DataRate::KilobitsPerSec(200); const DataRate kStartRate = DataRate::KilobitsPerSec(300); @@ -678,7 +688,7 @@ TEST_F(GoogCcNetworkControllerTest, MaintainsLowRateInSafeResetTrial) { EXPECT_NEAR(client->send_bandwidth().kbps(), kLinkCapacity.kbps(), 50); } -TEST_F(GoogCcNetworkControllerTest, CutsHighRateInSafeResetTrial) { +TEST(GoogCcScenario, CutsHighRateInSafeResetTrial) { const DataRate kLinkCapacity = DataRate::KilobitsPerSec(1000); const DataRate kStartRate = DataRate::KilobitsPerSec(300); @@ -705,7 +715,7 @@ TEST_F(GoogCcNetworkControllerTest, CutsHighRateInSafeResetTrial) { EXPECT_NEAR(client->send_bandwidth().kbps(), kStartRate.kbps(), 30); } -TEST_F(GoogCcNetworkControllerTest, DetectsHighRateInSafeResetTrial) { +TEST(GoogCcScenario, DetectsHighRateInSafeResetTrial) { ScopedFieldTrials trial( "WebRTC-Bwe-SafeResetOnRouteChange/Enabled,ack/" "WebRTC-SendSideBwe-WithOverhead/Enabled/"); @@ -745,8 +755,7 @@ TEST_F(GoogCcNetworkControllerTest, DetectsHighRateInSafeResetTrial) { EXPECT_GT(client->send_bandwidth().kbps(), kNewLinkCapacity.kbps() - 300); } -TEST_F(GoogCcNetworkControllerTest, - TargetRateReducedOnPacingBufferBuildupInTrial) { +TEST(GoogCcScenario, TargetRateReducedOnPacingBufferBuildupInTrial) { // Configure strict pacing to ensure build-up. ScopedFieldTrials trial( "WebRTC-CongestionWindow/QueueSize:100,MinBitrate:30000/" @@ -775,7 +784,7 @@ TEST_F(GoogCcNetworkControllerTest, EXPECT_LT(client->GetStats().pacer_delay_ms, 150); } -TEST_F(GoogCcNetworkControllerTest, NoBandwidthTogglingInLossControlTrial) { +TEST(GoogCcScenario, NoBandwidthTogglingInLossControlTrial) { ScopedFieldTrials trial("WebRTC-Bwe-LossBasedControl/Enabled/"); Scenario s("googcc_unit/no_toggling"); auto* send_net = s.CreateSimulationNode([&](NetworkSimulationConfig* c) { @@ -809,7 +818,7 @@ TEST_F(GoogCcNetworkControllerTest, NoBandwidthTogglingInLossControlTrial) { } } -TEST_F(GoogCcNetworkControllerTest, NoRttBackoffCollapseWhenVideoStops) { +TEST(GoogCcScenario, NoRttBackoffCollapseWhenVideoStops) { ScopedFieldTrials trial("WebRTC-Bwe-MaxRttLimit/limit:2s/"); Scenario s("googcc_unit/rttbackoff_video_stop"); auto* send_net = s.CreateSimulationNode([&](NetworkSimulationConfig* c) { @@ -831,7 +840,7 @@ TEST_F(GoogCcNetworkControllerTest, NoRttBackoffCollapseWhenVideoStops) { EXPECT_GT(client->send_bandwidth().kbps(), 1000); } -TEST_F(GoogCcNetworkControllerTest, NoCrashOnVeryLateFeedback) { +TEST(GoogCcScenario, NoCrashOnVeryLateFeedback) { Scenario s; auto ret_net = s.CreateMutableSimulationNode(NetworkSimulationConfig()); auto* route = s.CreateRoutes( @@ -855,7 +864,7 @@ TEST_F(GoogCcNetworkControllerTest, NoCrashOnVeryLateFeedback) { s.RunFor(TimeDelta::Seconds(2)); } -TEST_F(GoogCcNetworkControllerTest, IsFairToTCP) { +TEST(GoogCcScenario, IsFairToTCP) { Scenario s("googcc_unit/tcp_fairness"); NetworkSimulationConfig net_conf; net_conf.bandwidth = DataRate::KilobitsPerSec(1000);