Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tweak tests to ensure old waitUntilAllOperationsAreFinished behaviour…

… works again
  • Loading branch information...
commit b8f5f3627e6ff13e6827ac2c7afb4473e78d29dd 1 parent 31fe833
@pokeb pokeb authored
View
2  ASIHTTPRequest.h
@@ -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
View
8 ASIHTTPRequest.m
@@ -629,7 +629,7 @@ + (void)setProgress:(double)progress forProgressIndicator:(id)indicator
- (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 @@ - (void)failWithProblem:(NSString *)problem
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 @@ - (void)attemptToApplyCredentialsAndResume
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 @@ - (void)attemptToApplyCredentialsAndResume
// 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];
View
1  ASINetworkQueue.h
@@ -6,7 +6,6 @@
// Copyright 2008 All-Seeing Interactive. All rights reserved.
//
-#import <Cocoa/Cocoa.h>
@interface ASINetworkQueue : NSOperationQueue {
View
15 ASINetworkQueueTests.m
@@ -66,10 +66,7 @@ - (void)testProgress
[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 @@ - (void)testFailure
[networkQueue go];
- NSDate* endDate = [NSDate distantFuture];
- while (!complete) {
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
- }
+ [networkQueue waitUntilAllOperationsAreFinished];
BOOL success;
@@ -190,10 +184,7 @@ - (void)testFailureCancelsOtherRequests
[networkQueue go];
- NSDate* endDate = [NSDate distantFuture];
- while (!complete) {
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
- }
+ [networkQueue waitUntilAllOperationsAreFinished];
[requestThatShouldFail release];
Please sign in to comment.
Something went wrong with that request. Please try again.