Files
webrtc/webrtc/voice_engine/voe_base_unittest.cc
andrew@webrtc.org f0a90c37c4 Expose the capture-side AudioProcessing object and allow it to be injected.
* Clean up the configuration code, including removing most of the weird defines.
* Add a unit test.

Review URL: https://webrtc-codereview.appspot.com/1152005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3605 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-03-05 01:12:49 +00:00

51 lines
1.5 KiB
C++

/*
* 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"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_device/include/fake_audio_device.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
namespace webrtc {
class VoEBaseTest : public ::testing::Test {
protected:
VoEBaseTest() :
voe_(VoiceEngine::Create()),
base_(VoEBase::GetInterface(voe_)),
adm_(new FakeAudioDeviceModule) {
}
~VoEBaseTest() {
base_->Release();
VoiceEngine::Delete(voe_);
}
VoiceEngine* voe_;
VoEBase* base_;
scoped_ptr<FakeAudioDeviceModule> adm_;
};
TEST_F(VoEBaseTest, AcceptsAudioProcessingPtr) {
AudioProcessing* audioproc = AudioProcessing::Create(0);
EXPECT_EQ(0, base_->Init(adm_.get(), audioproc));
EXPECT_EQ(audioproc, base_->audio_processing());
}
TEST_F(VoEBaseTest, AudioProcessingCreatedAfterInit) {
EXPECT_TRUE(base_->audio_processing() == NULL);
EXPECT_EQ(0, base_->Init(adm_.get(), NULL));
EXPECT_TRUE(base_->audio_processing() != NULL);
}
} // namespace webrtc