Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #import <Foundation/Foundation.h> | |
| 12 #import <XCTest/XCTest.h> | |
| 13 | |
| 14 #import "WebRTC/RTCSessionDescription.h" | |
| 15 | |
| 16 #import "ARDSDPUtils.h" | |
| 17 | |
| 18 @interface ARDSDPUtilsTest : XCTestCase | |
| 19 - (void)testPreferVideoCodecH264; | |
|
daniela-webrtc
2017/02/13 16:08:22
nit: We could probably ditch the declaration of te
kjellander_webrtc
2017/02/14 09:04:10
Fine with me. If they don't provide any value I do
kthelgason
2017/02/14 09:48:46
Done.
| |
| 20 - (void)testPreferVideoCodecVP8; | |
| 21 - (void)testNoMLine; | |
| 22 - (void)testMissingCodec; | |
| 23 @end | |
| 24 | |
| 25 @implementation ARDSDPUtilsTest | |
| 26 | |
| 27 - (void)testPreferVideoCodecH264 { | |
| 28 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" | |
| 29 "a=rtpmap:120 H264/90000\n" | |
| 30 "a=rtpmap:97 H264/90000\n"); | |
| 31 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 97 100 116 117 96\n" | |
| 32 "a=rtpmap:120 H264/90000\n" | |
| 33 "a=rtpmap:97 H264/90000\n"); | |
| 34 [self preferVideoCodec:@"H264" sdp:sdp expected:expectedSdp]; | |
| 35 } | |
| 36 | |
| 37 - (void)testPreferVideoCodecVP8 { | |
| 38 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" | |
| 39 "a=rtpmap:116 VP8/90000\n"); | |
| 40 NSString *expectedSdp = @("m=video 9 RTP/SAVPF 116 100 117 96 120 97\n" | |
| 41 "a=rtpmap:116 VP8/90000\n"); | |
| 42 [self preferVideoCodec:@"VP8" sdp:sdp expected:expectedSdp]; | |
| 43 } | |
| 44 | |
| 45 - (void)testNoMLine { | |
| 46 NSString *sdp = @("a=rtpmap:116 VP8/90000\n"); | |
| 47 [self preferVideoCodec:@"VP8" sdp:sdp expected:sdp]; | |
| 48 } | |
| 49 | |
| 50 - (void)testMissingCodec { | |
| 51 NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n" | |
| 52 "a=rtpmap:116 VP8/90000\n"); | |
| 53 [self preferVideoCodec:@"foo" sdp:sdp expected:sdp]; | |
| 54 } | |
| 55 | |
| 56 #pragma mark - Helpers | |
| 57 | |
| 58 - (void)preferVideoCodec:(NSString *)codec | |
| 59 sdp:(NSString *)sdp | |
| 60 expected:(NSString *)expectedSdp{ | |
| 61 RTCSessionDescription* desc = | |
| 62 [[RTCSessionDescription alloc] initWithType:RTCSdpTypeOffer sdp:sdp]; | |
| 63 RTCSessionDescription *outputDesc = | |
| 64 [ARDSDPUtils descriptionForDescription:desc | |
| 65 preferredVideoCodec:codec]; | |
| 66 XCTAssertTrue([outputDesc.description rangeOfString:expectedSdp].location != N SNotFound); | |
| 67 } | |
| 68 @end | |
| OLD | NEW |