Chromium Code Reviews| 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 *h264Desc = |
|
denicija-google
2016/11/22 15:05:30
Now that the test is more generic, perhaps this sh
magjed_webrtc
2016/11/22 15:14:28
Thanks, missed that.
| |
| 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([h264Desc.description rangeOfString:expectedSdp].location != NSNot Found); |
| 373 } | 373 } |
| 374 | 374 |
| 375 @end | 375 @end |
| 376 | 376 |
| 377 class SignalingTest : public ::testing::Test { | 377 class SignalingTest : public ::testing::Test { |
| 378 protected: | 378 protected: |
| 379 static void SetUpTestCase() { | 379 static void SetUpTestCase() { |
| 380 rtc::InitializeSSL(); | 380 rtc::InitializeSSL(); |
| 381 } | 381 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 394 #if !TARGET_IPHONE_SIMULATOR | 394 #if !TARGET_IPHONE_SIMULATOR |
| 395 // Expected fail on iOS Simulator due to no camera support | 395 // Expected fail on iOS Simulator due to no camera support |
| 396 TEST_F(SignalingTest, SessionLocalVideoCallbackTest) { | 396 TEST_F(SignalingTest, SessionLocalVideoCallbackTest) { |
| 397 @autoreleasepool { | 397 @autoreleasepool { |
| 398 ARDAppClientTest *test = [[ARDAppClientTest alloc] init]; | 398 ARDAppClientTest *test = [[ARDAppClientTest alloc] init]; |
| 399 [test testSessionShouldGetLocalVideoTrackCallback]; | 399 [test testSessionShouldGetLocalVideoTrackCallback]; |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 #endif | 402 #endif |
| 403 | 403 |
| 404 TEST_F(SignalingTest, SDPTest) { | 404 TEST_F(SignalingTest, SdpH264Test) { |
| 405 @autoreleasepool { | 405 @autoreleasepool { |
| 406 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; | 406 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; |
| 407 [test testPreferVideoCodec]; | 407 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" |
| 408 "a=rtpmap:120 H264/90000\n" | |
| 409 "a=rtpmap:97 H264/90000\n"); | |
| 410 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 97 100 116 117 96\n" | |
| 411 "a=rtpmap:120 H264/90000\n" | |
| 412 "a=rtpmap:97 H264/90000\n"); | |
| 413 [test testPreferVideoCodec:@"H264" | |
| 414 sdp:sdp | |
| 415 expectedSdp:expectedSdp]; | |
| 408 } | 416 } |
| 409 } | 417 } |
| 410 | 418 |
| 419 TEST_F(SignalingTest, SdpVp8Test) { | |
| 420 @autoreleasepool { | |
| 421 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; | |
| 422 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" | |
| 423 "a=rtpmap:116 VP8/90000\n"); | |
| 424 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 116 100 117 96 120 97\n" | |
| 425 "a=rtpmap:116 VP8/90000\n"); | |
| 426 [test testPreferVideoCodec:@"VP8" | |
| 427 sdp:sdp | |
| 428 expectedSdp:expectedSdp]; | |
| 429 } | |
| 430 } | |
| 431 | |
| 432 TEST_F(SignalingTest, SdpNoMLineTest) { | |
| 433 @autoreleasepool { | |
| 434 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; | |
| 435 NSString *sdp = @("a=rtpmap:116 VP8/90000\n"); | |
| 436 [test testPreferVideoCodec:@"VP8" | |
| 437 sdp:sdp | |
| 438 expectedSdp:sdp]; | |
| 439 } | |
| 440 } | |
| 441 | |
| 442 TEST_F(SignalingTest, SdpMissingCodecTest) { | |
| 443 @autoreleasepool { | |
| 444 ARDSDPUtilsTest *test = [[ARDSDPUtilsTest alloc] init]; | |
| 445 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" | |
| 446 "a=rtpmap:116 VP8/90000\n"); | |
| 447 [test testPreferVideoCodec:@"foo" | |
| 448 sdp:sdp | |
| 449 expectedSdp:sdp]; | |
| 450 } | |
| 451 } | |
| 452 | |
| 411 int main(int argc, char **argv) { | 453 int main(int argc, char **argv) { |
| 412 ::testing::InitGoogleTest(&argc, argv); | 454 ::testing::InitGoogleTest(&argc, argv); |
| 413 return RUN_ALL_TESTS(); | 455 return RUN_ALL_TESTS(); |
| 414 } | 456 } |
| OLD | NEW |