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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter_unittest.cc

Issue 2999073002: Tweaked version of BBR for WebRTC. (Closed)
Patch Set: Updated according to comments. Created 3 years, 4 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
OLDNEW
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);
22 } 21 }
23 22
24 TEST(MinRttFilterTest, AddRttSample) { 23 TEST(MinRttFilterTest, AddRttSample) {
25 MinRttFilter min_rtt_filter; 24 MinRttFilter min_rtt_filter;
26 min_rtt_filter.AddRttSample(120, 5); 25 min_rtt_filter.AddRttSample(120, 5);
27 EXPECT_EQ(min_rtt_filter.min_rtt_ms(), 120); 26 EXPECT_EQ(*min_rtt_filter.min_rtt_ms(), 120);
28 EXPECT_EQ(min_rtt_filter.discovery_time(), 5);
29 min_rtt_filter.AddRttSample(121, 6); 27 min_rtt_filter.AddRttSample(121, 6);
30 EXPECT_EQ(min_rtt_filter.discovery_time(), 5);
31 min_rtt_filter.AddRttSample(119, 7); 28 min_rtt_filter.AddRttSample(119, 7);
32 EXPECT_EQ(min_rtt_filter.discovery_time(), 7);
33 min_rtt_filter.AddRttSample(140, 10007); 29 min_rtt_filter.AddRttSample(140, 10007);
34 EXPECT_EQ(min_rtt_filter.discovery_time(), 10007); 30 EXPECT_EQ(*min_rtt_filter.min_rtt_ms(), 119);
35 EXPECT_EQ(min_rtt_filter.min_rtt_ms(), 140);
36 } 31 }
37 32
38 TEST(MinRttFilterTest, MinRttExpired) { 33 TEST(MinRttFilterTest, MinRttExpired) {
39 MinRttFilter min_rtt_filter; 34 MinRttFilter min_rtt_filter;
40 min_rtt_filter.AddRttSample(120, 5); 35 for (int i = 1; i <= 25; i++)
41 EXPECT_EQ(min_rtt_filter.MinRttExpired(10006), true); 36 min_rtt_filter.AddRttSample(i, i);
42 EXPECT_EQ(min_rtt_filter.MinRttExpired(10), false); 37 EXPECT_EQ(min_rtt_filter.MinRttExpired(25), true);
38 EXPECT_EQ(min_rtt_filter.MinRttExpired(24), false);
43 } 39 }
44 } // namespace bwe 40 } // namespace bwe
45 } // namespace testing 41 } // namespace testing
46 } // namespace webrtc 42 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698