OLD | NEW |
| (Empty) |
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_AUDIO_DEVICE_AUDIO_DEVICE_TEST_DEFINES_H | |
12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_TEST_DEFINES_H | |
13 | |
14 #include "webrtc/common_types.h" | |
15 #include "webrtc/modules/audio_device/include/audio_device.h" | |
16 | |
17 #ifdef _WIN32 | |
18 #define MACRO_DEFAULT_DEVICE AudioDeviceModule::kDefaultDevice | |
19 #define MACRO_DEFAULT_COMMUNICATION_DEVICE AudioDeviceModule::kDefaultCommunicat
ionDevice | |
20 #else | |
21 #define MACRO_DEFAULT_DEVICE 0 | |
22 #define MACRO_DEFAULT_COMMUNICATION_DEVICE 0 | |
23 #endif | |
24 | |
25 #ifdef ANDROID | |
26 #include <android/log.h> | |
27 #define LOG_TAG "WebRtc ADM TEST" | |
28 #define TEST_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS_
_) | |
29 #define TEST_LOG_ERROR(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA
_ARGS__) | |
30 #else | |
31 #define TEST_LOG printf | |
32 #define TEST_LOG_ERROR(...) fprintf(stderr, __VA_ARGS__) | |
33 #endif | |
34 | |
35 static int warningCount = 0; | |
36 | |
37 #define RESET_TEST \ | |
38 do { \ | |
39 warningCount = 0; \ | |
40 } while(0) \ | |
41 | |
42 #define PRINT_ERR_MSG(msg) \ | |
43 do { \ | |
44 TEST_LOG_ERROR("Error at line %i of %s\n%s", \ | |
45 __LINE__, __FILE__, msg); \ | |
46 } while(0) | |
47 | |
48 #define WARNING(expr) \ | |
49 do { \ | |
50 if (!(expr)) { \ | |
51 TEST_LOG_ERROR("WARNING #%d: at line %i\n\n", \ | |
52 warningCount+1, __LINE__); \ | |
53 warningCount++; \ | |
54 } \ | |
55 } while(0) | |
56 | |
57 #define PRINT_TEST_RESULTS \ | |
58 do { \ | |
59 if (warningCount > 0) \ | |
60 { \ | |
61 TEST_LOG(">> %d warnings <<\n\n", \ | |
62 warningCount); \ | |
63 } \ | |
64 } while(0) | |
65 | |
66 // Helper functions | |
67 // For iPhone, they are defined in iPhone specific test code. | |
68 // For Android, they are defined in API test only (since both | |
69 // API and Func tests are built into the same lib). | |
70 // For other, they are defined in both API test and Func test. | |
71 const char* GetFilename(const char* filename); | |
72 const char* GetResource(const char* resource); | |
73 | |
74 #endif // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_TEST_DEFINES_H | |
OLD | NEW |