Ben Copsey

Tweak tests to ensure old waitUntilAllOperationsAreFinished behaviour works again

... ... @@ -10,8 +10,6 @@
// Portions are based on the ImageClient example from Apple:
// See: http://developer.apple.com/samplecode/ImageClient/listing37.html
#import <Cocoa/Cocoa.h>
@interface ASIHTTPRequest : NSOperation {
//The url for this operation, should include GET params in the query string where appropriate
... ...
... ... @@ -629,7 +629,7 @@ static NSRecursiveLock *progressLock;
- (void)requestFinished
{
if (didFinishSelector && ![self isCancelled] && [delegate respondsToSelector:didFinishSelector]) {
[delegate performSelectorOnMainThread:didFinishSelector withObject:self waitUntilDone:YES];
[delegate performSelectorOnMainThread:didFinishSelector withObject:self waitUntilDone:[NSThread isMainThread]];
}
}
... ... @@ -648,7 +648,7 @@ static NSRecursiveLock *progressLock;
NSLog(problem);
if (didFailSelector && ![self isCancelled] && [delegate respondsToSelector:didFailSelector]) {
[delegate performSelectorOnMainThread:didFailSelector withObject:self waitUntilDone:YES];
[delegate performSelectorOnMainThread:didFailSelector withObject:self waitUntilDone:[NSThread isMainThread]];
}
}
}
... ... @@ -823,7 +823,7 @@ static NSRecursiveLock *progressLock;
ignoreError = YES;
[self setLastActivityTime:nil];
if ([delegate respondsToSelector:@selector(authorizationNeededForRequest:)]) {
[delegate performSelectorOnMainThread:@selector(authorizationNeededForRequest:) withObject:self waitUntilDone:YES];
[delegate performSelectorOnMainThread:@selector(authorizationNeededForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
[authenticationLock lockWhenCondition:2];
[authenticationLock unlock];
... ... @@ -865,7 +865,7 @@ static NSRecursiveLock *progressLock;
// We've got no credentials, let's ask the delegate to sort this out
ignoreError = YES;
if ([delegate respondsToSelector:@selector(authorizationNeededForRequest:)]) {
[delegate performSelectorOnMainThread:@selector(authorizationNeededForRequest:) withObject:self waitUntilDone:YES];
[delegate performSelectorOnMainThread:@selector(authorizationNeededForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
[authenticationLock lockWhenCondition:2];
[authenticationLock unlock];
[self attemptToApplyCredentialsAndResume];
... ...
... ... @@ -6,7 +6,6 @@
// Copyright 2008 All-Seeing Interactive. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface ASINetworkQueue : NSOperationQueue {
... ...
... ... @@ -66,10 +66,7 @@
[networkQueue go];
endDate = [NSDate distantFuture];
while (!complete) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
}
[networkQueue waitUntilAllOperationsAreFinished];
success = (progress == 1.0);
STAssertTrue(success,@"Failed to increment progress properly");
... ... @@ -121,10 +118,7 @@
[networkQueue go];
NSDate* endDate = [NSDate distantFuture];
while (!complete) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
}
[networkQueue waitUntilAllOperationsAreFinished];
BOOL success;
... ... @@ -190,10 +184,7 @@
[networkQueue go];
NSDate* endDate = [NSDate distantFuture];
while (!complete) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
}
[networkQueue waitUntilAllOperationsAreFinished];
[requestThatShouldFail release];
... ...