Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: ios/testing/earl_grey/wait_util.mm

Issue 2252723008: Add a custom error message in EG WaitUtil (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@taplink
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/testing/earl_grey/wait_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/testing/earl_grey/wait_util.mm
diff --git a/ios/testing/earl_grey/wait_util.mm b/ios/testing/earl_grey/wait_util.mm
index 962a20a2a00b02647307e8bce3e75cc50d64bb5e..3c4fec45d7a09cf0d530be174ac539a3de2e094c 100644
--- a/ios/testing/earl_grey/wait_util.mm
+++ b/ios/testing/earl_grey/wait_util.mm
@@ -14,14 +14,20 @@ const NSTimeInterval kSpinDelaySeconds = 0.01;
const NSTimeInterval kWaitForJSCompletionTimeout = 2.0;
const NSTimeInterval kWaitForUIElementTimeout = 4.0;
-void WaitUntilCondition(NSTimeInterval timeout, bool (^condition)(void)) {
+void WaitUntilCondition(NSTimeInterval timeout,
+ NSString* timeoutDescription,
+ bool (^condition)(void)) {
NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:timeout];
while (!condition() &&
[[NSDate date] compare:deadline] != NSOrderedDescending) {
base::test::ios::SpinRunLoopWithMaxDelay(
base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds));
}
- GREYAssert(condition(), @"Timeout waiting for condition.");
+ GREYAssert(condition(), timeoutDescription);
+}
+
+void WaitUntilCondition(NSTimeInterval timeout, bool (^condition)(void)) {
+ WaitUntilCondition(timeout, @"Timeout waiting for condition.", condition);
}
} // namespace testing
« no previous file with comments | « ios/testing/earl_grey/wait_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698