mock_audio_transport.h (2627B)
1 /* 2 * Copyright (c) 2016 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 MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_TRANSPORT_H_ 12 #define MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_TRANSPORT_H_ 13 14 #include <cstddef> 15 #include <cstdint> 16 #include <optional> 17 18 #include "api/audio/audio_device_defines.h" 19 #include "test/gmock.h" 20 21 namespace webrtc { 22 namespace test { 23 24 class MockAudioTransport : public AudioTransport { 25 public: 26 MockAudioTransport() {} 27 ~MockAudioTransport() {} 28 29 MOCK_METHOD(int32_t, 30 RecordedDataIsAvailable, 31 (const void* audioSamples, 32 size_t nSamples, 33 size_t nBytesPerSample, 34 size_t nChannels, 35 uint32_t samplesPerSec, 36 uint32_t totalDelayMS, 37 int32_t clockDrift, 38 uint32_t currentMicLevel, 39 bool keyPressed, 40 uint32_t& newMicLevel), 41 (override)); 42 43 MOCK_METHOD(int32_t, 44 RecordedDataIsAvailable, 45 (const void* audioSamples, 46 size_t nSamples, 47 size_t nBytesPerSample, 48 size_t nChannels, 49 uint32_t samplesPerSec, 50 uint32_t totalDelayMS, 51 int32_t clockDrift, 52 uint32_t currentMicLevel, 53 bool keyPressed, 54 uint32_t& newMicLevel, 55 std::optional<int64_t> estimated_capture_time_ns), 56 (override)); 57 58 MOCK_METHOD(int32_t, 59 NeedMorePlayData, 60 (size_t nSamples, 61 size_t nBytesPerSample, 62 size_t nChannels, 63 uint32_t samplesPerSec, 64 void* audioSamples, 65 size_t& nSamplesOut, 66 int64_t* elapsed_time_ms, 67 int64_t* ntp_time_ms), 68 (override)); 69 70 MOCK_METHOD(void, 71 PullRenderData, 72 (int bits_per_sample, 73 int sample_rate, 74 size_t number_of_channels, 75 size_t number_of_frames, 76 void* audio_data, 77 int64_t* elapsed_time_ms, 78 int64_t* ntp_time_ms), 79 (override)); 80 }; 81 82 } // namespace test 83 } // namespace webrtc 84 85 #endif // MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_TRANSPORT_H_