Steve Anton | 60be6a9 | 2020-11-05 14:32:18 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 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_MEDIA_STREAM_INTERFACE_H_ |
| 12 | #define API_TEST_MOCK_MEDIA_STREAM_INTERFACE_H_ |
| 13 | |
| 14 | #include <string> |
| 15 | |
| 16 | #include "api/media_stream_interface.h" |
| 17 | #include "test/gmock.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | class MockAudioSource final |
| 22 | : public rtc::RefCountedObject<AudioSourceInterface> { |
| 23 | public: |
| 24 | static rtc::scoped_refptr<MockAudioSource> Create() { |
| 25 | return new MockAudioSource(); |
| 26 | } |
| 27 | |
| 28 | MOCK_METHOD(void, |
| 29 | RegisterObserver, |
| 30 | (ObserverInterface * observer), |
| 31 | (override)); |
| 32 | MOCK_METHOD(void, |
| 33 | UnregisterObserver, |
| 34 | (ObserverInterface * observer), |
| 35 | (override)); |
| 36 | MOCK_METHOD(SourceState, state, (), (const, override)); |
| 37 | MOCK_METHOD(bool, remote, (), (const, override)); |
| 38 | MOCK_METHOD(void, SetVolume, (double volume), (override)); |
| 39 | MOCK_METHOD(void, |
| 40 | RegisterAudioObserver, |
| 41 | (AudioObserver * observer), |
| 42 | (override)); |
| 43 | MOCK_METHOD(void, |
| 44 | UnregisterAudioObserver, |
| 45 | (AudioObserver * observer), |
| 46 | (override)); |
| 47 | MOCK_METHOD(void, AddSink, (AudioTrackSinkInterface * sink), (override)); |
| 48 | MOCK_METHOD(void, RemoveSink, (AudioTrackSinkInterface * sink), (override)); |
| 49 | MOCK_METHOD(const cricket::AudioOptions, options, (), (const, override)); |
| 50 | |
| 51 | private: |
| 52 | MockAudioSource() = default; |
| 53 | }; |
| 54 | |
| 55 | class MockAudioTrack final : public rtc::RefCountedObject<AudioTrackInterface> { |
| 56 | public: |
| 57 | static rtc::scoped_refptr<MockAudioTrack> Create() { |
| 58 | return new MockAudioTrack(); |
| 59 | } |
| 60 | |
| 61 | MOCK_METHOD(void, |
| 62 | RegisterObserver, |
| 63 | (ObserverInterface * observer), |
| 64 | (override)); |
| 65 | MOCK_METHOD(void, |
| 66 | UnregisterObserver, |
| 67 | (ObserverInterface * observer), |
| 68 | (override)); |
| 69 | MOCK_METHOD(std::string, kind, (), (const, override)); |
| 70 | MOCK_METHOD(std::string, id, (), (const override)); |
| 71 | MOCK_METHOD(bool, enabled, (), (const, override)); |
| 72 | MOCK_METHOD(bool, set_enabled, (bool enable), (override)); |
| 73 | MOCK_METHOD(TrackState, state, (), (const, override)); |
| 74 | MOCK_METHOD(AudioSourceInterface*, GetSource, (), (const, override)); |
| 75 | MOCK_METHOD(void, AddSink, (AudioTrackSinkInterface * sink), (override)); |
| 76 | MOCK_METHOD(void, RemoveSink, (AudioTrackSinkInterface * sink), (override)); |
| 77 | MOCK_METHOD(bool, GetSignalLevel, (int* level), (override)); |
| 78 | MOCK_METHOD(rtc::scoped_refptr<AudioProcessorInterface>, |
| 79 | GetAudioProcessor, |
| 80 | (), |
| 81 | (override)); |
| 82 | |
| 83 | private: |
| 84 | MockAudioTrack() = default; |
| 85 | }; |
| 86 | |
| 87 | } // namespace webrtc |
| 88 | |
| 89 | #endif // API_TEST_MOCK_MEDIA_STREAM_INTERFACE_H_ |