Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/overuse_detector_unittest.cc

Issue 1227653002: Add scoped class for overriding field trials. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/test/field_trial.h » ('j') | webrtc/test/field_trial.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 int sigma_ms = 10; 596 int sigma_ms = 10;
597 int unique_overuse = Run100000Samples(packets_per_frame, packet_size, 597 int unique_overuse = Run100000Samples(packets_per_frame, packet_size,
598 frame_duration_ms, sigma_ms); 598 frame_duration_ms, sigma_ms);
599 EXPECT_EQ(0, unique_overuse); 599 EXPECT_EQ(0, unique_overuse);
600 int frames_until_overuse = RunUntilOveruse(packets_per_frame, packet_size, 600 int frames_until_overuse = RunUntilOveruse(packets_per_frame, packet_size,
601 frame_duration_ms, sigma_ms, drift_per_frame_ms); 601 frame_duration_ms, sigma_ms, drift_per_frame_ms);
602 EXPECT_EQ(14, frames_until_overuse); 602 EXPECT_EQ(14, frames_until_overuse);
603 } 603 }
604 604
605 class OveruseDetectorExperimentTest : public OveruseDetectorTest { 605 class OveruseDetectorExperimentTest : public OveruseDetectorTest {
606 public:
607 OveruseDetectorExperimentTest()
608 : override_field_trials_(
609 "WebRTC-AdaptiveBweThreshold/Enabled-0.01,0.00018/") {}
610
606 protected: 611 protected:
607 void SetUp() override { 612 void SetUp() override {
608 test::InitFieldTrialsFromString(
609 "WebRTC-AdaptiveBweThreshold/Enabled-0.01,0.00018/");
610 overuse_detector_.reset(new OveruseDetector(options_)); 613 overuse_detector_.reset(new OveruseDetector(options_));
611 } 614 }
612 615
613 void TearDown() override { test::InitFieldTrialsFromString(""); } 616 test::ScopedFieldTrials override_field_trials_;
614 }; 617 };
615 618
616 TEST_F(OveruseDetectorExperimentTest, ThresholdAdapts) { 619 TEST_F(OveruseDetectorExperimentTest, ThresholdAdapts) {
617 const double kOffset = 0.21; 620 const double kOffset = 0.21;
618 double kTsDelta = 3000.0; 621 double kTsDelta = 3000.0;
619 int64_t now_ms = 0; 622 int64_t now_ms = 0;
620 int num_deltas = 60; 623 int num_deltas = 60;
621 const int kBatchLength = 10; 624 const int kBatchLength = 10;
622 625
623 // Pass in a positive offset and verify it triggers overuse. 626 // Pass in a positive offset and verify it triggers overuse.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 if (overuse_state == kBwOverusing) { 731 if (overuse_state == kBwOverusing) {
729 overuse_detected = true; 732 overuse_detected = true;
730 } 733 }
731 ++num_deltas; 734 ++num_deltas;
732 now_ms += 5; 735 now_ms += 5;
733 } 736 }
734 EXPECT_TRUE(overuse_detected); 737 EXPECT_TRUE(overuse_detected);
735 } 738 }
736 } // namespace testing 739 } // namespace testing
737 } // namespace webrtc 740 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/test/field_trial.h » ('j') | webrtc/test/field_trial.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698