OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 |
11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter
.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter
.h" |
12 | 12 |
13 #include "webrtc/test/gtest.h" | 13 #include "webrtc/test/gtest.h" |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 namespace testing { | 16 namespace testing { |
17 namespace bwe { | 17 namespace bwe { |
18 TEST(MinRttFilterTest, InitializationCheck) { | 18 TEST(MinRttFilterTest, InitializationCheck) { |
19 MinRttFilter min_rtt_filter; | 19 MinRttFilter min_rtt_filter; |
20 EXPECT_FALSE(min_rtt_filter.min_rtt_ms()); | 20 EXPECT_FALSE(min_rtt_filter.min_rtt_ms()); |
21 EXPECT_EQ(min_rtt_filter.discovery_time(), 0); | 21 EXPECT_EQ(min_rtt_filter.discovery_time(), 0); |
22 } | 22 } |
23 | 23 |
24 TEST(MinRttFilterTest, AddRttSample) { | 24 TEST(MinRttFilterTest, AddRttSample) { |
25 MinRttFilter min_rtt_filter; | 25 MinRttFilter min_rtt_filter; |
26 min_rtt_filter.add_rtt_sample(120, 5); | 26 min_rtt_filter.AddRttSample(120, 5); |
27 EXPECT_EQ(min_rtt_filter.min_rtt_ms(), 120); | 27 EXPECT_EQ(min_rtt_filter.min_rtt_ms(), 120); |
28 EXPECT_EQ(min_rtt_filter.discovery_time(), 5); | 28 EXPECT_EQ(min_rtt_filter.discovery_time(), 5); |
29 min_rtt_filter.add_rtt_sample(121, 6); | 29 min_rtt_filter.AddRttSample(121, 6); |
30 EXPECT_EQ(min_rtt_filter.discovery_time(), 5); | 30 EXPECT_EQ(min_rtt_filter.discovery_time(), 5); |
31 min_rtt_filter.add_rtt_sample(119, 7); | 31 min_rtt_filter.AddRttSample(119, 7); |
32 EXPECT_EQ(min_rtt_filter.discovery_time(), 7); | 32 EXPECT_EQ(min_rtt_filter.discovery_time(), 7); |
| 33 min_rtt_filter.AddRttSample(140, 10007); |
| 34 EXPECT_EQ(min_rtt_filter.discovery_time(), 10007); |
| 35 EXPECT_EQ(min_rtt_filter.min_rtt_ms(), 140); |
33 } | 36 } |
34 | 37 |
35 TEST(MinRttFilterTest, MinRttExpired) { | 38 TEST(MinRttFilterTest, MinRttExpired) { |
36 MinRttFilter min_rtt_filter; | 39 MinRttFilter min_rtt_filter; |
37 min_rtt_filter.add_rtt_sample(120, 5); | 40 min_rtt_filter.AddRttSample(120, 5); |
38 EXPECT_EQ(min_rtt_filter.min_rtt_expired(10, 5), true); | 41 EXPECT_EQ(min_rtt_filter.MinRttExpired(10006), true); |
39 EXPECT_EQ(min_rtt_filter.min_rtt_expired(9, 5), false); | 42 EXPECT_EQ(min_rtt_filter.MinRttExpired(10), false); |
40 } | 43 } |
41 } // namespace bwe | 44 } // namespace bwe |
42 } // namespace testing | 45 } // namespace testing |
43 } // namespace webrtc | 46 } // namespace webrtc |
OLD | NEW |