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