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

Unified Diff: media/webm/webm_parser_unittest.cc

Issue 14299005: Add support for zero-padded strings to WebMParser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac build Created 7 years, 8 months 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 | « media/webm/webm_parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/webm_parser_unittest.cc
diff --git a/media/webm/webm_parser_unittest.cc b/media/webm/webm_parser_unittest.cc
index 4c140a6f6a78fbab01f6c88af3357449b565db13..43ad3c2b80e0dbc5d405f8cc741e507c7b3d682e 100644
--- a/media/webm/webm_parser_unittest.cc
+++ b/media/webm/webm_parser_unittest.cc
@@ -367,4 +367,29 @@ TEST_F(WebMParserTest, ReservedSizes) {
}
}
+TEST_F(WebMParserTest, ZeroPaddedStrings) {
+ const uint8 kBuffer[] = {
+ 0x1A, 0x45, 0xDF, 0xA3, 0x91, // EBMLHEADER (size = 17)
+ 0x42, 0x82, 0x80, // DocType (size = 0)
+ 0x42, 0x82, 0x81, 0x00, // DocType (size = 1) ""
+ 0x42, 0x82, 0x81, 'a', // DocType (size = 1) "a"
+ 0x42, 0x82, 0x83, 'a', 0x00, 0x00 // DocType (size = 3) "a"
+ };
+ int size = sizeof(kBuffer);
+
+ InSequence s;
+ EXPECT_CALL(client_, OnListStart(kWebMIdEBMLHeader))
+ .WillOnce(Return(&client_));
+ EXPECT_CALL(client_, OnString(kWebMIdDocType, "")).WillOnce(Return(true));
+ EXPECT_CALL(client_, OnString(kWebMIdDocType, "")).WillOnce(Return(true));
+ EXPECT_CALL(client_, OnString(kWebMIdDocType, "a")).WillOnce(Return(true));
+ EXPECT_CALL(client_, OnString(kWebMIdDocType, "a")).WillOnce(Return(true));
+ EXPECT_CALL(client_, OnListEnd(kWebMIdEBMLHeader)).WillOnce(Return(true));
+
+ WebMListParser parser(kWebMIdEBMLHeader, &client_);
+ int result = parser.Parse(kBuffer, size);
+ EXPECT_EQ(size, result);
+ EXPECT_TRUE(parser.IsParsingComplete());
+}
+
} // namespace media
« no previous file with comments | « media/webm/webm_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698