1 /* 2 * Copyright (c) 2011 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/modules/audio_processing/include/audio_processing.h" 12 #include "webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h" 13 14 class TestErrorObserver : public webrtc::VoiceEngineObserver { 15 public: 16 TestErrorObserver() {} 17 virtual ~TestErrorObserver() {} 18 void CallbackOnError(int channel, int error_code) { 19 ADD_FAILURE() << "Unexpected error on channel " << channel << 20 ": error code " << error_code; 21 } 22 }; 23 24 AfterInitializationFixture::AfterInitializationFixture() 25 : error_observer_(new TestErrorObserver()) { 26 webrtc::Config config; 27 config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(false)); 28 webrtc::AudioProcessing* audioproc = webrtc::AudioProcessing::Create(config); 29 30 EXPECT_EQ(0, voe_base_->Init(NULL, audioproc)); 31 32 #if defined(WEBRTC_ANDROID) 33 EXPECT_EQ(0, voe_hardware_->SetLoudspeakerStatus(false)); 34 #endif 35 36 EXPECT_EQ(0, voe_base_->RegisterVoiceEngineObserver(*error_observer_)); 37 } 38 39 AfterInitializationFixture::~AfterInitializationFixture() { 40 EXPECT_EQ(0, voe_base_->DeRegisterVoiceEngineObserver()); 41 } 42