Erik Språng | c84cd95 | 2018-10-15 11:55:13 +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_DECODER_H_ |
| 12 | #define API_TEST_MOCK_VIDEO_DECODER_H_ |
| 13 | |
| 14 | #include "api/video_codecs/video_decoder.h" |
| 15 | #include "test/gmock.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | class MockDecodedImageCallback : public DecodedImageCallback { |
| 20 | public: |
Danil Chapovalov | fc11519 | 2020-05-08 15:03:03 +0200 | [diff] [blame] | 21 | MOCK_METHOD(int32_t, |
| 22 | Decoded, |
| 23 | (VideoFrame & decoded_image), // NOLINT |
| 24 | (override)); |
| 25 | MOCK_METHOD(int32_t, |
| 26 | Decoded, |
| 27 | (VideoFrame & decoded_image, // NOLINT |
| 28 | int64_t decode_time_ms), |
| 29 | (override)); |
| 30 | MOCK_METHOD(void, |
| 31 | Decoded, |
| 32 | (VideoFrame & decoded_image, // NOLINT |
| 33 | absl::optional<int32_t> decode_time_ms, |
| 34 | absl::optional<uint8_t> qp), |
| 35 | (override)); |
Erik Språng | c84cd95 | 2018-10-15 11:55:13 +0200 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | class MockVideoDecoder : public VideoDecoder { |
| 39 | public: |
Danil Chapovalov | 355b8d2 | 2021-08-13 16:50:37 +0200 | [diff] [blame^] | 40 | MockVideoDecoder() { |
| 41 | // Make `Configure` succeed by default, so that individual tests that |
| 42 | // verify other methods wouldn't need to stub `Configure`. |
| 43 | ON_CALL(*this, Configure).WillByDefault(testing::Return(true)); |
| 44 | } |
| 45 | |
Danil Chapovalov | ecc46ef | 2021-08-09 15:30:47 +0200 | [diff] [blame] | 46 | MOCK_METHOD(bool, Configure, (const Settings& settings), (override)); |
Danil Chapovalov | fc11519 | 2020-05-08 15:03:03 +0200 | [diff] [blame] | 47 | MOCK_METHOD(int32_t, |
| 48 | InitDecode, |
| 49 | (const VideoCodec* codec_settings, int32_t number_of_cores), |
| 50 | (override)); |
| 51 | MOCK_METHOD(int32_t, |
| 52 | Decode, |
| 53 | (const EncodedImage& input_image, |
| 54 | bool missing_frames, |
| 55 | int64_t render_time_ms), |
| 56 | (override)); |
| 57 | MOCK_METHOD(int32_t, |
| 58 | RegisterDecodeCompleteCallback, |
| 59 | (DecodedImageCallback * callback), |
| 60 | (override)); |
| 61 | MOCK_METHOD(int32_t, Release, (), (override)); |
Erik Språng | c84cd95 | 2018-10-15 11:55:13 +0200 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // namespace webrtc |
| 65 | |
| 66 | #endif // API_TEST_MOCK_VIDEO_DECODER_H_ |