| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 // This file includes unit tests for SendStatisticsProxy. | 11 // This file includes unit tests for SendStatisticsProxy. |
| 12 #include "webrtc/video/send_statistics_proxy.h" | 12 #include "webrtc/video/send_statistics_proxy.h" |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 class SendStatisticsProxyTest : public ::testing::Test { | 22 class SendStatisticsProxyTest : public ::testing::Test { |
| 23 public: | 23 public: |
| 24 SendStatisticsProxyTest() | 24 SendStatisticsProxyTest() |
| 25 : fake_clock_(1234), avg_delay_ms_(0), max_delay_ms_(0) {} | 25 : fake_clock_(1234), config_(GetTestConfig()), avg_delay_ms_(0), |
| 26 max_delay_ms_(0) {} |
| 26 virtual ~SendStatisticsProxyTest() {} | 27 virtual ~SendStatisticsProxyTest() {} |
| 27 | 28 |
| 28 protected: | 29 protected: |
| 29 virtual void SetUp() { | 30 virtual void SetUp() { |
| 30 statistics_proxy_.reset( | 31 statistics_proxy_.reset( |
| 31 new SendStatisticsProxy(&fake_clock_, GetTestConfig())); | 32 new SendStatisticsProxy(&fake_clock_, GetTestConfig())); |
| 32 config_ = GetTestConfig(); | |
| 33 expected_ = VideoSendStream::Stats(); | 33 expected_ = VideoSendStream::Stats(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 VideoSendStream::Config GetTestConfig() { | 36 VideoSendStream::Config GetTestConfig() { |
| 37 VideoSendStream::Config config; | 37 VideoSendStream::Config config(nullptr); |
| 38 config.rtp.ssrcs.push_back(17); | 38 config.rtp.ssrcs.push_back(17); |
| 39 config.rtp.ssrcs.push_back(42); | 39 config.rtp.ssrcs.push_back(42); |
| 40 config.rtp.rtx.ssrcs.push_back(18); | 40 config.rtp.rtx.ssrcs.push_back(18); |
| 41 config.rtp.rtx.ssrcs.push_back(43); | 41 config.rtp.rtx.ssrcs.push_back(43); |
| 42 return config; | 42 return config; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void ExpectEqual(VideoSendStream::Stats one, VideoSendStream::Stats other) { | 45 void ExpectEqual(VideoSendStream::Stats one, VideoSendStream::Stats other) { |
| 46 EXPECT_EQ(one.input_frame_rate, other.input_frame_rate); | 46 EXPECT_EQ(one.input_frame_rate, other.input_frame_rate); |
| 47 EXPECT_EQ(one.encode_frame_rate, other.encode_frame_rate); | 47 EXPECT_EQ(one.encode_frame_rate, other.encode_frame_rate); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); | 398 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); |
| 399 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), | 399 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), |
| 400 stats.substreams[config_.rtp.ssrcs[0]].total_bitrate_bps); | 400 stats.substreams[config_.rtp.ssrcs[0]].total_bitrate_bps); |
| 401 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), | 401 EXPECT_EQ(static_cast<int>(bitrate.bitrate_bps), |
| 402 stats.substreams[config_.rtp.ssrcs[0]].retransmit_bitrate_bps); | 402 stats.substreams[config_.rtp.ssrcs[0]].retransmit_bitrate_bps); |
| 403 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].total_bitrate_bps); | 403 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].total_bitrate_bps); |
| 404 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps); | 404 EXPECT_EQ(0, stats.substreams[config_.rtp.ssrcs[1]].retransmit_bitrate_bps); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace webrtc | 407 } // namespace webrtc |
| OLD | NEW |