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

Side by Side Diff: webrtc/modules/pacing/alr_detector_unittest.cc

Issue 2340763004: Add AlrDetector (Closed)
Patch Set: Rebased Created 4 years, 2 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/pacing/alr_detector.cc ('k') | webrtc/modules/pacing/paced_sender.h » ('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
11 #include "webrtc/test/gtest.h"
12 #include "webrtc/modules/pacing/alr_detector.h"
13
14 namespace {
15
16 constexpr int kMeasuredIntervalMs = 110;
17 constexpr int kEstimatedBitrateBps = 300000;
18 constexpr int kBytesInIntervalAtEstimatedBitrate =
19 (kEstimatedBitrateBps / 8) * kMeasuredIntervalMs / 1000;
20
21 } // namespace
22
23 namespace webrtc {
24
25 TEST(AlrDetectorTest, ApplicationLimitedWhenLittleDataSent) {
26 AlrDetector alr_detector;
27
28 alr_detector.SetEstimatedBitrate(kEstimatedBitrateBps);
29 for (int i = 0; i < 6; i++)
30 alr_detector.OnBytesSent(0, kMeasuredIntervalMs);
31 EXPECT_EQ(alr_detector.InApplicationLimitedRegion(), true);
32
33 for (int i = 0; i < 6; i++)
34 alr_detector.OnBytesSent(100, kMeasuredIntervalMs);
35 EXPECT_EQ(alr_detector.InApplicationLimitedRegion(), true);
36 }
37
38 TEST(AlrDetectorTest, NetworkLimitedWhenSendingCloseToEstimate) {
39 AlrDetector alr_detector;
40
41 alr_detector.SetEstimatedBitrate(kEstimatedBitrateBps);
42 for (int i = 0; i < 6; i++)
43 alr_detector.OnBytesSent(kBytesInIntervalAtEstimatedBitrate,
44 kMeasuredIntervalMs);
45 EXPECT_EQ(alr_detector.InApplicationLimitedRegion(), false);
46 }
47
48 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/alr_detector.cc ('k') | webrtc/modules/pacing/paced_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698