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 #ifndef SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_ 12 #define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_ 13 14 #include <assert.h> 15 16 #include "webrtc/common.h" 17 #include "webrtc/common_types.h" 18 #include "webrtc/engine_configurations.h" 19 #include "webrtc/voice_engine/include/voe_audio_processing.h" 20 #include "webrtc/voice_engine/include/voe_base.h" 21 #include "webrtc/voice_engine/include/voe_codec.h" 22 #include "webrtc/voice_engine/include/voe_dtmf.h" 23 #include "webrtc/voice_engine/include/voe_errors.h" 24 #include "webrtc/voice_engine/include/voe_external_media.h" 25 #include "webrtc/voice_engine/include/voe_file.h" 26 #include "webrtc/voice_engine/include/voe_hardware.h" 27 #include "webrtc/voice_engine/include/voe_neteq_stats.h" 28 #include "webrtc/voice_engine/include/voe_network.h" 29 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 30 #include "webrtc/voice_engine/include/voe_video_sync.h" 31 #include "webrtc/voice_engine/include/voe_volume_control.h" 32 #include "webrtc/voice_engine/test/auto_test/voe_test_common.h" 33 34 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gtest/include/gtest/gtest.h" 36 37 // This convenient fixture sets up all voice engine interfaces automatically for 38 // use by testing subclasses. It allocates each interface and releases it once 39 // which means that if a tests allocates additional interfaces from the voice 40 // engine and forgets to release it, this test will fail in the destructor. 41 // It will not call any init methods. 42 // 43 // Implementation note: 44 // The interface fetching is done in the constructor and not SetUp() since 45 // this relieves our subclasses from calling SetUp in the superclass if they 46 // choose to override SetUp() themselves. This is fine as googletest will 47 // construct new test objects for each method. 48 class BeforeInitializationFixture : public testing::Test { 49 public: 50 BeforeInitializationFixture(); 51 virtual ~BeforeInitializationFixture(); 52 53 protected: 54 // Use this sleep function to sleep in tests. 55 void Sleep(long milliseconds); 56 57 webrtc::VoiceEngine* voice_engine_; 58 webrtc::VoEBase* voe_base_; 59 webrtc::VoECodec* voe_codec_; 60 webrtc::VoEVolumeControl* voe_volume_control_; 61 webrtc::VoEDtmf* voe_dtmf_; 62 webrtc::VoERTP_RTCP* voe_rtp_rtcp_; 63 webrtc::VoEAudioProcessing* voe_apm_; 64 webrtc::VoENetwork* voe_network_; 65 webrtc::VoEFile* voe_file_; 66 webrtc::VoEVideoSync* voe_vsync_; 67 webrtc::VoEHardware* voe_hardware_; 68 webrtc::VoEExternalMedia* voe_xmedia_; 69 webrtc::VoENetEqStats* voe_neteq_stats_; 70 webrtc::Config config_; 71 }; 72 73 #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_ 74