blob: ef42fbab404cdfbcd0b07d662e27c4c085871672 [file] [log] [blame]
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +00001/*
2 * Copyright (c) 2013 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "voice_engine/include/voe_base.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000012
solenberg35dee812017-09-18 01:57:01 -070013#include "modules/audio_device/include/fake_audio_device.h"
14#include "modules/audio_processing/include/mock_audio_processing.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "test/gtest.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000016
17namespace webrtc {
18
solenberg35dee812017-09-18 01:57:01 -070019class VoEBaseTest : public ::testing::Test {
20 protected:
21 VoEBaseTest()
22 : voe_(VoiceEngine::Create()),
23 base_(VoEBase::GetInterface(voe_)) {
24 EXPECT_NE(nullptr, base_);
25 apm_ = new rtc::RefCountedObject<test::MockAudioProcessing>();
26 }
27
28 ~VoEBaseTest() {
29 EXPECT_EQ(0, base_->Terminate());
30 EXPECT_EQ(1, base_->Release());
31 EXPECT_TRUE(VoiceEngine::Delete(voe_));
32 }
33
34 VoiceEngine* voe_;
35 VoEBase* base_;
36 FakeAudioDeviceModule adm_;
37 rtc::scoped_refptr<AudioProcessing> apm_;
38};
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000039
Jelena Marusic0b154452015-05-04 09:55:59 +020040TEST_F(VoEBaseTest, InitWithExternalAudioDevice) {
peaha9cc40b2017-06-29 08:32:09 -070041 EXPECT_EQ(0, base_->Init(&adm_, apm_.get()));
Jelena Marusic06b08af2015-04-21 11:39:57 +020042}
43
Jelena Marusic0b154452015-05-04 09:55:59 +020044TEST_F(VoEBaseTest, CreateChannelAfterInit) {
peaha9cc40b2017-06-29 08:32:09 -070045 EXPECT_EQ(0, base_->Init(&adm_, apm_.get(), nullptr));
Jelena Marusic06b08af2015-04-21 11:39:57 +020046 int channelID = base_->CreateChannel();
Jelena Marusic46bd31b2015-04-30 10:57:10 +020047 EXPECT_NE(channelID, -1);
Jelena Marusic06b08af2015-04-21 11:39:57 +020048 EXPECT_EQ(0, base_->DeleteChannel(channelID));
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000049}
50
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000051} // namespace webrtc