Skip to content

Instantly share code, notes, and snippets.

@syshen
Created August 30, 2012 05:06
Show Gist options
  • Select an option

  • Save syshen/3522573 to your computer and use it in GitHub Desktop.

Select an option

Save syshen/3522573 to your computer and use it in GitHub Desktop.
-(void)setUp {
asyncWaitUntil = [NSDate dateWithTimeIntervalSinceNow:5];
}
-(void)testOpenConnectionSuccess {
__block BOOL complete = NO;
[[WARemoteInterface sharedInterface]
openWebSocketConnectionForUrl:mockWebSocketServer
onSucces:^{
// success
complete = YES;
}
onFailure:^(NSError *error) {
complete = YES;
STFail(@"Websocket connection should be opened successfully.");
}];
while (complete == NO && [asyncWaitUntil timeIntervalSinceNow] > 0) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:asyncWaitUntil];
}
if (complete == NO) {
STFail(@"Websocket connection should be opened on time.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment