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

Side by Side Diff: ios/testing/earl_grey/wait_util.mm

Issue 2275843003: Add support for webViewContainingBlockedImage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Conform to c style guide 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 unified diff | Download patch
« no previous file with comments | « ios/testing/earl_grey/wait_util.h ('k') | ios/web/public/test/earl_grey/web_view_matchers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/testing/earl_grey/wait_util.h" 5 #include "ios/testing/earl_grey/wait_util.h"
6 6
7 #import <EarlGrey/EarlGrey.h> 7 #import <EarlGrey/EarlGrey.h>
8 8
9 #include "base/test/ios/wait_util.h" 9 #include "base/test/ios/wait_util.h"
10 10
11 namespace testing { 11 namespace testing {
12 12
13 const NSTimeInterval kSpinDelaySeconds = 0.01; 13 const NSTimeInterval kSpinDelaySeconds = 0.01;
14 const NSTimeInterval kWaitForJSCompletionTimeout = 2.0; 14 const NSTimeInterval kWaitForJSCompletionTimeout = 2.0;
15 const NSTimeInterval kWaitForUIElementTimeout = 4.0; 15 const NSTimeInterval kWaitForUIElementTimeout = 4.0;
16 const NSTimeInterval kWaitForDownloadTimeout = 10.0;
16 17
17 void WaitUntilCondition(NSTimeInterval timeout, 18 void WaitUntilCondition(NSTimeInterval timeout,
18 NSString* timeoutDescription, 19 NSString* timeoutDescription,
19 bool (^condition)(void)) { 20 bool (^condition)(void)) {
20 NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:timeout]; 21 NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:timeout];
21 while (!condition() && 22 while (!condition() &&
22 [[NSDate date] compare:deadline] != NSOrderedDescending) { 23 [[NSDate date] compare:deadline] != NSOrderedDescending) {
23 base::test::ios::SpinRunLoopWithMaxDelay( 24 base::test::ios::SpinRunLoopWithMaxDelay(
24 base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds)); 25 base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds));
25 } 26 }
26 GREYAssert(condition(), timeoutDescription); 27 GREYAssert(condition(), timeoutDescription);
27 } 28 }
28 29
29 void WaitUntilCondition(NSTimeInterval timeout, bool (^condition)(void)) { 30 void WaitUntilCondition(NSTimeInterval timeout, bool (^condition)(void)) {
30 WaitUntilCondition(timeout, @"Timeout waiting for condition.", condition); 31 WaitUntilCondition(timeout, @"Timeout waiting for condition.", condition);
31 } 32 }
32 33
33 } // namespace testing 34 } // namespace testing
OLDNEW
« no previous file with comments | « ios/testing/earl_grey/wait_util.h ('k') | ios/web/public/test/earl_grey/web_view_matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698