Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: webrtc/common_video/h264/profile_level_id_unittest.cc

Issue 2477923002: Add more tests for H264 profile level id parsing (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/common_video/h264/profile_level_id.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 TEST(H264ProfileLevelId, TestParsingConstrainedHigh) { 69 TEST(H264ProfileLevelId, TestParsingConstrainedHigh) {
70 EXPECT_EQ(kProfileConstrainedHigh, ParseProfileLevelId("640c1f")->profile); 70 EXPECT_EQ(kProfileConstrainedHigh, ParseProfileLevelId("640c1f")->profile);
71 } 71 }
72 72
73 TEST(H264ProfileLevelId, TestToString) { 73 TEST(H264ProfileLevelId, TestToString) {
74 EXPECT_EQ("42e01f", *ProfileLevelIdToString(ProfileLevelId( 74 EXPECT_EQ("42e01f", *ProfileLevelIdToString(ProfileLevelId(
75 kProfileConstrainedBaseline, kLevel3_1))); 75 kProfileConstrainedBaseline, kLevel3_1)));
76 EXPECT_EQ("42000a", 76 EXPECT_EQ("42000a",
77 *ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1))); 77 *ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1)));
78 EXPECT_EQ("4D001f", 78 EXPECT_EQ("4d001f",
79 ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1))); 79 ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1)));
80 EXPECT_EQ("640c2a", *ProfileLevelIdToString( 80 EXPECT_EQ("640c2a", *ProfileLevelIdToString(
81 ProfileLevelId(kProfileConstrainedHigh, kLevel4_2))); 81 ProfileLevelId(kProfileConstrainedHigh, kLevel4_2)));
82 EXPECT_EQ("64002a", 82 EXPECT_EQ("64002a",
83 *ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel4_2))); 83 *ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel4_2)));
84 } 84 }
85 85
86 TEST(H264ProfileLevelId, TestToStringLevel1b) { 86 TEST(H264ProfileLevelId, TestToStringLevel1b) {
87 EXPECT_EQ("42f00b", *ProfileLevelIdToString(ProfileLevelId( 87 EXPECT_EQ("42f00b", *ProfileLevelIdToString(ProfileLevelId(
88 kProfileConstrainedBaseline, kLevel1_b))); 88 kProfileConstrainedBaseline, kLevel1_b)));
89 EXPECT_EQ("42100b", *ProfileLevelIdToString( 89 EXPECT_EQ("42100b", *ProfileLevelIdToString(
90 ProfileLevelId(kProfileBaseline, kLevel1_b))); 90 ProfileLevelId(kProfileBaseline, kLevel1_b)));
91 EXPECT_EQ("4D100b", 91 EXPECT_EQ("4d100b",
92 *ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel1_b))); 92 *ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel1_b)));
93 } 93 }
94 94
95 TEST(H264ProfileLevelId, TestToStringRoundTrip) {
96 EXPECT_EQ("42e01f", *ProfileLevelIdToString(*ParseProfileLevelId("42e01f")));
97 EXPECT_EQ("42e01f", *ProfileLevelIdToString(*ParseProfileLevelId("42E01F")));
98 EXPECT_EQ("4d100b", *ProfileLevelIdToString(*ParseProfileLevelId("4d100b")));
99 EXPECT_EQ("4d100b", *ProfileLevelIdToString(*ParseProfileLevelId("4D100B")));
100 EXPECT_EQ("640c2a", *ProfileLevelIdToString(*ParseProfileLevelId("640c2a")));
101 EXPECT_EQ("640c2a", *ProfileLevelIdToString(*ParseProfileLevelId("640C2A")));
102 }
103
95 TEST(H264ProfileLevelId, TestToStringInvalid) { 104 TEST(H264ProfileLevelId, TestToStringInvalid) {
96 EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b))); 105 EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b)));
97 EXPECT_FALSE(ProfileLevelIdToString( 106 EXPECT_FALSE(ProfileLevelIdToString(
98 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b))); 107 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b)));
99 EXPECT_FALSE(ProfileLevelIdToString( 108 EXPECT_FALSE(ProfileLevelIdToString(
100 ProfileLevelId(static_cast<Profile>(255), kLevel3_1))); 109 ProfileLevelId(static_cast<Profile>(255), kLevel3_1)));
101 } 110 }
102 111
103 } // namespace H264 112 } // namespace H264
104 } // namespace webrtc 113 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/h264/profile_level_id.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698