Ensure pending scheduled callbacks have executed in "run" APIs

This commit is contained in:
Pierre-Olivier Latour
2014-04-29 22:12:28 -07:00
parent 75e6332500
commit 1b12a7bd14

View File

@@ -678,6 +678,11 @@ static inline NSString* _EncodeBase64(NSString* string) {
[self stop];
success = YES;
}
while (1) {
if (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, true) == kCFRunLoopRunTimedOut) { // Ensure pending scheduled callbacks have been executed
break;
}
}
signal(SIGINT, intHandler);
signal(SIGTERM, termHandler);
}
@@ -966,6 +971,7 @@ static void _LogResult(NSString* format, ...) {
}
- (NSInteger)runTestsWithOptions:(NSDictionary*)options inDirectory:(NSString*)path {
DCHECK([NSThread isMainThread]);
NSArray* ignoredHeaders = @[@"Date", @"Etag"]; // Dates are always different by definition and ETags depend on file system node IDs
NSInteger result = -1;
if ([self startWithOptions:options error:NULL]) {
@@ -1069,6 +1075,12 @@ static void _LogResult(NSString* format, ...) {
}
[self stop];
while (1) {
if (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, true) == kCFRunLoopRunTimedOut) { // Ensure pending scheduled callbacks have been executed
break;
}
}
}
return result;
}