disabled_test_macros.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef IOS_TESTING_EARL_GREY_DISABLED_TEST_MACROS_H_
  5. #define IOS_TESTING_EARL_GREY_DISABLED_TEST_MACROS_H_
  6. #import <Foundation/Foundation.h>
  7. // A macro that forces an Earl Grey test to pass. It should be used to disable
  8. // tests that fail due to a bug. This macro should be used when the
  9. // configuration for which the test should be disabled can only be determined
  10. // at runtime. Disabling at compile-time is always preferred.
  11. // Example:
  12. // - (void)testFoo
  13. // if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
  14. // EARL_GREY_TEST_DISABLED(@"Disabled on iPad.");
  15. // }
  16. #define EARL_GREY_TEST_DISABLED(message) \
  17. while (true) { \
  18. NSLog(@"-- Earl Grey Test Disabled -- %@", message); \
  19. return; \
  20. }
  21. // A macro that forces an Earl Grey test to pass. This should be used when a
  22. // test fails for a specific configuration because it is not supported, but
  23. // there is no error. This macro should only be used when the configuration for
  24. // which the test should be disabled can only be determined at runtime.
  25. // Disabling at compile-time is always preferred.
  26. // Example:
  27. // - (void)testFoo
  28. // if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
  29. // EARL_GREY_TEST_SKIPPED(@"Test not supported on iPad.");
  30. // }
  31. #define EARL_GREY_TEST_SKIPPED(message) \
  32. while (true) { \
  33. NSLog(@"-- Earl Grey Test Skipped -- %@", message); \
  34. return; \
  35. }
  36. #endif // IOS_TESTING_EARL_GREY_DISABLED_TEST_MACROS_H_