1 /* 2 * Copyright (c) 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 #include <utility> 12 13 #include "api/task_queue/default_task_queue_factory.h" 14 #include "api/voip/voip_engine_factory.h" 15 #include "modules/audio_device/include/mock_audio_device.h" 16 #include "modules/audio_processing/include/mock_audio_processing.h" 17 #include "test/gtest.h" 18 #include "test/mock_audio_decoder_factory.h" 19 #include "test/mock_audio_encoder_factory.h" 20 21 namespace webrtc { 22 namespace { 23 24 // Create voip engine with mock modules as normal use case. TEST(VoipEngineFactoryTest,CreateEngineWithMockModules)25TEST(VoipEngineFactoryTest, CreateEngineWithMockModules) { 26 VoipEngineConfig config; 27 config.encoder_factory = rtc::make_ref_counted<MockAudioEncoderFactory>(); 28 config.decoder_factory = rtc::make_ref_counted<MockAudioDecoderFactory>(); 29 config.task_queue_factory = CreateDefaultTaskQueueFactory(); 30 config.audio_processing = 31 rtc::make_ref_counted<testing::NiceMock<test::MockAudioProcessing>>(); 32 config.audio_device_module = test::MockAudioDeviceModule::CreateNice(); 33 34 auto voip_engine = CreateVoipEngine(std::move(config)); 35 EXPECT_NE(voip_engine, nullptr); 36 } 37 38 // Create voip engine without setting audio processing as optional component. TEST(VoipEngineFactoryTest,UseNoAudioProcessing)39TEST(VoipEngineFactoryTest, UseNoAudioProcessing) { 40 VoipEngineConfig config; 41 config.encoder_factory = rtc::make_ref_counted<MockAudioEncoderFactory>(); 42 config.decoder_factory = rtc::make_ref_counted<MockAudioDecoderFactory>(); 43 config.task_queue_factory = CreateDefaultTaskQueueFactory(); 44 config.audio_device_module = test::MockAudioDeviceModule::CreateNice(); 45 46 auto voip_engine = CreateVoipEngine(std::move(config)); 47 EXPECT_NE(voip_engine, nullptr); 48 } 49 50 } // namespace 51 } // namespace webrtc 52