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

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

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

Powered by Google App Engine
This is Rietveld 408576698