1 /*
2  *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #ifndef VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_
11 #define VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_
12 
13 #include <vector>
14 
15 #include "api/video/video_stream_encoder_interface.h"
16 #include "test/gmock.h"
17 
18 namespace webrtc {
19 
20 class MockVideoStreamEncoder : public VideoStreamEncoderInterface {
21  public:
22   MOCK_METHOD(void,
23               AddAdaptationResource,
24               (rtc::scoped_refptr<Resource>),
25               (override));
26   MOCK_METHOD(std::vector<rtc::scoped_refptr<Resource>>,
27               GetAdaptationResources,
28               (),
29               (override));
30   MOCK_METHOD(void,
31               SetSource,
32               (rtc::VideoSourceInterface<VideoFrame>*,
33                const DegradationPreference&),
34               (override));
35   MOCK_METHOD(void, SetSink, (EncoderSink*, bool), (override));
36   MOCK_METHOD(void, SetStartBitrate, (int), (override));
37   MOCK_METHOD(void, SendKeyFrame, (), (override));
38   MOCK_METHOD(void,
39               OnLossNotification,
40               (const VideoEncoder::LossNotification&),
41               (override));
42   MOCK_METHOD(void,
43               OnBitrateUpdated,
44               (DataRate, DataRate, DataRate, uint8_t, int64_t, double),
45               (override));
46   MOCK_METHOD(void, OnFrame, (const VideoFrame&), (override));
47   MOCK_METHOD(void,
48               SetFecControllerOverride,
49               (FecControllerOverride*),
50               (override));
51   MOCK_METHOD(void, Stop, (), (override));
52 
53   MOCK_METHOD(void,
54               MockedConfigureEncoder,
55               (const VideoEncoderConfig&, size_t));
56   // gtest generates implicit copy which is not allowed on VideoEncoderConfig,
57   // so we can't mock ConfigureEncoder directly.
ConfigureEncoder(VideoEncoderConfig config,size_t max_data_payload_length)58   void ConfigureEncoder(VideoEncoderConfig config,
59                         size_t max_data_payload_length) {
60     MockedConfigureEncoder(config, max_data_payload_length);
61   }
62 };
63 
64 }  // namespace webrtc
65 
66 #endif  // VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_
67