Index: webrtc/video/receive_statistics_proxy_unittest.cc |
diff --git a/webrtc/video/receive_statistics_proxy_unittest.cc b/webrtc/video/receive_statistics_proxy_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..894ee8fe732ec837fdd31b2e57501fa11c4fe23f |
--- /dev/null |
+++ b/webrtc/video/receive_statistics_proxy_unittest.cc |
@@ -0,0 +1,48 @@ |
+/* |
+ * Copyright 2016 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/video/receive_statistics_proxy.h" |
+ |
+#include <memory> |
+ |
+#include "webrtc/test/gtest.h" |
+ |
+namespace webrtc { |
+ |
+// TODO(sakal): ReceiveStatisticsProxy is lacking unittesting. |
+class ReceiveStatisticsProxyTest : public ::testing::Test { |
+ public: |
+ ReceiveStatisticsProxyTest() : fake_clock_(1234), config_(GetTestConfig()) {} |
+ virtual ~ReceiveStatisticsProxyTest() {} |
+ |
+ protected: |
+ virtual void SetUp() { |
+ statistics_proxy_.reset(new ReceiveStatisticsProxy(&config_, &fake_clock_)); |
+ } |
+ |
+ VideoReceiveStream::Config GetTestConfig() { |
+ VideoReceiveStream::Config config(nullptr); |
+ return config; |
+ } |
+ |
+ SimulatedClock fake_clock_; |
+ std::unique_ptr<ReceiveStatisticsProxy> statistics_proxy_; |
+ VideoReceiveStream::Config config_; |
+}; |
+ |
+TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) { |
+ EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded); |
+ for (uint32_t i = 1; i <= 3; ++i) { |
+ statistics_proxy_->OnDecodedFrame(); |
+ EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); |
+ } |
+} |
+ |
+} // namespace webrtc |