Created
August 30, 2012 05:06
-
-
Save syshen/3522573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -(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