1 /* 2 * Copyright (c) 2015 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_DEVICE_H_ 12 #define MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_DEVICE_H_ 13 14 #include <string> 15 16 #include "api/make_ref_counted.h" 17 #include "modules/audio_device/include/audio_device.h" 18 #include "test/gmock.h" 19 20 namespace webrtc { 21 namespace test { 22 23 class MockAudioDeviceModule : public AudioDeviceModule { 24 public: CreateNice()25 static rtc::scoped_refptr<MockAudioDeviceModule> CreateNice() { 26 return rtc::make_ref_counted<::testing::NiceMock<MockAudioDeviceModule>>(); 27 } CreateStrict()28 static rtc::scoped_refptr<MockAudioDeviceModule> CreateStrict() { 29 return rtc::make_ref_counted< 30 ::testing::StrictMock<MockAudioDeviceModule>>(); 31 } 32 33 // AudioDeviceModule. 34 MOCK_METHOD(int32_t, 35 ActiveAudioLayer, 36 (AudioLayer * audioLayer), 37 (const, override)); 38 MOCK_METHOD(int32_t, 39 RegisterAudioCallback, 40 (AudioTransport * audioCallback), 41 (override)); 42 MOCK_METHOD(int32_t, Init, (), (override)); 43 MOCK_METHOD(int32_t, Terminate, (), (override)); 44 MOCK_METHOD(bool, Initialized, (), (const, override)); 45 MOCK_METHOD(int16_t, PlayoutDevices, (), (override)); 46 MOCK_METHOD(int16_t, RecordingDevices, (), (override)); 47 MOCK_METHOD(int32_t, 48 PlayoutDeviceName, 49 (uint16_t index, 50 char name[kAdmMaxDeviceNameSize], 51 char guid[kAdmMaxGuidSize]), 52 (override)); 53 MOCK_METHOD(int32_t, 54 RecordingDeviceName, 55 (uint16_t index, 56 char name[kAdmMaxDeviceNameSize], 57 char guid[kAdmMaxGuidSize]), 58 (override)); 59 MOCK_METHOD(int32_t, SetPlayoutDevice, (uint16_t index), (override)); 60 MOCK_METHOD(int32_t, 61 SetPlayoutDevice, 62 (WindowsDeviceType device), 63 (override)); 64 MOCK_METHOD(int32_t, SetRecordingDevice, (uint16_t index), (override)); 65 MOCK_METHOD(int32_t, 66 SetRecordingDevice, 67 (WindowsDeviceType device), 68 (override)); 69 MOCK_METHOD(int32_t, PlayoutIsAvailable, (bool* available), (override)); 70 MOCK_METHOD(int32_t, InitPlayout, (), (override)); 71 MOCK_METHOD(bool, PlayoutIsInitialized, (), (const, override)); 72 MOCK_METHOD(int32_t, RecordingIsAvailable, (bool* available), (override)); 73 MOCK_METHOD(int32_t, InitRecording, (), (override)); 74 MOCK_METHOD(bool, RecordingIsInitialized, (), (const, override)); 75 MOCK_METHOD(int32_t, StartPlayout, (), (override)); 76 MOCK_METHOD(int32_t, StopPlayout, (), (override)); 77 MOCK_METHOD(bool, Playing, (), (const, override)); 78 MOCK_METHOD(int32_t, StartRecording, (), (override)); 79 MOCK_METHOD(int32_t, StopRecording, (), (override)); 80 MOCK_METHOD(bool, Recording, (), (const, override)); 81 MOCK_METHOD(int32_t, InitSpeaker, (), (override)); 82 MOCK_METHOD(bool, SpeakerIsInitialized, (), (const, override)); 83 MOCK_METHOD(int32_t, InitMicrophone, (), (override)); 84 MOCK_METHOD(bool, MicrophoneIsInitialized, (), (const, override)); 85 MOCK_METHOD(int32_t, SpeakerVolumeIsAvailable, (bool* available), (override)); 86 MOCK_METHOD(int32_t, SetSpeakerVolume, (uint32_t volume), (override)); 87 MOCK_METHOD(int32_t, SpeakerVolume, (uint32_t * volume), (const, override)); 88 MOCK_METHOD(int32_t, 89 MaxSpeakerVolume, 90 (uint32_t * maxVolume), 91 (const, override)); 92 MOCK_METHOD(int32_t, 93 MinSpeakerVolume, 94 (uint32_t * minVolume), 95 (const, override)); 96 MOCK_METHOD(int32_t, 97 MicrophoneVolumeIsAvailable, 98 (bool* available), 99 (override)); 100 MOCK_METHOD(int32_t, SetMicrophoneVolume, (uint32_t volume), (override)); 101 MOCK_METHOD(int32_t, 102 MicrophoneVolume, 103 (uint32_t * volume), 104 (const, override)); 105 MOCK_METHOD(int32_t, 106 MaxMicrophoneVolume, 107 (uint32_t * maxVolume), 108 (const, override)); 109 MOCK_METHOD(int32_t, 110 MinMicrophoneVolume, 111 (uint32_t * minVolume), 112 (const, override)); 113 MOCK_METHOD(int32_t, SpeakerMuteIsAvailable, (bool* available), (override)); 114 MOCK_METHOD(int32_t, SetSpeakerMute, (bool enable), (override)); 115 MOCK_METHOD(int32_t, SpeakerMute, (bool* enabled), (const, override)); 116 MOCK_METHOD(int32_t, 117 MicrophoneMuteIsAvailable, 118 (bool* available), 119 (override)); 120 MOCK_METHOD(int32_t, SetMicrophoneMute, (bool enable), (override)); 121 MOCK_METHOD(int32_t, MicrophoneMute, (bool* enabled), (const, override)); 122 MOCK_METHOD(int32_t, 123 StereoPlayoutIsAvailable, 124 (bool* available), 125 (const, override)); 126 MOCK_METHOD(int32_t, SetStereoPlayout, (bool enable), (override)); 127 MOCK_METHOD(int32_t, StereoPlayout, (bool* enabled), (const, override)); 128 MOCK_METHOD(int32_t, 129 StereoRecordingIsAvailable, 130 (bool* available), 131 (const, override)); 132 MOCK_METHOD(int32_t, SetStereoRecording, (bool enable), (override)); 133 MOCK_METHOD(int32_t, StereoRecording, (bool* enabled), (const, override)); 134 MOCK_METHOD(int32_t, PlayoutDelay, (uint16_t * delayMS), (const, override)); 135 MOCK_METHOD(bool, BuiltInAECIsAvailable, (), (const, override)); 136 MOCK_METHOD(bool, BuiltInAGCIsAvailable, (), (const, override)); 137 MOCK_METHOD(bool, BuiltInNSIsAvailable, (), (const, override)); 138 MOCK_METHOD(int32_t, EnableBuiltInAEC, (bool enable), (override)); 139 MOCK_METHOD(int32_t, EnableBuiltInAGC, (bool enable), (override)); 140 MOCK_METHOD(int32_t, EnableBuiltInNS, (bool enable), (override)); 141 MOCK_METHOD(int32_t, GetPlayoutUnderrunCount, (), (const, override)); 142 #if defined(WEBRTC_IOS) 143 MOCK_METHOD(int, 144 GetPlayoutAudioParameters, 145 (AudioParameters * params), 146 (const, override)); 147 MOCK_METHOD(int, 148 GetRecordAudioParameters, 149 (AudioParameters * params), 150 (const, override)); 151 #endif // WEBRTC_IOS 152 }; 153 } // namespace test 154 } // namespace webrtc 155 156 #endif // MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_DEVICE_H_ 157