andrew@webrtc.org | b79627b | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 1 | /* |
| 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.org | b79627b | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/audio_device/include/fake_audio_device.h" |
pbos@webrtc.org | 471ae72 | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 15 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
andrew@webrtc.org | b79627b | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 16 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
| 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | class 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 | |
| 38 | TEST_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 | |
| 44 | TEST_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 |