iOS AppRTC: First unit test.
Tests basic session ICE connection by stubbing out network components, which have been refactored to faciliate testing. BUG=3994 R=jiayl@webrtc.org, kjellander@webrtc.org, phoglund@webrtc.org Review URL: https://webrtc-codereview.appspot.com/28349004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8002 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -27,49 +27,22 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "ARDSignalingMessage.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, ARDWebSocketChannelState) {
|
||||
// State when disconnected.
|
||||
kARDWebSocketChannelStateClosed,
|
||||
// State when connection is established but not ready for use.
|
||||
kARDWebSocketChannelStateOpen,
|
||||
// State when connection is established and registered.
|
||||
kARDWebSocketChannelStateRegistered,
|
||||
// State when connection encounters a fatal error.
|
||||
kARDWebSocketChannelStateError
|
||||
};
|
||||
|
||||
@class ARDWebSocketChannel;
|
||||
@protocol ARDWebSocketChannelDelegate <NSObject>
|
||||
|
||||
- (void)channel:(ARDWebSocketChannel *)channel
|
||||
didChangeState:(ARDWebSocketChannelState)state;
|
||||
|
||||
- (void)channel:(ARDWebSocketChannel *)channel
|
||||
didReceiveMessage:(ARDSignalingMessage *)message;
|
||||
|
||||
@end
|
||||
#import "ARDSignalingChannel.h"
|
||||
|
||||
// Wraps a WebSocket connection to the AppRTC WebSocket server.
|
||||
@interface ARDWebSocketChannel : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *roomId;
|
||||
@property(nonatomic, readonly) NSString *clientId;
|
||||
@property(nonatomic, readonly) ARDWebSocketChannelState state;
|
||||
@property(nonatomic, weak) id<ARDWebSocketChannelDelegate> delegate;
|
||||
@interface ARDWebSocketChannel : NSObject <ARDSignalingChannel>
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url
|
||||
restURL:(NSURL *)restURL
|
||||
delegate:(id<ARDWebSocketChannelDelegate>)delegate;
|
||||
delegate:(id<ARDSignalingChannelDelegate>)delegate;
|
||||
|
||||
// Registers with the WebSocket server for the given room and client id once
|
||||
// the web socket connection is open.
|
||||
- (void)registerForRoomId:(NSString *)roomId
|
||||
clientId:(NSString *)clientId;
|
||||
|
||||
// Sends data over the WebSocket connection if registered, otherwise POSTs to
|
||||
// Sends message over the WebSocket connection if registered, otherwise POSTs to
|
||||
// the web socket server instead.
|
||||
- (void)sendData:(NSData *)data;
|
||||
- (void)sendMessage:(ARDSignalingMessage *)message;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user