Index: media/audio/audio_unittest_utils.h |
diff --git a/media/audio/audio_unittest_utils.h b/media/audio/audio_unittest_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b5934b5eefcce244871155bd89811e74a7249664 |
--- /dev/null |
+++ b/media/audio/audio_unittest_utils.h |
@@ -0,0 +1,21 @@ |
+#include "testing/gtest/include/gtest/gtest.h" |
DaleCurtis
2015/02/09 22:10:49
Needs license header. #ifdef protections for multi
watk
2015/02/10 01:38:33
Oh jeez, I forgot a lot of stuff. I put it in the
watk
2015/02/10 01:38:33
Done.
|
+ |
+// Use in tests to either skip or fail a test when the system is missing a |
+// required audio device or library. If the |kRequireAudioHardwareForTesting| |
DaleCurtis
2015/02/09 22:10:50
I'd use the actual --flag-name.
watk
2015/02/10 01:38:33
Done.
|
+// flag is set, missing requirements will cause the test to fail. Otherwise it |
+// will be skipped. |
+#define ABORT_AUDIO_TEST_IF_NOT(requirements_satisfied) \ |
+ do { \ |
+ bool fail = false; \ |
+ if (should_abort_audio_test(requirements_satisfied, \ |
+ #requirements_satisfied, &fail)) { \ |
+ if (fail) \ |
+ FAIL(); \ |
+ else \ |
+ return; \ |
+ } \ |
+ } while (false) |
+ |
+bool should_abort_audio_test(bool requirements_satisfied, |
DaleCurtis
2015/02/09 22:10:49
Should be CamelCase method name.
watk
2015/02/10 01:38:33
Done.
|
+ const char* requirements_expression, |
+ bool* should_fail); |