Erik Språng | 6af1c92 | 2018-10-12 10:01:30 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 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 | |
| 11 | #ifndef API_TEST_MOCK_VIDEO_ENCODER_H_ |
| 12 | #define API_TEST_MOCK_VIDEO_ENCODER_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "api/video_codecs/video_encoder.h" |
| 17 | #include "test/gmock.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | class MockEncodedImageCallback : public EncodedImageCallback { |
| 22 | public: |
| 23 | MockEncodedImageCallback(); |
| 24 | ~MockEncodedImageCallback(); |
| 25 | MOCK_METHOD3(OnEncodedImage, |
| 26 | Result(const EncodedImage& encodedImage, |
| 27 | const CodecSpecificInfo* codecSpecificInfo, |
| 28 | const RTPFragmentationHeader* fragmentation)); |
| 29 | }; |
| 30 | |
| 31 | class MockVideoEncoder : public VideoEncoder { |
| 32 | public: |
| 33 | MockVideoEncoder(); |
| 34 | ~MockVideoEncoder(); |
| 35 | MOCK_CONST_METHOD2(Version, int32_t(int8_t* version, int32_t length)); |
| 36 | MOCK_METHOD3(InitEncode, |
| 37 | int32_t(const VideoCodec* codecSettings, |
| 38 | int32_t numberOfCores, |
| 39 | size_t maxPayloadSize)); |
| 40 | MOCK_METHOD3(Encode, |
| 41 | int32_t(const VideoFrame& inputImage, |
| 42 | const CodecSpecificInfo* codecSpecificInfo, |
| 43 | const std::vector<FrameType>* frame_types)); |
| 44 | MOCK_METHOD1(RegisterEncodeCompleteCallback, |
| 45 | int32_t(EncodedImageCallback* callback)); |
| 46 | MOCK_METHOD0(Release, int32_t()); |
| 47 | MOCK_METHOD0(Reset, int32_t()); |
| 48 | MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt)); |
| 49 | MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate)); |
| 50 | MOCK_METHOD2(SetRateAllocation, |
| 51 | int32_t(const VideoBitrateAllocation& newBitRate, |
| 52 | uint32_t frameRate)); |
| 53 | MOCK_CONST_METHOD0(HasTrustedRateController, bool(void)); |
| 54 | }; |
| 55 | |
| 56 | } // namespace webrtc |
| 57 | |
| 58 | #endif // API_TEST_MOCK_VIDEO_ENCODER_H_ |