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