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

Side by Side Diff: webrtc/video/encoder_rtcp_feedback_unittest.cc

Issue 2695643002: Make SendStatisticsProxy paramter mandatory in ViEEncoder ctor. (Closed)
Patch Set: oopsie Created 3 years, 10 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 | « no previous file | webrtc/video/vie_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 #include "webrtc/video/encoder_rtcp_feedback.h" 11 #include "webrtc/video/encoder_rtcp_feedback.h"
12 12
13 #include "webrtc/modules/utility/include/mock/mock_process_thread.h" 13 #include "webrtc/modules/utility/include/mock/mock_process_thread.h"
14 #include "webrtc/test/gmock.h" 14 #include "webrtc/test/gmock.h"
15 #include "webrtc/test/gtest.h" 15 #include "webrtc/test/gtest.h"
16 #include "webrtc/video/send_statistics_proxy.h"
16 #include "webrtc/video/vie_encoder.h" 17 #include "webrtc/video/vie_encoder.h"
17 18
18 using ::testing::NiceMock; 19 using ::testing::NiceMock;
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 class MockVieEncoder : public ViEEncoder { 23 class MockVieEncoder : public ViEEncoder {
23 public: 24 public:
24 MockVieEncoder() 25 explicit MockVieEncoder(SendStatisticsProxy* send_stats_proxy)
25 : ViEEncoder(1, 26 : ViEEncoder(1,
26 nullptr, 27 send_stats_proxy,
27 VideoSendStream::Config::EncoderSettings("fake", 0, nullptr), 28 VideoSendStream::Config::EncoderSettings("fake", 0, nullptr),
28 nullptr, 29 nullptr,
29 nullptr) {} 30 nullptr) {}
30 ~MockVieEncoder() { Stop(); } 31 ~MockVieEncoder() { Stop(); }
31 32
32 MOCK_METHOD1(OnReceivedIntraFrameRequest, void(size_t)); 33 MOCK_METHOD1(OnReceivedIntraFrameRequest, void(size_t));
33 MOCK_METHOD1(OnReceivedSLI, void(uint8_t picture_id)); 34 MOCK_METHOD1(OnReceivedSLI, void(uint8_t picture_id));
34 MOCK_METHOD1(OnReceivedRPSI, void(uint64_t picture_id)); 35 MOCK_METHOD1(OnReceivedRPSI, void(uint64_t picture_id));
35 }; 36 };
36 37
37 class VieKeyRequestTest : public ::testing::Test { 38 class VieKeyRequestTest : public ::testing::Test {
38 public: 39 public:
39 VieKeyRequestTest() 40 VieKeyRequestTest()
40 : simulated_clock_(123456789), 41 : simulated_clock_(123456789),
42 send_stats_proxy_(&simulated_clock_,
43 VideoSendStream::Config(nullptr),
44 VideoEncoderConfig::ContentType::kRealtimeVideo),
45 encoder_(&send_stats_proxy_),
41 encoder_rtcp_feedback_( 46 encoder_rtcp_feedback_(
42 &simulated_clock_, 47 &simulated_clock_,
43 std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc), 48 std::vector<uint32_t>(1, VieKeyRequestTest::kSsrc),
44 &encoder_) {} 49 &encoder_) {}
45 50
46 protected: 51 protected:
47 const uint32_t kSsrc = 1234; 52 const uint32_t kSsrc = 1234;
53
54 SimulatedClock simulated_clock_;
55 SendStatisticsProxy send_stats_proxy_;
48 MockVieEncoder encoder_; 56 MockVieEncoder encoder_;
49 SimulatedClock simulated_clock_;
50 EncoderRtcpFeedback encoder_rtcp_feedback_; 57 EncoderRtcpFeedback encoder_rtcp_feedback_;
51 }; 58 };
52 59
53 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { 60 TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) {
54 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); 61 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1);
55 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); 62 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
56 63
57 const uint8_t sli_picture_id = 3; 64 const uint8_t sli_picture_id = 3;
58 EXPECT_CALL(encoder_, OnReceivedSLI(sli_picture_id)).Times(1); 65 EXPECT_CALL(encoder_, OnReceivedSLI(sli_picture_id)).Times(1);
59 encoder_rtcp_feedback_.OnReceivedSLI(kSsrc, sli_picture_id); 66 encoder_rtcp_feedback_.OnReceivedSLI(kSsrc, sli_picture_id);
(...skipping 11 matching lines...) Expand all
71 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); 78 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
72 79
73 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); 80 EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1);
74 simulated_clock_.AdvanceTimeMilliseconds(300); 81 simulated_clock_.AdvanceTimeMilliseconds(300);
75 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); 82 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
76 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); 83 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
77 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); 84 encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
78 } 85 }
79 86
80 } // namespace webrtc 87 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/vie_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698