blob: 72f2e0a3968bad85bbfbe260ad4cc2460a381e94 [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"
Niels Möllerb7239a92017-10-03 10:42:04 +020015#include "rtc_base/refcountedobject.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "test/gtest.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000017
18namespace webrtc {
19
solenberg35dee812017-09-18 01:57:01 -070020class VoEBaseTest : public ::testing::Test {
21 protected:
22 VoEBaseTest()
23 : voe_(VoiceEngine::Create()),
24 base_(VoEBase::GetInterface(voe_)) {
25 EXPECT_NE(nullptr, base_);
26 apm_ = new rtc::RefCountedObject<test::MockAudioProcessing>();
27 }
28
29 ~VoEBaseTest() {
30 EXPECT_EQ(0, base_->Terminate());
31 EXPECT_EQ(1, base_->Release());
32 EXPECT_TRUE(VoiceEngine::Delete(voe_));
33 }
34
35 VoiceEngine* voe_;
36 VoEBase* base_;
37 FakeAudioDeviceModule adm_;
38 rtc::scoped_refptr<AudioProcessing> apm_;
39};
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000040
Jelena Marusic0b154452015-05-04 09:55:59 +020041TEST_F(VoEBaseTest, InitWithExternalAudioDevice) {
peaha9cc40b2017-06-29 08:32:09 -070042 EXPECT_EQ(0, base_->Init(&adm_, apm_.get()));
Jelena Marusic06b08af2015-04-21 11:39:57 +020043}
44
Jelena Marusic0b154452015-05-04 09:55:59 +020045TEST_F(VoEBaseTest, CreateChannelAfterInit) {
peaha9cc40b2017-06-29 08:32:09 -070046 EXPECT_EQ(0, base_->Init(&adm_, apm_.get(), nullptr));
Jelena Marusic06b08af2015-04-21 11:39:57 +020047 int channelID = base_->CreateChannel();
Jelena Marusic46bd31b2015-04-30 10:57:10 +020048 EXPECT_NE(channelID, -1);
Jelena Marusic06b08af2015-04-21 11:39:57 +020049 EXPECT_EQ(0, base_->DeleteChannel(channelID));
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000050}
51
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000052} // namespace webrtc