OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #import <Foundation/Foundation.h> | 11 #import <Foundation/Foundation.h> |
12 #import <OCMock/OCMock.h> | 12 #import <OCMock/OCMock.h> |
13 | 13 |
14 #import "ARDAppClient+Internal.h" | 14 #import "ARDAppClient+Internal.h" |
15 #import "ARDJoinResponse+Internal.h" | 15 #import "ARDJoinResponse+Internal.h" |
16 #import "ARDMessageResponse+Internal.h" | 16 #import "ARDMessageResponse+Internal.h" |
17 #import "ARDSDPUtils.h" | 17 #import "ARDSDPUtils.h" |
18 #import "RTCMediaConstraints.h" | 18 #import "webrtc/api/objc/RTCMediaConstraints.h" |
tkchin_webrtc
2016/03/08 19:51:22
ditto import order
hjon_webrtc
2016/03/10 03:32:43
Done.
| |
19 #import "RTCPeerConnectionFactory.h" | 19 #import "webrtc/api/objc/RTCPeerConnectionFactory.h" |
20 #import "RTCSessionDescription.h" | 20 #import "webrtc/api/objc/RTCSessionDescription.h" |
21 | 21 |
22 #include "webrtc/base/gunit.h" | 22 #include "webrtc/base/gunit.h" |
23 #include "webrtc/base/ssladapter.h" | 23 #include "webrtc/base/ssladapter.h" |
24 | 24 |
25 // These classes mimic XCTest APIs, to make eventual conversion to XCTest | 25 // These classes mimic XCTest APIs, to make eventual conversion to XCTest |
26 // easier. Conversion will happen once XCTest is supported well on build bots. | 26 // easier. Conversion will happen once XCTest is supported well on build bots. |
27 @interface ARDTestExpectation : NSObject | 27 @interface ARDTestExpectation : NSObject |
28 | 28 |
29 @property(nonatomic, readonly) NSString *description; | 29 @property(nonatomic, readonly) NSString *description; |
30 @property(nonatomic, readonly) BOOL isFulfilled; | 30 @property(nonatomic, readonly) BOOL isFulfilled; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 messageHandler(message); | 181 messageHandler(message); |
182 }] sendMessage:[OCMArg any]]; | 182 }] sendMessage:[OCMArg any]]; |
183 return mockSignalingChannel; | 183 return mockSignalingChannel; |
184 } | 184 } |
185 | 185 |
186 - (id)mockTURNClient { | 186 - (id)mockTURNClient { |
187 id mockTURNClient = | 187 id mockTURNClient = |
188 [OCMockObject mockForProtocol:@protocol(ARDTURNClient)]; | 188 [OCMockObject mockForProtocol:@protocol(ARDTURNClient)]; |
189 [[[mockTURNClient stub] andDo:^(NSInvocation *invocation) { | 189 [[[mockTURNClient stub] andDo:^(NSInvocation *invocation) { |
190 // Don't return anything in TURN response. | 190 // Don't return anything in TURN response. |
191 __unsafe_unretained void (^completionHandler)(NSArray *turnServers, | 191 __unsafe_unretained void (^completionHandler)(RTCIceServer *turnServer, |
192 NSError *error); | 192 NSError *error); |
193 [invocation getArgument:&completionHandler atIndex:2]; | 193 [invocation getArgument:&completionHandler atIndex:2]; |
194 completionHandler([NSArray array], nil); | 194 completionHandler(nil, nil); |
195 }] requestServersWithCompletionHandler:[OCMArg any]]; | 195 }] requestServerWithCompletionHandler:[OCMArg any]]; |
196 return mockTURNClient; | 196 return mockTURNClient; |
197 } | 197 } |
198 | 198 |
199 - (ARDAppClient *)createAppClientForRoomId:(NSString *)roomId | 199 - (ARDAppClient *)createAppClientForRoomId:(NSString *)roomId |
200 clientId:(NSString *)clientId | 200 clientId:(NSString *)clientId |
201 isInitiator:(BOOL)isInitiator | 201 isInitiator:(BOOL)isInitiator |
202 messages:(NSArray *)messages | 202 messages:(NSArray *)messages |
203 messageHandler: | 203 messageHandler: |
204 (void (^)(ARDSignalingMessage *message))messageHandler | 204 (void (^)(ARDSignalingMessage *message))messageHandler |
205 connectedHandler:(void (^)(void))connectedHandler { | 205 connectedHandler:(void (^)(void))connectedHandler { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 @end | 294 @end |
295 | 295 |
296 @implementation ARDSDPUtilsTest | 296 @implementation ARDSDPUtilsTest |
297 | 297 |
298 - (void)testPreferVideoCodec { | 298 - (void)testPreferVideoCodec { |
299 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120\n" | 299 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120\n" |
300 "a=rtpmap:120 H264/90000\n"); | 300 "a=rtpmap:120 H264/90000\n"); |
301 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 100 116 117 96\n" | 301 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 100 116 117 96\n" |
302 "a=rtpmap:120 H264/90000\n"); | 302 "a=rtpmap:120 H264/90000\n"); |
303 RTCSessionDescription* desc = | 303 RTCSessionDescription* desc = |
304 [[RTCSessionDescription alloc] initWithType:@"offer" sdp:sdp]; | 304 [[RTCSessionDescription alloc] initWithType:RTCSdpTypeOffer sdp:sdp]; |
305 RTCSessionDescription *h264Desc = | 305 RTCSessionDescription *h264Desc = |
306 [ARDSDPUtils descriptionForDescription:desc | 306 [ARDSDPUtils descriptionForDescription:desc |
307 preferredVideoCodec:@"H264"]; | 307 preferredVideoCodec:@"H264"]; |
308 EXPECT_TRUE([h264Desc.description isEqualToString:expectedSdp]); | 308 EXPECT_TRUE([h264Desc.description isEqualToString:expectedSdp]); |
309 } | 309 } |
310 | 310 |
311 @end | 311 @end |
312 | 312 |
313 class SignalingTest : public ::testing::Test { | 313 class SignalingTest : public ::testing::Test { |
314 protected: | 314 protected: |
(...skipping 13 matching lines...) Expand all Loading... | |
328 } | 328 } |
329 | 329 |
330 TEST_F(SignalingTest, SDPTest) { | 330 TEST_F(SignalingTest, SDPTest) { |
331 @autoreleasepool { | 331 @autoreleasepool { |
332 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; | 332 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; |
333 [test testPreferVideoCodec]; | 333 [test testPreferVideoCodec]; |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 | 337 |
OLD | NEW |