2013-03-05 01:12:49 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "webrtc/voice_engine/include/voe_base.h"
|
|
|
|
|
|
|
|
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
2013-05-21 13:52:32 +00:00
|
|
|
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
2015-04-30 10:57:10 +02:00
|
|
|
#include "webrtc/voice_engine/voice_engine_fixture.h"
|
2013-03-05 01:12:49 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-05-04 09:55:59 +02:00
|
|
|
class VoEBaseTest : public VoiceEngineFixture {};
|
2013-03-05 01:12:49 +00:00
|
|
|
|
2015-05-04 09:55:59 +02:00
|
|
|
TEST_F(VoEBaseTest, InitWithExternalAudioDeviceAndAudioProcessing) {
|
2015-01-13 06:48:06 +00:00
|
|
|
AudioProcessing* audioproc = AudioProcessing::Create();
|
2015-04-21 11:39:57 +02:00
|
|
|
EXPECT_EQ(0, base_->Init(&adm_, audioproc));
|
2013-03-05 01:12:49 +00:00
|
|
|
EXPECT_EQ(audioproc, base_->audio_processing());
|
2015-04-21 11:39:57 +02:00
|
|
|
EXPECT_EQ(0, base_->LastError());
|
2013-03-05 01:12:49 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 09:55:59 +02:00
|
|
|
TEST_F(VoEBaseTest, InitWithExternalAudioDevice) {
|
2015-04-21 11:39:57 +02:00
|
|
|
EXPECT_EQ(nullptr, base_->audio_processing());
|
|
|
|
|
EXPECT_EQ(0, base_->Init(&adm_, nullptr));
|
|
|
|
|
EXPECT_NE(nullptr, base_->audio_processing());
|
|
|
|
|
EXPECT_EQ(0, base_->LastError());
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-04 09:55:59 +02:00
|
|
|
TEST_F(VoEBaseTest, CreateChannelBeforeInitShouldFail) {
|
2015-04-21 11:39:57 +02:00
|
|
|
int channelID = base_->CreateChannel();
|
2015-04-30 10:57:10 +02:00
|
|
|
EXPECT_EQ(channelID, -1);
|
2015-04-21 11:39:57 +02:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 09:55:59 +02:00
|
|
|
TEST_F(VoEBaseTest, CreateChannelAfterInit) {
|
2015-04-21 11:39:57 +02:00
|
|
|
EXPECT_EQ(0, base_->Init(&adm_, nullptr));
|
|
|
|
|
int channelID = base_->CreateChannel();
|
2015-04-30 10:57:10 +02:00
|
|
|
EXPECT_NE(channelID, -1);
|
2015-04-21 11:39:57 +02:00
|
|
|
EXPECT_EQ(0, base_->DeleteChannel(channelID));
|
2013-03-05 01:12:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|