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

Unified Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window_unittest.cc

Issue 2966403002: Added implementation of three classes in BBR,with unit-tests. (Closed)
Patch Set: Variables' names changed, added units in which they are measured. Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window_unittest.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a2d50dfe9e2c7023c34c12cedc1142c63f0d4d20
--- /dev/null
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window_unittest.cc
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.h"
+#include "webrtc/modules/remote_bitrate_estimator/test/estimators/bbr.h"
+
+#include "webrtc/test/gtest.h"
+
+namespace webrtc {
+namespace testing {
+namespace bwe {
+namespace {
+// These are the same values used in CongestionWindow class.
+const int64_t kStartingCongestionWindow = 6000;
+const int64_t kMinimumCongestionWindow = 5840;
+} // namespace
+
+TEST(CongestionWindowTest, InitializationCheck) {
+ CongestionWindow congestion_window;
+ congestion_window.PacketSent(0);
+ EXPECT_EQ(congestion_window.data_inflight(), 0u);
+ congestion_window.AckReceived(0);
+ EXPECT_EQ(congestion_window.data_inflight(), 0u);
+}
+
+TEST(CongestionWindowTest, DataInflight) {
+ CongestionWindow congestion_window;
+ congestion_window.PacketSent(13);
+ EXPECT_EQ(congestion_window.data_inflight(), 13u);
+ congestion_window.AckReceived(12);
+ EXPECT_EQ(congestion_window.data_inflight(), 1u);
+ congestion_window.PacketSent(10);
+ congestion_window.PacketSent(9);
+ EXPECT_EQ(congestion_window.data_inflight(), 20u);
+ congestion_window.AckReceived(20);
+ EXPECT_EQ(congestion_window.data_inflight(), 0u);
+}
+
+TEST(CongestionWindowTest, ZeroBandwidthDelayProduct) {
+ CongestionWindow congestion_window;
+ int64_t target_congestion_window =
+ congestion_window.GetTargetCongestionWindow(100, 0, 2.885);
+ EXPECT_EQ(target_congestion_window, 2.885 * kStartingCongestionWindow);
+}
+
+TEST(CongestionWindowTest, BelowMinimumTargetCongestionWindow) {
+ CongestionWindow congestion_window;
+ int64_t target_congestion_window =
+ congestion_window.GetTargetCongestionWindow(100, 2, 2.885);
+ EXPECT_EQ(target_congestion_window, kMinimumCongestionWindow);
+}
+
+TEST(CongestionWindowTest, AboveMinimumTargetCongestionWindow) {
+ CongestionWindow congestion_window;
+ int64_t target_congestion_window =
+ congestion_window.GetTargetCongestionWindow(100000, 2, 2.885);
+ EXPECT_EQ(target_congestion_window, 577000);
+}
+
+TEST(CongestionWindowTest, MinimumCongestionWindow) {
+ CongestionWindow congestion_window;
+ int64_t cwnd = congestion_window.GetCongestionWindow(BbrBweSender::PROBE_RTT,
+ 100, 100, 2.885f);
+ EXPECT_EQ(cwnd, kMinimumCongestionWindow);
+}
+
+TEST(CongestionWindowTest, CalculateCongestionWindow) {
+ CongestionWindow congestion_window;
+ int64_t cwnd = congestion_window.GetCongestionWindow(BbrBweSender::STARTUP,
+ 100, 100, 2.885f);
+ EXPECT_EQ(cwnd, 28850);
+}
+} // namespace bwe
+} // namespace testing
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698