| 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 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 [self waitForExpectationsWithTimeout:20 handler:^(NSError *error) { | 347 [self waitForExpectationsWithTimeout:20 handler:^(NSError *error) { |
| 348 if (error) { | 348 if (error) { |
| 349 EXPECT_TRUE(0); | 349 EXPECT_TRUE(0); |
| 350 } | 350 } |
| 351 }]; | 351 }]; |
| 352 } | 352 } |
| 353 | 353 |
| 354 @end | 354 @end |
| 355 | 355 |
| 356 @interface ARDSDPUtilsTest : ARDTestCase | 356 @interface ARDSDPUtilsTest : ARDTestCase |
| 357 - (void)testPreferVideoCodec; | 357 - (void)testPreferVideoCodec:(NSString *)codec |
| 358 sdp:(NSString *)sdp |
| 359 expectedSdp:(NSString *)expectedSdp; |
| 358 @end | 360 @end |
| 359 | 361 |
| 360 @implementation ARDSDPUtilsTest | 362 @implementation ARDSDPUtilsTest |
| 361 | 363 |
| 362 - (void)testPreferVideoCodec { | 364 - (void)testPreferVideoCodec:(NSString *)codec |
| 363 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120\n" | 365 sdp:(NSString *)sdp |
| 364 "a=rtpmap:120 H264/90000\n"); | 366 expectedSdp:(NSString *)expectedSdp { |
| 365 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 100 116 117 96\n" | |
| 366 "a=rtpmap:120 H264/90000\n"); | |
| 367 RTCSessionDescription* desc = | 367 RTCSessionDescription* desc = |
| 368 [[RTCSessionDescription alloc] initWithType:RTCSdpTypeOffer sdp:sdp]; | 368 [[RTCSessionDescription alloc] initWithType:RTCSdpTypeOffer sdp:sdp]; |
| 369 RTCSessionDescription *h264Desc = | 369 RTCSessionDescription *outputDesc = |
| 370 [ARDSDPUtils descriptionForDescription:desc | 370 [ARDSDPUtils descriptionForDescription:desc |
| 371 preferredVideoCodec:@"H264"]; | 371 preferredVideoCodec:codec]; |
| 372 EXPECT_TRUE([h264Desc.description rangeOfString:expectedSdp].location != NSNot
Found); | 372 EXPECT_TRUE([outputDesc.description rangeOfString:expectedSdp].location != |
| 373 NSNotFound); |
| 373 } | 374 } |
| 374 | 375 |
| 375 @end | 376 @end |
| 376 | 377 |
| 377 class SignalingTest : public ::testing::Test { | 378 class SignalingTest : public ::testing::Test { |
| 378 protected: | 379 protected: |
| 379 static void SetUpTestCase() { | 380 static void SetUpTestCase() { |
| 380 rtc::InitializeSSL(); | 381 rtc::InitializeSSL(); |
| 381 } | 382 } |
| 382 static void TearDownTestCase() { | 383 static void TearDownTestCase() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 394 #if !TARGET_IPHONE_SIMULATOR | 395 #if !TARGET_IPHONE_SIMULATOR |
| 395 // Expected fail on iOS Simulator due to no camera support | 396 // Expected fail on iOS Simulator due to no camera support |
| 396 TEST_F(SignalingTest, SessionLocalVideoCallbackTest) { | 397 TEST_F(SignalingTest, SessionLocalVideoCallbackTest) { |
| 397 @autoreleasepool { | 398 @autoreleasepool { |
| 398 ARDAppClientTest *test = [[ARDAppClientTest alloc] init]; | 399 ARDAppClientTest *test = [[ARDAppClientTest alloc] init]; |
| 399 [test testSessionShouldGetLocalVideoTrackCallback]; | 400 [test testSessionShouldGetLocalVideoTrackCallback]; |
| 400 } | 401 } |
| 401 } | 402 } |
| 402 #endif | 403 #endif |
| 403 | 404 |
| 404 TEST_F(SignalingTest, SDPTest) { | 405 TEST_F(SignalingTest, SdpH264Test) { |
| 405 @autoreleasepool { | 406 @autoreleasepool { |
| 406 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; | 407 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; |
| 407 [test testPreferVideoCodec]; | 408 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" |
| 409 "a=rtpmap:120 H264/90000\n" |
| 410 "a=rtpmap:97 H264/90000\n"); |
| 411 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 97 100 116 117 96\n" |
| 412 "a=rtpmap:120 H264/90000\n" |
| 413 "a=rtpmap:97 H264/90000\n"); |
| 414 [test testPreferVideoCodec:@"H264" |
| 415 sdp:sdp |
| 416 expectedSdp:expectedSdp]; |
| 408 } | 417 } |
| 409 } | 418 } |
| 410 | 419 |
| 420 TEST_F(SignalingTest, SdpVp8Test) { |
| 421 @autoreleasepool { |
| 422 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; |
| 423 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" |
| 424 "a=rtpmap:116 VP8/90000\n"); |
| 425 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 116 100 117 96 120 97\n" |
| 426 "a=rtpmap:116 VP8/90000\n"); |
| 427 [test testPreferVideoCodec:@"VP8" |
| 428 sdp:sdp |
| 429 expectedSdp:expectedSdp]; |
| 430 } |
| 431 } |
| 432 |
| 433 TEST_F(SignalingTest, SdpNoMLineTest) { |
| 434 @autoreleasepool { |
| 435 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; |
| 436 NSString *sdp = @("a=rtpmap:116 VP8/90000\n"); |
| 437 [test testPreferVideoCodec:@"VP8" |
| 438 sdp:sdp |
| 439 expectedSdp:sdp]; |
| 440 } |
| 441 } |
| 442 |
| 443 TEST_F(SignalingTest, SdpMissingCodecTest) { |
| 444 @autoreleasepool { |
| 445 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; |
| 446 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" |
| 447 "a=rtpmap:116 VP8/90000\n"); |
| 448 [test testPreferVideoCodec:@"foo" |
| 449 sdp:sdp |
| 450 expectedSdp:sdp]; |
| 451 } |
| 452 } |
| 453 |
| 411 int main(int argc, char **argv) { | 454 int main(int argc, char **argv) { |
| 412 ::testing::InitGoogleTest(&argc, argv); | 455 ::testing::InitGoogleTest(&argc, argv); |
| 413 return RUN_ALL_TESTS(); | 456 return RUN_ALL_TESTS(); |
| 414 } | 457 } |
| OLD | NEW |