OLD | NEW |
---|---|
(Empty) | |
1 #include "base/command_line.h" | |
2 #include "base/logging.h" | |
3 #include "media/base/media_switches.h" | |
4 #include "testing/gtest/include/gtest/gtest.h" | |
5 | |
6 // Use in tests to either skip or fail a test when the system is missing a | |
7 // required audio device or library. If the |kRequireAudioHardwareForTesting| | |
8 // flag is set, missing requirements will cause the test to fail. Otherwise it | |
9 // will be skipped. | |
10 #define CAN_RUN_AUDIO_TEST_IF(requirements_satisfied) \ | |
DaleCurtis
2015/02/09 21:21:31
Hmm, naming feels odd. What about something like:
watk
2015/02/09 22:03:57
Much better, thanks
| |
11 do { \ | |
12 bool satisfied = requirements_satisfied; \ | |
DaleCurtis
2015/02/09 21:21:31
Most of this should be moved into a static functio
watk
2015/02/09 22:03:57
Done.
| |
13 bool fail_if_unsatisfied = \ | |
14 base::CommandLine::ForCurrentProcess()->HasSwitch( \ | |
15 switches::kRequireAudioHardwareForTesting); \ | |
16 const char* message = \ | |
17 "Requirement(s) not satisfied (" #requirements_satisfied ")"; \ | |
18 if (fail_if_unsatisfied && !satisfied) { \ | |
19 FAIL() << message; \ | |
20 } \ | |
21 if (!satisfied) { \ | |
22 LOG(WARNING) << "Skipping test: " << message; \ | |
23 return; \ | |
24 } \ | |
25 } while (false) | |
OLD | NEW |