Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_AUDIO_UNITTEST_UTIL_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_UNITTEST_UTIL_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_UNITTEST_UTIL_H_ | 6 #define MEDIA_AUDIO_AUDIO_UNITTEST_UTIL_H_ |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace media { | |
| 11 | |
| 12 // Use in tests to either skip or fail a test when the system is missing a | 10 // Use in tests to either skip or fail a test when the system is missing a |
| 13 // required audio device or library. If the --require-audio-hardware-for-testing | 11 // required audio device or library. If the --require-audio-hardware-for-testing |
| 14 // flag is set, missing requirements will cause the test to fail. Otherwise it | 12 // flag is set, missing requirements will cause the test to fail. Otherwise it |
| 15 // will be skipped. | 13 // will be skipped. |
| 16 #define ABORT_AUDIO_TEST_IF_NOT(requirements_satisfied) \ | 14 #define ABORT_AUDIO_TEST_IF_NOT(requirements_satisfied) \ |
| 17 do { \ | 15 do { \ |
| 18 bool fail = false; \ | 16 bool fail = false; \ |
| 19 if (ShouldAbortAudioTest(requirements_satisfied, #requirements_satisfied, \ | 17 if (media::ShouldAbortAudioTest(requirements_satisfied, \ |
| 20 &fail)) { \ | 18 #requirements_satisfied, &fail)) { \ |
| 21 if (fail) \ | 19 if (fail) \ |
| 22 FAIL(); \ | 20 FAIL(); \ |
| 23 else \ | 21 else \ |
| 24 return; \ | 22 return; \ |
| 25 } \ | 23 } \ |
| 26 } while (false) | 24 } while (false) |
| 27 | 25 |
| 26 namespace media { | |
|
jrummell
2017/05/10 18:18:47
nit: Typically namespace statements have a blank l
| |
| 28 bool ShouldAbortAudioTest(bool requirements_satisfied, | 27 bool ShouldAbortAudioTest(bool requirements_satisfied, |
| 29 const char* requirements_expression, | 28 const char* requirements_expression, |
| 30 bool* should_fail); | 29 bool* should_fail); |
| 31 | |
| 32 } // namespace media | 30 } // namespace media |
| 33 | 31 |
| 34 #endif // MEDIA_AUDIO_AUDIO_UNITTEST_UTIL_H_ | 32 #endif // MEDIA_AUDIO_AUDIO_UNITTEST_UTIL_H_ |
| OLD | NEW |