Chromium Code Reviews| Index: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc |
| diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc |
| index 9821568260c0cf82e0df7c97821409f162271246..dae1f27073f754647bd79ec979a6d46938609bb2 100644 |
| --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc |
| +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc |
| @@ -42,7 +42,7 @@ class RemoteEstimatorProxyTest : public ::testing::Test { |
| void Process() { |
| clock_.AdvanceTimeMilliseconds( |
| - RemoteEstimatorProxy::kDefaultProcessIntervalMs); |
| + RemoteEstimatorProxy::kDefaultSendIntervalMs); |
| proxy_.Process(); |
| } |
| @@ -350,4 +350,45 @@ TEST_F(RemoteEstimatorProxyTest, RemovesTimestampsOutOfScope) { |
| Process(); |
| } |
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsZeroBeforeFirstProcess) { |
| + EXPECT_EQ(0, proxy_.TimeUntilNextProcess()); |
| +} |
| + |
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsDefaultOnUnkownBitrate) { |
| + Process(); |
| + EXPECT_EQ(RemoteEstimatorProxy::kDefaultSendIntervalMs, |
| + proxy_.TimeUntilNextProcess()); |
| +} |
| + |
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMinIntervalOn300kbps) { |
| + Process(); |
| + proxy_.OnBitrateChanged(300000); |
| + EXPECT_EQ(RemoteEstimatorProxy::kMinSendIntervalMs, |
| + proxy_.TimeUntilNextProcess()); |
| +} |
| + |
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMaxIntervalOn0kbps) { |
| + Process(); |
| + // TimeUntilNextProcess should be limited by |kMaxSendIntervalMs| when |
| + // bit rate is small. We choose 0 bps as a special case, which also tests |
|
stefan-webrtc
2016/11/07 12:35:45
s/bit rate/bitrate
minyue-webrtc
2016/11/07 12:40:22
Done.
|
| + // erroneous behaviors like division-by-zero. |
| + proxy_.OnBitrateChanged(0); |
| + EXPECT_EQ(RemoteEstimatorProxy::kMaxSendIntervalMs, |
| + proxy_.TimeUntilNextProcess()); |
| +} |
| + |
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMaxIntervalOn20kbps) { |
| + Process(); |
| + proxy_.OnBitrateChanged(20000); |
| + EXPECT_EQ(RemoteEstimatorProxy::kMaxSendIntervalMs, |
| + proxy_.TimeUntilNextProcess()); |
| +} |
| + |
| +TEST_F(RemoteEstimatorProxyTest, TwccReportsUse5PercentOfAvailableBandwidth) { |
| + Process(); |
| + proxy_.OnBitrateChanged(80000); |
| + // 80kbps * 0.05 = TwccReportSize(68B * 8b/B) * 1000ms / SendInterval(136ms) |
| + EXPECT_EQ(136, proxy_.TimeUntilNextProcess()); |
| +} |
| + |
| } // namespace webrtc |