1/* 2 * Copyright 2018 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 "components/video_codec/RTCH264ProfileLevelId.h" 12 13#import <XCTest/XCTest.h> 14 15@interface RTCH264ProfileLevelIdTests : XCTestCase 16 17@end 18 19static NSString *level31ConstrainedHigh = @"640c1f"; 20static NSString *level31ConstrainedBaseline = @"42e01f"; 21 22@implementation RTCH264ProfileLevelIdTests 23 24- (void)testInitWithString { 25 RTC_OBJC_TYPE(RTCH264ProfileLevelId) *profileLevelId = 26 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithHexString:level31ConstrainedHigh]; 27 XCTAssertEqual(profileLevelId.profile, RTCH264ProfileConstrainedHigh); 28 XCTAssertEqual(profileLevelId.level, RTCH264Level3_1); 29 30 profileLevelId = 31 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithHexString:level31ConstrainedBaseline]; 32 XCTAssertEqual(profileLevelId.profile, RTCH264ProfileConstrainedBaseline); 33 XCTAssertEqual(profileLevelId.level, RTCH264Level3_1); 34} 35 36- (void)testInitWithProfileAndLevel { 37 RTC_OBJC_TYPE(RTCH264ProfileLevelId) *profileLevelId = 38 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithProfile:RTCH264ProfileConstrainedHigh 39 level:RTCH264Level3_1]; 40 XCTAssertEqualObjects(profileLevelId.hexString, level31ConstrainedHigh); 41 42 profileLevelId = [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] 43 initWithProfile:RTCH264ProfileConstrainedBaseline 44 level:RTCH264Level3_1]; 45 XCTAssertEqualObjects(profileLevelId.hexString, level31ConstrainedBaseline); 46} 47 48@end 49