- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / voice_engine / test / auto_test / voe_test_defines.h
1 /*
2  *  Copyright (c) 2012 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 WEBRTC_VOICE_ENGINE_VOE_TEST_DEFINES_H
12 #define WEBRTC_VOICE_ENGINE_VOE_TEST_DEFINES_H
13
14 #include "webrtc/voice_engine/test/auto_test/voe_test_common.h"
15
16 // Read WEBRTC_VOICE_ENGINE_XXX_API compiler flags
17 #include "webrtc/engine_configurations.h"
18
19 // Select the tests to execute, list order below is same as they will be
20 // executed. Note that, all settings below will be overriden by sub-API
21 // settings in engine_configurations.h.
22 #define _TEST_BASE_
23 #define _TEST_RTP_RTCP_
24 #define _TEST_HARDWARE_
25 #define _TEST_CODEC_
26 #define _TEST_DTMF_
27 #define _TEST_VOLUME_
28 #define _TEST_AUDIO_PROCESSING_
29 #define _TEST_FILE_
30 #define _TEST_NETWORK_
31 #define _TEST_CALL_REPORT_
32 #define _TEST_VIDEO_SYNC_
33 #define _TEST_ENCRYPT_
34 #define _TEST_NETEQ_STATS_
35 #define _TEST_XMEDIA_
36
37 #define TESTED_AUDIO_LAYER kAudioPlatformDefault
38 //#define TESTED_AUDIO_LAYER kAudioLinuxPulse
39
40 // #define _ENABLE_VISUAL_LEAK_DETECTOR_ // Enables VLD to find memory leaks
41 // #define _ENABLE_IPV6_TESTS_      // Enables IPv6 tests in network xtest
42 // #define _USE_EXTENDED_TRACE_     // Adds unique trace files for extended test
43 // #define _MEMORY_TEST_
44
45 // Enable this when running instrumentation of some kind to exclude tests
46 // that will not pass due to slowed down execution.
47 // #define _INSTRUMENTATION_TESTING_
48
49 // Exclude (override) API tests given preprocessor settings in
50 // engine_configurations.h
51 #ifndef WEBRTC_VOICE_ENGINE_CODEC_API
52 #undef _TEST_CODEC_
53 #endif
54 #ifndef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
55 #undef _TEST_VOLUME_
56 #endif
57 #ifndef WEBRTC_VOICE_ENGINE_DTMF_API
58 #undef _TEST_DTMF_
59 #endif
60 #ifndef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
61 #undef _TEST_RTP_RTCP_
62 #endif
63 #ifndef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
64 #undef _TEST_AUDIO_PROCESSING_
65 #endif
66 #ifndef WEBRTC_VOICE_ENGINE_FILE_API
67 #undef _TEST_FILE_
68 #endif
69 #ifndef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
70 #undef _TEST_VIDEO_SYNC_
71 #endif
72 #ifndef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
73 #undef _TEST_ENCRYPT_
74 #endif
75 #ifndef WEBRTC_VOICE_ENGINE_HARDWARE_API
76 #undef _TEST_HARDWARE_
77 #endif
78 #ifndef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
79 #undef _TEST_XMEDIA_
80 #endif
81 #ifndef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
82 #undef _TEST_NETEQ_STATS_
83 #endif
84 #ifndef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
85 #undef _TEST_CALL_REPORT_
86 #endif
87
88 // Some parts can cause problems while running Insure
89 #ifdef __INSURE__
90 #define _INSTRUMENTATION_TESTING_
91 #endif
92
93 #define MARK() TEST_LOG("."); fflush(NULL);             // Add test marker
94 #define ANL() TEST_LOG("\n")                            // Add New Line
95 #define AOK() TEST_LOG("[Test is OK]"); fflush(NULL);   // Add OK
96 #if defined(_WIN32)
97 #define PAUSE                                      \
98     {                                               \
99         TEST_LOG("Press any key to continue...");   \
100         _getch();                                   \
101         TEST_LOG("\n");                             \
102     }
103 #else
104 #define PAUSE                                          \
105     {                                                   \
106         TEST_LOG("Continuing (pause not supported)\n"); \
107     }
108 #endif
109
110 #define TEST(s)                         \
111     {                                   \
112         TEST_LOG("Testing: %s", #s);    \
113     }                                   \
114
115 #ifdef _INSTRUMENTATION_TESTING_
116 // Don't stop execution if error occurs
117 #define TEST_MUSTPASS(expr)                                               \
118     {                                                                     \
119         if ((expr))                                                       \
120         {                                                                 \
121             TEST_LOG_ERROR("Error at line:%i, %s \n",__LINE__, #expr);    \
122             TEST_LOG_ERROR("Error code: %i\n",voe_base_->LastError());    \
123         }                                                                 \
124     }
125 #define TEST_ERROR(code)                                                \
126     {                                                                   \
127         int err = voe_base_->LastError();                               \
128         if (err != code)                                                \
129         {                                                               \
130             TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n",
131                            code, err, __LINE__);
132 }
133 }
134 #else
135 #define ASSERT_TRUE(expr) TEST_MUSTPASS(!(expr))
136 #define ASSERT_FALSE(expr) TEST_MUSTPASS(expr)
137 #define TEST_MUSTFAIL(expr) TEST_MUSTPASS(!((expr) == -1))
138 #define TEST_MUSTPASS(expr)                                              \
139     {                                                                    \
140         if ((expr))                                                      \
141         {                                                                \
142             TEST_LOG_ERROR("\nError at line:%i, %s \n",__LINE__, #expr); \
143             TEST_LOG_ERROR("Error code: %i\n", voe_base_->LastError());  \
144             PAUSE                                                        \
145             return -1;                                                   \
146         }                                                                \
147     }
148 #define TEST_ERROR(code) \
149     {                                                                                                                                                                    \
150       int err = voe_base_->LastError();                                      \
151       if (err != code)                                                       \
152       {                                                                      \
153         TEST_LOG_ERROR("Invalid error code (%d, should be %d) at line %d\n", \
154                        err, code, __LINE__);                                 \
155         PAUSE                                                                \
156         return -1;                                                           \
157       }                                                                                                                                                          \
158     }
159 #endif  // #ifdef _INSTRUMENTATION_TESTING_
160 #define EXCLUDE()                                                   \
161     {                                                               \
162         TEST_LOG("\n>>> Excluding test at line: %i <<<\n\n",__LINE__);  \
163     }
164
165 #define INCOMPLETE()                                                \
166     {                                                               \
167         TEST_LOG("\n>>> Incomplete test at line: %i <<<\n\n",__LINE__);  \
168     }
169
170 #endif // WEBRTC_VOICE_ENGINE_VOE_TEST_DEFINES_H