• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "rtc_base/experiments/rtt_mult_experiment.h"
12 
13 #include "test/field_trial.h"
14 #include "test/gtest.h"
15 
16 namespace webrtc {
17 
TEST(RttMultExperimentTest,RttMultDisabledByDefault)18 TEST(RttMultExperimentTest, RttMultDisabledByDefault) {
19   EXPECT_FALSE(RttMultExperiment::RttMultEnabled());
20 }
21 
TEST(RttMultExperimentTest,RttMultEnabledByFieldTrial)22 TEST(RttMultExperimentTest, RttMultEnabledByFieldTrial) {
23   webrtc::test::ScopedFieldTrials field_trials(
24       "WebRTC-RttMult/Enabled-0.60,100.0/");
25   EXPECT_TRUE(RttMultExperiment::RttMultEnabled());
26 }
27 
TEST(RttMultExperimentTest,RttMultTestValue)28 TEST(RttMultExperimentTest, RttMultTestValue) {
29   webrtc::test::ScopedFieldTrials field_trials(
30       "WebRTC-RttMult/Enabled-0.60,100.0/");
31   EXPECT_EQ(0.6f, RttMultExperiment::GetRttMultValue()->rtt_mult_setting);
32   EXPECT_EQ(100.0f, RttMultExperiment::GetRttMultValue()->rtt_mult_add_cap_ms);
33 }
34 
TEST(RttMultExperimentTest,RttMultTestMalformedEnabled)35 TEST(RttMultExperimentTest, RttMultTestMalformedEnabled) {
36   webrtc::test::ScopedFieldTrials field_trials(
37       "WebRTC-RttMult/Enable-0.60,100.0/");
38   EXPECT_FALSE(RttMultExperiment::RttMultEnabled());
39   EXPECT_FALSE(RttMultExperiment::GetRttMultValue());
40 }
41 
TEST(RttMultExperimentTest,RttMultTestValueOutOfBoundsPositive)42 TEST(RttMultExperimentTest, RttMultTestValueOutOfBoundsPositive) {
43   webrtc::test::ScopedFieldTrials field_trials(
44       "WebRTC-RttMult/Enabled-1.5,2100.0/");
45   EXPECT_EQ(1.0f, RttMultExperiment::GetRttMultValue()->rtt_mult_setting);
46   EXPECT_EQ(2000.0f, RttMultExperiment::GetRttMultValue()->rtt_mult_add_cap_ms);
47 }
48 
TEST(RttMultExperimentTest,RttMultTestValueOutOfBoundsNegative)49 TEST(RttMultExperimentTest, RttMultTestValueOutOfBoundsNegative) {
50   webrtc::test::ScopedFieldTrials field_trials(
51       "WebRTC-RttMult/Enabled--0.5,-100.0/");
52   EXPECT_EQ(0.0f, RttMultExperiment::GetRttMultValue()->rtt_mult_setting);
53   EXPECT_EQ(0.0f, RttMultExperiment::GetRttMultValue()->rtt_mult_add_cap_ms);
54 }
55 
TEST(RttMultExperimentTest,RttMultTestMalformedValue)56 TEST(RttMultExperimentTest, RttMultTestMalformedValue) {
57   webrtc::test::ScopedFieldTrials field_trials(
58       "WebRTC-RttMult/Enabled-0.25,10a0.0/");
59   EXPECT_NE(100.0f, RttMultExperiment::GetRttMultValue()->rtt_mult_add_cap_ms);
60 }
61 
62 }  // namespace webrtc
63