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

Unified Diff: webrtc/common_video/h264/profile_level_id_unittest.cc

Issue 2472693002: Add to-string function for H264 profile level id (Closed)
Patch Set: Return rtc::Optional and remove default ctor 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_video/h264/profile_level_id.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/h264/profile_level_id_unittest.cc
diff --git a/webrtc/common_video/h264/profile_level_id_unittest.cc b/webrtc/common_video/h264/profile_level_id_unittest.cc
index 772f5b038ec757637a7d1f630d26b47b4f8f7e75..8bc50689d98479ae7566318939df1ffd34029b1c 100644
--- a/webrtc/common_video/h264/profile_level_id_unittest.cc
+++ b/webrtc/common_video/h264/profile_level_id_unittest.cc
@@ -15,7 +15,7 @@
namespace webrtc {
namespace H264 {
-TEST(H264ProfileLevelIdParsing, TestInvalid) {
+TEST(H264ProfileLevelId, TestParsingInvalid) {
// Malformed strings.
EXPECT_FALSE(ParseProfileLevelId(""));
EXPECT_FALSE(ParseProfileLevelId(" 42e01f"));
@@ -34,7 +34,7 @@ TEST(H264ProfileLevelIdParsing, TestInvalid) {
EXPECT_FALSE(ParseProfileLevelId("64e01f"));
}
-TEST(H264ProfileLevelIdParsing, TestLevel) {
+TEST(H264ProfileLevelId, TestParsingLevel) {
EXPECT_EQ(kLevel3_1, ParseProfileLevelId("42e01f")->level);
EXPECT_EQ(kLevel1_1, ParseProfileLevelId("42e00b")->level);
EXPECT_EQ(kLevel1_b, ParseProfileLevelId("42f00b")->level);
@@ -42,7 +42,7 @@ TEST(H264ProfileLevelIdParsing, TestLevel) {
EXPECT_EQ(kLevel5_2, ParseProfileLevelId("640c34")->level);
}
-TEST(H264ProfileLevelIdParsing, TestConstrainedBaseline) {
+TEST(H264ProfileLevelId, TestParsingConstrainedBaseline) {
EXPECT_EQ(kProfileConstrainedBaseline,
ParseProfileLevelId("42e01f")->profile);
EXPECT_EQ(kProfileConstrainedBaseline,
@@ -53,22 +53,52 @@ TEST(H264ProfileLevelIdParsing, TestConstrainedBaseline) {
ParseProfileLevelId("58f01f")->profile);
}
-TEST(H264ProfileLevelIdParsing, TestBaseline) {
+TEST(H264ProfileLevelId, TestParsingBaseline) {
EXPECT_EQ(kProfileBaseline, ParseProfileLevelId("42a01f")->profile);
EXPECT_EQ(kProfileBaseline, ParseProfileLevelId("58A01F")->profile);
}
-TEST(H264ProfileLevelIdParsing, TestMain) {
+TEST(H264ProfileLevelId, TestParsingMain) {
EXPECT_EQ(kProfileMain, ParseProfileLevelId("4D401f")->profile);
}
-TEST(H264ProfileLevelIdParsing, TestHigh) {
+TEST(H264ProfileLevelId, TestParsingHigh) {
EXPECT_EQ(kProfileHigh, ParseProfileLevelId("64001f")->profile);
}
-TEST(H264ProfileLevelIdParsing, TestConstrainedHigh) {
+TEST(H264ProfileLevelId, TestParsingConstrainedHigh) {
EXPECT_EQ(kProfileConstrainedHigh, ParseProfileLevelId("640c1f")->profile);
}
+TEST(H264ProfileLevelId, TestToString) {
+ EXPECT_EQ("42e01f", *ProfileLevelIdToString(ProfileLevelId(
+ kProfileConstrainedBaseline, kLevel3_1)));
+ EXPECT_EQ("42000a",
+ *ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1)));
+ EXPECT_EQ("4D001f",
+ ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1)));
+ EXPECT_EQ("640c2a", *ProfileLevelIdToString(
+ ProfileLevelId(kProfileConstrainedHigh, kLevel4_2)));
+ EXPECT_EQ("64002a",
+ *ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel4_2)));
+}
+
+TEST(H264ProfileLevelId, TestToStringLevel1b) {
+ EXPECT_EQ("42f00b", *ProfileLevelIdToString(ProfileLevelId(
+ kProfileConstrainedBaseline, kLevel1_b)));
+ EXPECT_EQ("42100b", *ProfileLevelIdToString(
+ ProfileLevelId(kProfileBaseline, kLevel1_b)));
+ EXPECT_EQ("4D100b",
+ *ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel1_b)));
+}
+
+TEST(H264ProfileLevelId, TestToStringInvalid) {
+ EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b)));
+ EXPECT_FALSE(ProfileLevelIdToString(
+ ProfileLevelId(kProfileConstrainedHigh, kLevel1_b)));
+ EXPECT_FALSE(ProfileLevelIdToString(
+ ProfileLevelId(static_cast<Profile>(255), kLevel3_1)));
hta-webrtc 2016/11/03 13:23:06 Can you also add some round-trip tests? ie EXPEC
+}
+
} // namespace H264
} // namespace webrtc
« 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