blob: e1c288d39cb8330f5638b74d06d4dfcec92a2cea [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
11#include "webrtc/voice_engine/include/voe_base.h"
12
13#include "testing/gtest/include/gtest/gtest.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000014#include "webrtc/modules/audio_processing/include/audio_processing.h"
Jelena Marusic46bd31b2015-04-30 10:57:10 +020015#include "webrtc/voice_engine/voice_engine_fixture.h"
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000016
17namespace webrtc {
18
Jelena Marusic46bd31b2015-04-30 10:57:10 +020019class VoEBaseFixture : public VoiceEngineFixture {};
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000020
Jelena Marusic46bd31b2015-04-30 10:57:10 +020021TEST_F(VoEBaseFixture, InitWithExternalAudioDeviceAndAudioProcessing) {
andrew@webrtc.org46323b32015-01-13 06:48:06 +000022 AudioProcessing* audioproc = AudioProcessing::Create();
Jelena Marusic06b08af2015-04-21 11:39:57 +020023 EXPECT_EQ(0, base_->Init(&adm_, audioproc));
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000024 EXPECT_EQ(audioproc, base_->audio_processing());
Jelena Marusic06b08af2015-04-21 11:39:57 +020025 EXPECT_EQ(0, base_->LastError());
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000026}
27
Jelena Marusic46bd31b2015-04-30 10:57:10 +020028TEST_F(VoEBaseFixture, InitWithExternalAudioDevice) {
Jelena Marusic06b08af2015-04-21 11:39:57 +020029 EXPECT_EQ(nullptr, base_->audio_processing());
30 EXPECT_EQ(0, base_->Init(&adm_, nullptr));
31 EXPECT_NE(nullptr, base_->audio_processing());
32 EXPECT_EQ(0, base_->LastError());
33}
34
Jelena Marusic46bd31b2015-04-30 10:57:10 +020035TEST_F(VoEBaseFixture, CreateChannelBeforeInitShouldFail) {
Jelena Marusic06b08af2015-04-21 11:39:57 +020036 int channelID = base_->CreateChannel();
Jelena Marusic46bd31b2015-04-30 10:57:10 +020037 EXPECT_EQ(channelID, -1);
Jelena Marusic06b08af2015-04-21 11:39:57 +020038}
39
Jelena Marusic46bd31b2015-04-30 10:57:10 +020040TEST_F(VoEBaseFixture, CreateChannelAfterInit) {
Jelena Marusic06b08af2015-04-21 11:39:57 +020041 EXPECT_EQ(0, base_->Init(&adm_, nullptr));
42 int channelID = base_->CreateChannel();
Jelena Marusic46bd31b2015-04-30 10:57:10 +020043 EXPECT_NE(channelID, -1);
Jelena Marusic06b08af2015-04-21 11:39:57 +020044 EXPECT_EQ(0, base_->DeleteChannel(channelID));
andrew@webrtc.orgf0a90c32013-03-05 01:12:49 +000045}
46
47} // namespace webrtc