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

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

Issue 2235373004: Probing: Add support for exponential startup probing (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@fix_probing2
Patch Set: lint fix 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') | webrtc/modules/modules.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 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 #include <memory>
11
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webrtc/base/logging.h"
15 #include "webrtc/modules/congestion_controller/probe_controller.h"
16 #include "webrtc/modules/pacing/mock/mock_paced_sender.h"
17 #include "webrtc/system_wrappers/include/clock.h"
18
19 using testing::_;
20 using testing::AtLeast;
21 using testing::NiceMock;
22
23 namespace webrtc {
24 namespace test {
25
26 namespace {
27
28 constexpr int kMinBitrateBps = 100;
29 constexpr int kStartBitrateBps = 300;
30 constexpr int kMaxBitrateBps = 1000;
31
32 } // namespace
33
34 class ProbeControllerTest : public ::testing::Test {
35 protected:
36 ProbeControllerTest() : clock_(0) {
37 probe_controller_.reset(new ProbeController(&pacer_, &clock_));
38 }
39 ~ProbeControllerTest() override {}
40
41 SimulatedClock clock_;
42 NiceMock<MockPacedSender> pacer_;
43 std::unique_ptr<ProbeController> probe_controller_;
44 };
45
46 TEST_F(ProbeControllerTest, InitiatesProbingAtStart) {
47 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2));
48 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
49 kMaxBitrateBps);
50 }
51
52 TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
53 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2));
54 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
55 kMaxBitrateBps);
56 clock_.AdvanceTimeMilliseconds(25);
57
58 probe_controller_->SetEstimatedBitrate(kStartBitrateBps);
59 EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _));
60 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
61 kMaxBitrateBps + 100);
62 }
63
64 TEST_F(ProbeControllerTest, TestExponentialProbing) {
65 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
66 kMaxBitrateBps);
67 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _));
68 probe_controller_->SetEstimatedBitrate(1800);
69 }
70
71 TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) {
72 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
73 kMaxBitrateBps);
74
75 // Advance far enough to cause a time out in waiting for probing result.
76 clock_.AdvanceTimeMilliseconds(5000);
77 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)).Times(0);
78 probe_controller_->SetEstimatedBitrate(1800);
79 }
80
81 } // namespace test
82 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/probe_controller.cc ('k') | webrtc/modules/modules.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698