From bc37fc8418da951cf56f5580731b8b034d1f12a6 Mon Sep 17 00:00:00 2001 From: solenberg Date: Mon, 4 Apr 2016 09:54:44 -0700 Subject: [PATCH] Add mock AudioDeviceModule. BUG=webrtc:4690 Review URL: https://codereview.webrtc.org/1844843003 Cr-Commit-Position: refs/heads/master@{#12220} --- webrtc/media/engine/fakewebrtcvideoengine.h | 1 - webrtc/media/engine/fakewebrtcvoiceengine.h | 150 +++++------------- .../engine/webrtcvoiceengine_unittest.cc | 55 ++++--- webrtc/media/media.gyp | 5 +- .../audio_device/include/mock_audio_device.h | 135 ++++++++++++++++ 5 files changed, 213 insertions(+), 133 deletions(-) create mode 100644 webrtc/modules/audio_device/include/mock_audio_device.h diff --git a/webrtc/media/engine/fakewebrtcvideoengine.h b/webrtc/media/engine/fakewebrtcvideoengine.h index d93431e263..475797b16d 100644 --- a/webrtc/media/engine/fakewebrtcvideoengine.h +++ b/webrtc/media/engine/fakewebrtcvideoengine.h @@ -21,7 +21,6 @@ #include "webrtc/base/stringutils.h" #include "webrtc/base/thread_annotations.h" #include "webrtc/media/base/codec.h" -#include "webrtc/media/engine/fakewebrtccommon.h" #include "webrtc/media/engine/webrtcvideodecoderfactory.h" #include "webrtc/media/engine/webrtcvideoencoderfactory.h" #include "webrtc/modules/video_coding/include/video_error_codes.h" diff --git a/webrtc/media/engine/fakewebrtcvoiceengine.h b/webrtc/media/engine/fakewebrtcvoiceengine.h index cc0375e7c7..b5ad81c6a9 100644 --- a/webrtc/media/engine/fakewebrtcvoiceengine.h +++ b/webrtc/media/engine/fakewebrtcvoiceengine.h @@ -25,7 +25,6 @@ #include "webrtc/media/engine/fakewebrtccommon.h" #include "webrtc/media/engine/webrtcvoe.h" #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" -#include "webrtc/modules/audio_device/include/fake_audio_device.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace cricket { @@ -119,26 +118,6 @@ class FakeAudioProcessing : public webrtc::AudioProcessing { bool experimental_ns_enabled_; }; -// TODO(solenberg): Swap this for a proper mock of the ADM. -class FakeAudioDeviceModule : public webrtc::FakeAudioDeviceModule { - public: - ~FakeAudioDeviceModule() override { - RTC_DCHECK_EQ(0, ref_count_); - } - int32_t AddRef() const override { - ref_count_++; - return ref_count_; - } - int32_t Release() const override { - RTC_DCHECK_LT(0, ref_count_); - ref_count_--; - return ref_count_; - } - - private: - mutable int32_t ref_count_ = 0; -}; - class FakeWebRtcVoiceEngine : public webrtc::VoEAudioProcessing, public webrtc::VoEBase, public webrtc::VoECodec, @@ -147,71 +126,33 @@ class FakeWebRtcVoiceEngine public webrtc::VoEVolumeControl { public: struct Channel { - explicit Channel() - : external_transport(false), - playout(false), - volume_scale(1.0), - vad(false), - codec_fec(false), - max_encoding_bandwidth(0), - opus_dtx(false), - red(false), - nack(false), - cn8_type(13), - cn16_type(105), - red_type(117), - nack_max_packets(0), - send_ssrc(0), - associate_send_channel(-1), - recv_codecs(), - neteq_capacity(-1), - neteq_fast_accelerate(false) { + Channel() { memset(&send_codec, 0, sizeof(send_codec)); } - bool external_transport; - bool playout; - float volume_scale; - bool vad; - bool codec_fec; - int max_encoding_bandwidth; - bool opus_dtx; - bool red; - bool nack; - int cn8_type; - int cn16_type; - int red_type; - int nack_max_packets; - uint32_t send_ssrc; - int associate_send_channel; + bool external_transport = false; + bool playout = false; + float volume_scale = 1.0f; + bool vad = false; + bool codec_fec = false; + int max_encoding_bandwidth = 0; + bool opus_dtx = false; + bool red = false; + bool nack = false; + int cn8_type = 13; + int cn16_type = 105; + int red_type = 117; + int nack_max_packets = 0; + uint32_t send_ssrc = 0; + int associate_send_channel = -1; std::vector recv_codecs; webrtc::CodecInst send_codec; webrtc::PacketTime last_rtp_packet_time; std::list packets; - int neteq_capacity; - bool neteq_fast_accelerate; + int neteq_capacity = -1; + bool neteq_fast_accelerate = false; }; - FakeWebRtcVoiceEngine() - : inited_(false), - last_channel_(-1), - fail_create_channel_(false), - num_set_send_codecs_(0), - ec_enabled_(false), - ec_metrics_enabled_(false), - cng_enabled_(false), - ns_enabled_(false), - agc_enabled_(false), - highpass_filter_enabled_(false), - stereo_swapping_enabled_(false), - typing_detection_enabled_(false), - ec_mode_(webrtc::kEcDefault), - aecm_mode_(webrtc::kAecmSpeakerphone), - ns_mode_(webrtc::kNsDefault), - agc_mode_(webrtc::kAgcDefault), - observer_(NULL), - playout_fail_channel_(-1), - recording_sample_rate_(-1), - playout_sample_rate_(-1) { + FakeWebRtcVoiceEngine() { memset(&agc_config_, 0, sizeof(agc_config_)); } ~FakeWebRtcVoiceEngine() override { @@ -274,10 +215,6 @@ class FakeWebRtcVoiceEngine bool CheckNoPacket(int channel) { return channels_[channel]->packets.empty(); } - void TriggerCallbackOnError(int channel_num, int err_code) { - RTC_DCHECK(observer_ != NULL); - observer_->CallbackOnError(channel_num, err_code); - } void set_playout_fail_channel(int channel) { playout_fail_channel_ = channel; } @@ -309,11 +246,8 @@ class FakeWebRtcVoiceEngine WEBRTC_STUB(Release, ()); // webrtc::VoEBase - WEBRTC_FUNC(RegisterVoiceEngineObserver, ( - webrtc::VoiceEngineObserver& observer)) { - observer_ = &observer; - return 0; - } + WEBRTC_STUB(RegisterVoiceEngineObserver, ( + webrtc::VoiceEngineObserver& observer)); WEBRTC_STUB(DeRegisterVoiceEngineObserver, ()); WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm, webrtc::AudioProcessing* audioproc)) { @@ -328,7 +262,7 @@ class FakeWebRtcVoiceEngine return &audio_processing_; } webrtc::AudioDeviceModule* audio_device_module() override { - return &audio_device_module_; + return nullptr; } WEBRTC_FUNC(CreateChannel, ()) { webrtc::Config empty_config; @@ -776,30 +710,28 @@ class FakeWebRtcVoiceEngine } private: - bool inited_; - int last_channel_; + bool inited_ = false; + int last_channel_ = -1; std::map channels_; - bool fail_create_channel_; - int num_set_send_codecs_; // how many times we call SetSendCodec(). - bool ec_enabled_; - bool ec_metrics_enabled_; - bool cng_enabled_; - bool ns_enabled_; - bool agc_enabled_; - bool highpass_filter_enabled_; - bool stereo_swapping_enabled_; - bool typing_detection_enabled_; - webrtc::EcModes ec_mode_; - webrtc::AecmModes aecm_mode_; - webrtc::NsModes ns_mode_; - webrtc::AgcModes agc_mode_; + bool fail_create_channel_ = false; + int num_set_send_codecs_ = 0; // how many times we call SetSendCodec(). + bool ec_enabled_ = false; + bool ec_metrics_enabled_ = false; + bool cng_enabled_ = false; + bool ns_enabled_ = false; + bool agc_enabled_ = false; + bool highpass_filter_enabled_ = false; + bool stereo_swapping_enabled_ = false; + bool typing_detection_enabled_ = false; + webrtc::EcModes ec_mode_ = webrtc::kEcDefault; + webrtc::AecmModes aecm_mode_ = webrtc::kAecmSpeakerphone; + webrtc::NsModes ns_mode_ = webrtc::kNsDefault; + webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; webrtc::AgcConfig agc_config_; - webrtc::VoiceEngineObserver* observer_; - int playout_fail_channel_; - int recording_sample_rate_; - int playout_sample_rate_; + int playout_fail_channel_ = -1; + int recording_sample_rate_ = -1; + int playout_sample_rate_ = -1; FakeAudioProcessing audio_processing_; - FakeAudioDeviceModule audio_device_module_; }; } // namespace cricket diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc index 97773b7134..78b6a20790 100644 --- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc +++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc @@ -24,9 +24,12 @@ #include "webrtc/media/engine/fakewebrtccall.h" #include "webrtc/media/engine/fakewebrtcvoiceengine.h" #include "webrtc/media/engine/webrtcvoiceengine.h" +#include "webrtc/modules/audio_device/include/mock_audio_device.h" using cricket::kRtpAudioLevelHeaderExtension; using cricket::kRtpAbsoluteSenderTimeHeaderExtension; +using testing::Return; +using testing::StrictMock; namespace { @@ -61,10 +64,13 @@ class FakeVoEWrapper : public cricket::VoEWrapper { // Tests that our stub library "works". TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) { + StrictMock adm; + EXPECT_CALL(adm, AddRef()).WillOnce(Return(0)); + EXPECT_CALL(adm, Release()).WillOnce(Return(0)); cricket::FakeWebRtcVoiceEngine voe; EXPECT_FALSE(voe.IsInited()); { - cricket::WebRtcVoiceEngine engine(nullptr, new FakeVoEWrapper(&voe)); + cricket::WebRtcVoiceEngine engine(&adm, new FakeVoEWrapper(&voe)); EXPECT_TRUE(voe.IsInited()); } EXPECT_FALSE(voe.IsInited()); @@ -84,15 +90,17 @@ class WebRtcVoiceEngineTestFake : public testing::Test { WebRtcVoiceEngineTestFake() : WebRtcVoiceEngineTestFake("") {} explicit WebRtcVoiceEngineTestFake(const char* field_trials) - : call_(webrtc::Call::Config()), - engine_(nullptr, new FakeVoEWrapper(&voe_)), - override_field_trials_(field_trials) { + : call_(webrtc::Call::Config()), override_field_trials_(field_trials) { + EXPECT_CALL(adm_, AddRef()).WillOnce(Return(0)); + EXPECT_CALL(adm_, Release()).WillOnce(Return(0)); + engine_.reset(new cricket::WebRtcVoiceEngine(&adm_, + new FakeVoEWrapper(&voe_))); send_parameters_.codecs.push_back(kPcmuCodec); recv_parameters_.codecs.push_back(kPcmuCodec); } bool SetupChannel() { - channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(), - cricket::AudioOptions()); + channel_ = engine_->CreateChannel(&call_, cricket::MediaConfig(), + cricket::AudioOptions()); return (channel_ != nullptr); } bool SetupRecvStream() { @@ -401,14 +409,14 @@ class WebRtcVoiceEngineTestFake : public testing::Test { } protected: + StrictMock adm_; cricket::FakeCall call_; cricket::FakeWebRtcVoiceEngine voe_; - cricket::WebRtcVoiceEngine engine_; + std::unique_ptr engine_; cricket::VoiceMediaChannel* channel_ = nullptr; cricket::AudioSendParameters send_parameters_; cricket::AudioRecvParameters recv_parameters_; FakeAudioSource fake_source_; - private: webrtc::test::ScopedFieldTrials override_field_trials_; }; @@ -421,7 +429,7 @@ TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { // Tests that the list of supported codecs is created properly and ordered // correctly TEST_F(WebRtcVoiceEngineTestFake, CodecPreference) { - const std::vector& codecs = engine_.codecs(); + const std::vector& codecs = engine_->codecs(); ASSERT_FALSE(codecs.empty()); EXPECT_STRCASEEQ("opus", codecs[0].name.c_str()); EXPECT_EQ(48000, codecs[0].clockrate); @@ -435,7 +443,7 @@ TEST_F(WebRtcVoiceEngineTestFake, CodecPreference) { } TEST_F(WebRtcVoiceEngineTestFake, OpusSupportsTransportCc) { - const std::vector& codecs = engine_.codecs(); + const std::vector& codecs = engine_->codecs(); bool opus_found = false; for (cricket::AudioCodec codec : codecs) { if (codec.name == "opus") { @@ -727,7 +735,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthMultiRateAsCallee) { EXPECT_TRUE(SetupChannel()); const int kDesiredBitrate = 128000; cricket::AudioSendParameters parameters; - parameters.codecs = engine_.codecs(); + parameters.codecs = engine_->codecs(); parameters.max_bandwidth_bps = kDesiredBitrate; EXPECT_TRUE(channel_->SetSendParameters(parameters)); @@ -1305,7 +1313,7 @@ TEST_F(WebRtcVoiceEngineTestFake, TransportCcCanBeEnabledAndDisabled) { EXPECT_FALSE( call_.GetAudioReceiveStream(kSsrc1)->GetConfig().rtp.transport_cc); - send_parameters.codecs = engine_.codecs(); + send_parameters.codecs = engine_->codecs(); EXPECT_TRUE(channel_->SetSendParameters(send_parameters)); ASSERT_TRUE(call_.GetAudioReceiveStream(kSsrc1) != nullptr); EXPECT_TRUE( @@ -1977,7 +1985,7 @@ class WebRtcVoiceEngineWithSendSideBweTest : public WebRtcVoiceEngineTestFake { TEST_F(WebRtcVoiceEngineWithSendSideBweTest, SupportsTransportSequenceNumberHeaderExtension) { - cricket::RtpCapabilities capabilities = engine_.GetCapabilities(); + cricket::RtpCapabilities capabilities = engine_->GetCapabilities(); ASSERT_FALSE(capabilities.header_extensions.empty()); for (const cricket::RtpHeaderExtension& extension : capabilities.header_extensions) { @@ -2798,10 +2806,10 @@ TEST_F(WebRtcVoiceEngineTestFake, InitDoesNotOverwriteDefaultAgcConfig) { TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) { EXPECT_TRUE(SetupSendStream()); std::unique_ptr channel1( - static_cast(engine_.CreateChannel( + static_cast(engine_->CreateChannel( &call_, cricket::MediaConfig(), cricket::AudioOptions()))); std::unique_ptr channel2( - static_cast(engine_.CreateChannel( + static_cast(engine_->CreateChannel( &call_, cricket::MediaConfig(), cricket::AudioOptions()))); // Have to add a stream to make SetSend work. @@ -2902,20 +2910,23 @@ TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { cricket::MediaConfig config; std::unique_ptr channel; - channel.reset(engine_.CreateChannel(&call_, config, cricket::AudioOptions())); + channel.reset( + engine_->CreateChannel(&call_, config, cricket::AudioOptions())); channel->SetInterface(&network_interface); // Default value when DSCP is disabled should be DSCP_DEFAULT. EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp()); config.enable_dscp = true; - channel.reset(engine_.CreateChannel(&call_, config, cricket::AudioOptions())); + channel.reset( + engine_->CreateChannel(&call_, config, cricket::AudioOptions())); channel->SetInterface(&network_interface); EXPECT_EQ(rtc::DSCP_EF, network_interface.dscp()); // Verify that setting the option to false resets the // DiffServCodePoint. config.enable_dscp = false; - channel.reset(engine_.CreateChannel(&call_, config, cricket::AudioOptions())); + channel.reset( + engine_->CreateChannel(&call_, config, cricket::AudioOptions())); channel->SetInterface(&network_interface); // Default value when DSCP is disabled should be DSCP_DEFAULT. EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp()); @@ -3029,7 +3040,7 @@ TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) { } // Set up receive extensions. - cricket::RtpCapabilities capabilities = engine_.GetCapabilities(); + cricket::RtpCapabilities capabilities = engine_->GetCapabilities(); cricket::AudioRecvParameters recv_parameters; recv_parameters.extensions = capabilities.header_extensions; channel_->SetRecvParameters(recv_parameters); @@ -3207,8 +3218,10 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) { } // Tests that reference counting on the external ADM is correct. -TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternADM) { - cricket::FakeAudioDeviceModule adm; +TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) { + testing::NiceMock adm; + EXPECT_CALL(adm, AddRef()).Times(3).WillRepeatedly(Return(0)); + EXPECT_CALL(adm, Release()).Times(3).WillRepeatedly(Return(0)); { cricket::WebRtcVoiceEngine engine(&adm); std::unique_ptr call( diff --git a/webrtc/media/media.gyp b/webrtc/media/media.gyp index 6ef0d76151..9994cfc2b3 100644 --- a/webrtc/media/media.gyp +++ b/webrtc/media/media.gyp @@ -203,13 +203,14 @@ 'target_name': 'rtc_unittest_main', 'type': 'static_library', 'dependencies': [ + '<(DEPTH)/testing/gmock.gyp:gmock', + '<(DEPTH)/testing/gtest.gyp:gtest', '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', ], 'direct_dependent_settings': { 'include_dirs': [ '<(libyuv_dir)/include', - '<(DEPTH)/testing/gtest/include', - '<(DEPTH)/testing/gtest', + '<(DEPTH)/testing/gmock/include', ], }, 'conditions': [ diff --git a/webrtc/modules/audio_device/include/mock_audio_device.h b/webrtc/modules/audio_device/include/mock_audio_device.h new file mode 100644 index 0000000000..8c1c758b17 --- /dev/null +++ b/webrtc/modules/audio_device/include/mock_audio_device.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_DEVICE_H_ +#define WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_DEVICE_H_ + +#include +#include "testing/gmock/include/gmock/gmock.h" +#include "webrtc/modules/audio_device/include/audio_device.h" + +namespace webrtc { +namespace test { + +class MockAudioDeviceModule : public AudioDeviceModule { + public: + // Module. + MOCK_METHOD0(TimeUntilNextProcess, int64_t()); + MOCK_METHOD0(Process, void()); + MOCK_METHOD1(ProcessThreadAttached, void(ProcessThread*)); + // RefCountedModule. + MOCK_CONST_METHOD0(AddRef, int32_t()); + MOCK_CONST_METHOD0(Release, int32_t()); + // AudioDeviceModule. + MOCK_CONST_METHOD1(ActiveAudioLayer, int32_t(AudioLayer* audioLayer)); + MOCK_CONST_METHOD0(LastError, ErrorCode()); + MOCK_METHOD1(RegisterEventObserver, + int32_t(AudioDeviceObserver* eventCallback)); + MOCK_METHOD1(RegisterAudioCallback, int32_t(AudioTransport* audioCallback)); + MOCK_METHOD0(Init, int32_t()); + MOCK_METHOD0(Terminate, int32_t()); + MOCK_CONST_METHOD0(Initialized, bool()); + MOCK_METHOD0(PlayoutDevices, int16_t()); + MOCK_METHOD0(RecordingDevices, int16_t()); + MOCK_METHOD3(PlayoutDeviceName, int32_t(uint16_t index, + char name[kAdmMaxDeviceNameSize], + char guid[kAdmMaxGuidSize])); + MOCK_METHOD3(RecordingDeviceName, int32_t(uint16_t index, + char name[kAdmMaxDeviceNameSize], + char guid[kAdmMaxGuidSize])); + MOCK_METHOD1(SetPlayoutDevice, int32_t(uint16_t index)); + MOCK_METHOD1(SetPlayoutDevice, int32_t(WindowsDeviceType device)); + MOCK_METHOD1(SetRecordingDevice, int32_t(uint16_t index)); + MOCK_METHOD1(SetRecordingDevice, int32_t(WindowsDeviceType device)); + MOCK_METHOD1(PlayoutIsAvailable, int32_t(bool* available)); + MOCK_METHOD0(InitPlayout, int32_t()); + MOCK_CONST_METHOD0(PlayoutIsInitialized, bool()); + MOCK_METHOD1(RecordingIsAvailable, int32_t(bool* available)); + MOCK_METHOD0(InitRecording, int32_t()); + MOCK_CONST_METHOD0(RecordingIsInitialized, bool()); + MOCK_METHOD0(StartPlayout, int32_t()); + MOCK_METHOD0(StopPlayout, int32_t()); + MOCK_CONST_METHOD0(Playing, bool()); + MOCK_METHOD0(StartRecording, int32_t()); + MOCK_METHOD0(StopRecording, int32_t()); + MOCK_CONST_METHOD0(Recording, bool()); + MOCK_METHOD1(SetAGC, int32_t(bool enable)); + MOCK_CONST_METHOD0(AGC, bool()); + MOCK_METHOD2(SetWaveOutVolume, int32_t(uint16_t volumeLeft, + uint16_t volumeRight)); + MOCK_CONST_METHOD2(WaveOutVolume, int32_t(uint16_t* volumeLeft, + uint16_t* volumeRight)); + MOCK_METHOD0(InitSpeaker, int32_t()); + MOCK_CONST_METHOD0(SpeakerIsInitialized, bool()); + MOCK_METHOD0(InitMicrophone, int32_t()); + MOCK_CONST_METHOD0(MicrophoneIsInitialized, bool()); + MOCK_METHOD1(SpeakerVolumeIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetSpeakerVolume, int32_t(uint32_t volume)); + MOCK_CONST_METHOD1(SpeakerVolume, int32_t(uint32_t* volume)); + MOCK_CONST_METHOD1(MaxSpeakerVolume, int32_t(uint32_t* maxVolume)); + MOCK_CONST_METHOD1(MinSpeakerVolume, int32_t(uint32_t* minVolume)); + MOCK_CONST_METHOD1(SpeakerVolumeStepSize, int32_t(uint16_t* stepSize)); + MOCK_METHOD1(MicrophoneVolumeIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetMicrophoneVolume, int32_t(uint32_t volume)); + MOCK_CONST_METHOD1(MicrophoneVolume, int32_t(uint32_t* volume)); + MOCK_CONST_METHOD1(MaxMicrophoneVolume, int32_t(uint32_t* maxVolume)); + MOCK_CONST_METHOD1(MinMicrophoneVolume, int32_t(uint32_t* minVolume)); + MOCK_CONST_METHOD1(MicrophoneVolumeStepSize, int32_t(uint16_t* stepSize)); + MOCK_METHOD1(SpeakerMuteIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetSpeakerMute, int32_t(bool enable)); + MOCK_CONST_METHOD1(SpeakerMute, int32_t(bool* enabled)); + MOCK_METHOD1(MicrophoneMuteIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetMicrophoneMute, int32_t(bool enable)); + MOCK_CONST_METHOD1(MicrophoneMute, int32_t(bool* enabled)); + MOCK_METHOD1(MicrophoneBoostIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetMicrophoneBoost, int32_t(bool enable)); + MOCK_CONST_METHOD1(MicrophoneBoost, int32_t(bool* enabled)); + MOCK_CONST_METHOD1(StereoPlayoutIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetStereoPlayout, int32_t(bool enable)); + MOCK_CONST_METHOD1(StereoPlayout, int32_t(bool* enabled)); + MOCK_CONST_METHOD1(StereoRecordingIsAvailable, int32_t(bool* available)); + MOCK_METHOD1(SetStereoRecording, int32_t(bool enable)); + MOCK_CONST_METHOD1(StereoRecording, int32_t(bool* enabled)); + MOCK_METHOD1(SetRecordingChannel, int32_t(const ChannelType channel)); + MOCK_CONST_METHOD1(RecordingChannel, int32_t(ChannelType* channel)); + MOCK_METHOD2(SetPlayoutBuffer, int32_t(const BufferType type, + uint16_t sizeMS)); + MOCK_CONST_METHOD2(PlayoutBuffer, int32_t(BufferType* type, + uint16_t* sizeMS)); + MOCK_CONST_METHOD1(PlayoutDelay, int32_t(uint16_t* delayMS)); + MOCK_CONST_METHOD1(RecordingDelay, int32_t(uint16_t* delayMS)); + MOCK_CONST_METHOD1(CPULoad, int32_t(uint16_t* load)); + MOCK_METHOD1(StartRawOutputFileRecording, + int32_t(const char pcmFileNameUTF8[kAdmMaxFileNameSize])); + MOCK_METHOD0(StopRawOutputFileRecording, int32_t()); + MOCK_METHOD1(StartRawInputFileRecording, + int32_t(const char pcmFileNameUTF8[kAdmMaxFileNameSize])); + MOCK_METHOD0(StopRawInputFileRecording, int32_t()); + MOCK_METHOD1(SetRecordingSampleRate, int32_t(const uint32_t samplesPerSec)); + MOCK_CONST_METHOD1(RecordingSampleRate, int32_t(uint32_t* samplesPerSec)); + MOCK_METHOD1(SetPlayoutSampleRate, int32_t(const uint32_t samplesPerSec)); + MOCK_CONST_METHOD1(PlayoutSampleRate, int32_t(uint32_t* samplesPerSec)); + MOCK_METHOD0(ResetAudioDevice, int32_t()); + MOCK_METHOD1(SetLoudspeakerStatus, int32_t(bool enable)); + MOCK_CONST_METHOD1(GetLoudspeakerStatus, int32_t(bool* enabled)); + MOCK_CONST_METHOD0(BuiltInAECIsAvailable, bool()); + MOCK_CONST_METHOD0(BuiltInAGCIsAvailable, bool()); + MOCK_CONST_METHOD0(BuiltInNSIsAvailable, bool()); + MOCK_METHOD1(EnableBuiltInAEC, int32_t(bool enable)); + MOCK_METHOD1(EnableBuiltInAGC, int32_t(bool enable)); + MOCK_METHOD1(EnableBuiltInNS, int32_t(bool enable)); + MOCK_CONST_METHOD0(BuiltInAECIsEnabled, bool()); + MOCK_CONST_METHOD1(GetPlayoutAudioParameters, int(AudioParameters* params)); + MOCK_CONST_METHOD1(GetRecordAudioParameters, int(AudioParameters* params)); +}; +} // namespace test +} // namespace webrtc + +#endif // WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_MOCK_AUDIO_DEVICE_H_