1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/* 2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * 4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Use of this source code is governed by a BSD-style license 5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * that can be found in the LICENSE file in the root of the source 6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * tree. An additional intellectual property rights grant can be found 7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * in the file PATENTS. All contributing project authors may 8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */ 10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 111a07e42b9a0b19e818ae7f0910e0214252952757aluebs@webrtc.org#include "webrtc/modules/audio_processing/include/audio_processing.h" 12471ae72f18e7b23a96b245dbd508386fe139449cpbos@webrtc.org#include "webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h" 13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 14b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass TestErrorObserver : public webrtc::VoiceEngineObserver { 15b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org public: 16b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org TestErrorObserver() {} 17b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org virtual ~TestErrorObserver() {} 18ca7a9a2696d2f73f543241093c4faeb4c608678cpbos@webrtc.org void CallbackOnError(int channel, int error_code) { 19b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org ADD_FAILURE() << "Unexpected error on channel " << channel << 20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org ": error code " << error_code; 21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org } 22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org}; 23b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 24b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgAfterInitializationFixture::AfterInitializationFixture() 25b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org : error_observer_(new TestErrorObserver()) { 261a07e42b9a0b19e818ae7f0910e0214252952757aluebs@webrtc.org webrtc::Config config; 271a07e42b9a0b19e818ae7f0910e0214252952757aluebs@webrtc.org config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(false)); 281a07e42b9a0b19e818ae7f0910e0214252952757aluebs@webrtc.org webrtc::AudioProcessing* audioproc = webrtc::AudioProcessing::Create(config); 291a07e42b9a0b19e818ae7f0910e0214252952757aluebs@webrtc.org 301a07e42b9a0b19e818ae7f0910e0214252952757aluebs@webrtc.org EXPECT_EQ(0, voe_base_->Init(NULL, audioproc)); 31b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 32b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#if defined(WEBRTC_ANDROID) 33b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org EXPECT_EQ(0, voe_hardware_->SetLoudspeakerStatus(false)); 34b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#endif 35b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 36b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org EXPECT_EQ(0, voe_base_->RegisterVoiceEngineObserver(*error_observer_)); 37b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org} 38b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 39b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgAfterInitializationFixture::~AfterInitializationFixture() { 40b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org EXPECT_EQ(0, voe_base_->DeRegisterVoiceEngineObserver()); 41b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org} 42