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

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

Issue 2608733002: Fix include/import in ios/testing and ios/chrome/test (Closed)
Patch Set: Created 3 years, 11 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/wait_util.h ('k') | no next file » | 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 #import "ios/testing/wait_util.h" 5 #import "ios/testing/wait_util.h"
6 6
7 #include "base/test/ios/wait_util.h" 7 #import "base/test/ios/wait_util.h"
8 8
9 #if !defined(__has_feature) || !__has_feature(objc_arc) 9 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support." 10 #error "This file requires ARC support."
11 #endif 11 #endif
12 12
13 namespace testing { 13 namespace testing {
14 14
15 const NSTimeInterval kSpinDelaySeconds = 0.01; 15 const NSTimeInterval kSpinDelaySeconds = 0.01;
16 const NSTimeInterval kWaitForJSCompletionTimeout = 2.0; 16 const NSTimeInterval kWaitForJSCompletionTimeout = 2.0;
17 const NSTimeInterval kWaitForUIElementTimeout = 4.0; 17 const NSTimeInterval kWaitForUIElementTimeout = 4.0;
18 const NSTimeInterval kWaitForDownloadTimeout = 10.0; 18 const NSTimeInterval kWaitForDownloadTimeout = 10.0;
19 const NSTimeInterval kWaitForPageLoadTimeout = 10.0; 19 const NSTimeInterval kWaitForPageLoadTimeout = 10.0;
20 20
21 bool WaitUntilConditionOrTimeout(NSTimeInterval timeout, 21 bool WaitUntilConditionOrTimeout(NSTimeInterval timeout,
22 ConditionBlock condition) { 22 ConditionBlock condition) {
23 NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:timeout]; 23 NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:timeout];
24 bool success = condition(); 24 bool success = condition();
25 while (!success && [[NSDate date] compare:deadline] != NSOrderedDescending) { 25 while (!success && [[NSDate date] compare:deadline] != NSOrderedDescending) {
26 base::test::ios::SpinRunLoopWithMaxDelay( 26 base::test::ios::SpinRunLoopWithMaxDelay(
27 base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds)); 27 base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds));
28 success = condition(); 28 success = condition();
29 } 29 }
30 return success; 30 return success;
31 } 31 }
32 32
33 } // namespace testing 33 } // namespace testing
OLDNEW
« no previous file with comments | « ios/testing/wait_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698