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