Index: ios/web/shell/test/earl_grey/shell_matchers.mm |
diff --git a/ios/web/shell/test/earl_grey/shell_matchers.mm b/ios/web/shell/test/earl_grey/shell_matchers.mm |
index 6763f9ca8235ab10213d3d200ab2ff6769d579e2..91412dcf7f08329bc7956ce3e52c13510dd73ee9 100644 |
--- a/ios/web/shell/test/earl_grey/shell_matchers.mm |
+++ b/ios/web/shell/test/earl_grey/shell_matchers.mm |
@@ -54,16 +54,10 @@ id<GREYMatcher> addressField() { |
return NO; |
} |
UITextField* textField = base::mac::ObjCCastStrict<UITextField>(view); |
- NSDate* deadline = |
- [NSDate dateWithTimeIntervalSinceNow:testing::kWaitForUIElementTimeout]; |
- while ([[NSDate date] compare:deadline] != NSOrderedDescending) { |
- if ([textField.text isEqualToString:base::SysUTF8ToNSString(text)]) { |
- return YES; |
- } |
- base::test::ios::SpinRunLoopWithMaxDelay( |
- base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds)); |
- } |
- return NO; |
+ testing::WaitUntilCondition(testing::kWaitForUIElementTimeout, ^bool() { |
+ return [textField.text isEqualToString:base::SysUTF8ToNSString(text)]; |
+ }); |
+ return YES; |
}; |
DescribeToBlock describe = ^(id<GREYDescription> description) { |