blob: 6057534d0458e52eb63829020c05577b65d7066d [file] [log] [blame]
andrew@webrtc.orgb79627b2013-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"
andrew@webrtc.orgb79627b2013-03-05 01:12:49 +000014#include "webrtc/modules/audio_device/include/fake_audio_device.h"
pbos@webrtc.org471ae722013-05-21 13:52:32 +000015#include "webrtc/modules/audio_processing/include/audio_processing.h"
andrew@webrtc.orgb79627b2013-03-05 01:12:49 +000016#include "webrtc/system_wrappers/interface/scoped_ptr.h"
17
18namespace webrtc {
19
20class VoEBaseTest : public ::testing::Test {
21 protected:
22 VoEBaseTest() :
23 voe_(VoiceEngine::Create()),
24 base_(VoEBase::GetInterface(voe_)),
25 adm_(new FakeAudioDeviceModule) {
26 }
27
28 ~VoEBaseTest() {
29 base_->Release();
30 VoiceEngine::Delete(voe_);
31 }
32
33 VoiceEngine* voe_;
34 VoEBase* base_;
35 scoped_ptr<FakeAudioDeviceModule> adm_;
36};
37
38TEST_F(VoEBaseTest, AcceptsAudioProcessingPtr) {
39 AudioProcessing* audioproc = AudioProcessing::Create(0);
40 EXPECT_EQ(0, base_->Init(adm_.get(), audioproc));
41 EXPECT_EQ(audioproc, base_->audio_processing());
42}
43
44TEST_F(VoEBaseTest, AudioProcessingCreatedAfterInit) {
45 EXPECT_TRUE(base_->audio_processing() == NULL);
46 EXPECT_EQ(0, base_->Init(adm_.get(), NULL));
47 EXPECT_TRUE(base_->audio_processing() != NULL);
48}
49
50} // namespace webrtc