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

Side by Side Diff: webrtc/modules/congestion_controller/probe_controller_unittest.cc

Issue 2269873002: Avoid cluster set up at max bitrate at start (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup
Patch Set: Fix nit Created 4 years, 3 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 | « webrtc/modules/congestion_controller/probe_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 22
23 namespace webrtc { 23 namespace webrtc {
24 namespace test { 24 namespace test {
25 25
26 namespace { 26 namespace {
27 27
28 constexpr int kMinBitrateBps = 100; 28 constexpr int kMinBitrateBps = 100;
29 constexpr int kStartBitrateBps = 300; 29 constexpr int kStartBitrateBps = 300;
30 constexpr int kMaxBitrateBps = 1000; 30 constexpr int kMaxBitrateBps = 1000;
31 31
32 constexpr int kExponentialProbingTimeoutMs = 5000;
33
32 } // namespace 34 } // namespace
33 35
34 class ProbeControllerTest : public ::testing::Test { 36 class ProbeControllerTest : public ::testing::Test {
35 protected: 37 protected:
36 ProbeControllerTest() : clock_(0) { 38 ProbeControllerTest() : clock_(0) {
37 probe_controller_.reset(new ProbeController(&pacer_, &clock_)); 39 probe_controller_.reset(new ProbeController(&pacer_, &clock_));
38 } 40 }
39 ~ProbeControllerTest() override {} 41 ~ProbeControllerTest() override {}
40 42
41 SimulatedClock clock_; 43 SimulatedClock clock_;
42 NiceMock<MockPacedSender> pacer_; 44 NiceMock<MockPacedSender> pacer_;
43 std::unique_ptr<ProbeController> probe_controller_; 45 std::unique_ptr<ProbeController> probe_controller_;
44 }; 46 };
45 47
46 TEST_F(ProbeControllerTest, InitiatesProbingAtStart) { 48 TEST_F(ProbeControllerTest, InitiatesProbingAtStart) {
47 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2)); 49 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2));
48 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, 50 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
49 kMaxBitrateBps); 51 kMaxBitrateBps);
50 } 52 }
51 53
52 TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) { 54 TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
53 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2)); 55 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2));
54 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, 56 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
55 kMaxBitrateBps); 57 kMaxBitrateBps);
56 clock_.AdvanceTimeMilliseconds(25); 58 // Long enough to time out exponential probing.
59 clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
60 probe_controller_->SetEstimatedBitrate(kStartBitrateBps);
57 61
58 probe_controller_->SetEstimatedBitrate(kStartBitrateBps);
59 EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _)); 62 EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _));
60 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, 63 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
61 kMaxBitrateBps + 100); 64 kMaxBitrateBps + 100);
62 } 65 }
63 66
64 TEST_F(ProbeControllerTest, TestExponentialProbing) { 67 TEST_F(ProbeControllerTest, TestExponentialProbing) {
65 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, 68 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
66 kMaxBitrateBps); 69 kMaxBitrateBps);
67 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)); 70 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _));
68 probe_controller_->SetEstimatedBitrate(1800); 71 probe_controller_->SetEstimatedBitrate(1800);
69 } 72 }
70 73
71 TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) { 74 TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) {
72 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, 75 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
73 kMaxBitrateBps); 76 kMaxBitrateBps);
74 77
75 // Advance far enough to cause a time out in waiting for probing result. 78 // Advance far enough to cause a time out in waiting for probing result.
76 clock_.AdvanceTimeMilliseconds(5000); 79 clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
77 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)).Times(0); 80 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)).Times(0);
78 probe_controller_->SetEstimatedBitrate(1800); 81 probe_controller_->SetEstimatedBitrate(1800);
79 } 82 }
80 83
81 } // namespace test 84 } // namespace test
82 } // namespace webrtc 85 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/probe_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698