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/max_bandwidth_
filter.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_
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(MaxBandwidthFilterTest, InitializationCheck) { | 18 TEST(MaxBandwidthFilterTest, InitializationCheck) { |
19 MaxBandwidthFilter max_bandwidth_filter; | 19 MaxBandwidthFilter max_bandwidth_filter; |
20 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bytes_per_ms(), 0); | 20 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bps(), 0); |
21 } | 21 } |
22 | 22 |
23 TEST(MaxBandwidthFilterTest, AddOneBandwidthSample) { | 23 TEST(MaxBandwidthFilterTest, AddOneBandwidthSample) { |
24 MaxBandwidthFilter max_bandwidth_filter; | 24 MaxBandwidthFilter max_bandwidth_filter; |
25 max_bandwidth_filter.AddBandwidthSample(13, 4, 10); | 25 max_bandwidth_filter.AddBandwidthSample(13, 4, 10); |
26 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bytes_per_ms(), 13); | 26 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bps(), 13); |
27 } | 27 } |
28 | 28 |
29 TEST(MaxBandwidthFilterTest, AddSeveralBandwidthSamples) { | 29 TEST(MaxBandwidthFilterTest, AddSeveralBandwidthSamples) { |
30 MaxBandwidthFilter max_bandwidth_filter; | 30 MaxBandwidthFilter max_bandwidth_filter; |
31 max_bandwidth_filter.AddBandwidthSample(10, 5, 10); | 31 max_bandwidth_filter.AddBandwidthSample(10, 5, 10); |
32 max_bandwidth_filter.AddBandwidthSample(13, 6, 10); | 32 max_bandwidth_filter.AddBandwidthSample(13, 6, 10); |
33 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bytes_per_ms(), 13); | 33 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bps(), 13); |
34 } | 34 } |
35 | 35 |
36 TEST(MaxBandwidthFilterTest, SampleTimeOut) { | 36 TEST(MaxBandwidthFilterTest, SampleTimeOut) { |
37 MaxBandwidthFilter max_bandwidth_filter; | 37 MaxBandwidthFilter max_bandwidth_filter; |
38 max_bandwidth_filter.AddBandwidthSample(13, 5, 10); | 38 max_bandwidth_filter.AddBandwidthSample(13, 5, 10); |
39 max_bandwidth_filter.AddBandwidthSample(10, 15, 10); | 39 max_bandwidth_filter.AddBandwidthSample(10, 15, 10); |
40 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bytes_per_ms(), 10); | 40 EXPECT_EQ(max_bandwidth_filter.max_bandwidth_estimate_bps(), 10); |
41 } | 41 } |
42 | 42 |
43 TEST(MaxBandwidthFilterTest, FullBandwidthReached) { | 43 TEST(MaxBandwidthFilterTest, FullBandwidthReached) { |
44 MaxBandwidthFilter max_bandwidth_filter; | 44 MaxBandwidthFilter max_bandwidth_filter; |
45 max_bandwidth_filter.AddBandwidthSample(100, 1, 10); | 45 max_bandwidth_filter.AddBandwidthSample(100, 1, 10); |
46 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 46 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
47 max_bandwidth_filter.AddBandwidthSample(110, 2, 10); | 47 max_bandwidth_filter.AddBandwidthSample(110, 2, 10); |
48 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 48 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
49 max_bandwidth_filter.AddBandwidthSample(120, 3, 10); | 49 max_bandwidth_filter.AddBandwidthSample(120, 3, 10); |
50 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 50 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
51 max_bandwidth_filter.AddBandwidthSample(124, 4, 10); | 51 max_bandwidth_filter.AddBandwidthSample(124, 4, 10); |
52 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), true); | 52 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), true); |
53 } | 53 } |
54 | 54 |
55 TEST(MaxBandwidthFilterTest, FullBandwidthNotReached) { | 55 TEST(MaxBandwidthFilterTest, FullBandwidthNotReached) { |
56 MaxBandwidthFilter max_bandwidth_filter; | 56 MaxBandwidthFilter max_bandwidth_filter; |
57 max_bandwidth_filter.AddBandwidthSample(100, 1, 10); | 57 max_bandwidth_filter.AddBandwidthSample(100, 1, 10); |
58 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 58 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
59 max_bandwidth_filter.AddBandwidthSample(110, 2, 10); | 59 max_bandwidth_filter.AddBandwidthSample(110, 2, 10); |
60 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 60 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
61 max_bandwidth_filter.AddBandwidthSample(120, 3, 10); | 61 max_bandwidth_filter.AddBandwidthSample(120, 3, 10); |
62 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 62 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
63 max_bandwidth_filter.AddBandwidthSample(125, 4, 10); | 63 max_bandwidth_filter.AddBandwidthSample(125, 4, 10); |
64 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); | 64 EXPECT_EQ(max_bandwidth_filter.FullBandwidthReached(1.25f, 3), false); |
65 } | 65 } |
66 } // namespace bwe | 66 } // namespace bwe |
67 } // namespace testing | 67 } // namespace testing |
68 } // namespace webrtc | 68 } // namespace webrtc |
OLD | NEW |