Commit d674e7bc authored by baxley's avatar baxley Committed by Commit bot

Add macro for consistent logging when disabling tests.

There are two macros, one for disabled tests and ones where a test
is skipped (e.g. unsupported platform, rather than a bug).

BUG=635935

Review-Url: https://codereview.chromium.org/2224313003
Cr-Commit-Position: refs/heads/master@{#410860}
parent ee7821cd
...@@ -16,6 +16,7 @@ source_set("earl_grey_support") { ...@@ -16,6 +16,7 @@ source_set("earl_grey_support") {
] ]
sources = [ sources = [
"disabled_test_macros.h",
"wait_util.h", "wait_util.h",
"wait_util.mm", "wait_util.mm",
] ]
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_TESTING_EARL_GREY_DISABLED_TEST_MACROS_H_
#define IOS_TESTING_EARL_GREY_DISABLED_TEST_MACROS_H_
// A macro that forces an Earl Grey test to pass. It should be used to disable
// tests that fail due to a bug. This macro should be used when the
// configuration for which the test should be disabled can only be determined
// at runtime. Disabling at compile-time is always preferred.
// Example:
// - (void)testFoo
// if (base::ios::IsRunningOnIOS10OrLater()) {
// EARL_GREY_TEST_DISABLED(@"Disabled on iOS 10.");
// }
#define EARL_GREY_TEST_DISABLED(message) \
while (true) { \
NSLog(@"-- Earl Grey Test Disabled -- %@", message); \
return; \
}
// A macro that forces an Earl Grey test to pass. This should be used when a
// test fails for a specific configuration because it is not supported, but
// there is no error. This macro should only be used when the configuration for
// which the test should be disabled can only be determined at runtime.
// Disabling at compile-time is always preferred.
// Example:
// - (void)testFoo
// if (base::ios::IsRunningOnIOS10OrLater()) {
// EARL_GREY_TEST_SKIPPED(@"Test not supported on iOS 10.");
// }
#define EARL_GREY_TEST_SKIPPED(message) \
while (true) { \
NSLog(@"-- Earl Grey Test Skipped -- %@", message); \
return; \
}
#endif // IOS_TESTING_EARL_GREY_DISABLED_TEST_MACROS_H_
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
'<(DEPTH)/ios/third_party/earl_grey/earl_grey.gyp:EarlGrey', '<(DEPTH)/ios/third_party/earl_grey/earl_grey.gyp:EarlGrey',
], ],
'sources': [ 'sources': [
'disabled_test_macros.h',
'wait_util.h', 'wait_util.h',
'wait_util.mm', 'wait_util.mm',
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment