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

Unified Diff: media/mp4/box_reader_unittest.cc

Issue 10938034: Eliminate box reordering in media::mp4::BoxReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/mp4/box_reader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/box_reader_unittest.cc
diff --git a/media/mp4/box_reader_unittest.cc b/media/mp4/box_reader_unittest.cc
index da0a0417d527143eaad309920ee12052d14d62f2..38fd896dab69ecd786c74d85915eb2f51ea159a5 100644
--- a/media/mp4/box_reader_unittest.cc
+++ b/media/mp4/box_reader_unittest.cc
@@ -145,7 +145,7 @@ TEST_F(BoxReaderTest, WrongFourCCTest) {
EXPECT_TRUE(err);
}
-TEST_F(BoxReaderTest, ChildrenTest) {
+TEST_F(BoxReaderTest, ScanChildrenTest) {
std::vector<uint8> buf = GetBuf();
bool err;
scoped_ptr<BoxReader> reader(
@@ -160,12 +160,26 @@ TEST_F(BoxReaderTest, ChildrenTest) {
std::vector<PsshBox> kids;
- EXPECT_TRUE(reader->ReadAllChildren(&kids));
+ EXPECT_TRUE(reader->ReadChildren(&kids));
EXPECT_EQ(2u, kids.size());
kids.clear();
EXPECT_FALSE(reader->ReadChildren(&kids));
EXPECT_TRUE(reader->MaybeReadChildren(&kids));
}
+TEST_F(BoxReaderTest, ReadAllChildrenTest) {
+ std::vector<uint8> buf = GetBuf();
+ // Modify buffer to exclude its last 'free' box
+ buf[3] = 0x38;
+ bool err;
+ scoped_ptr<BoxReader> reader(
+ BoxReader::ReadTopLevelBox(&buf[0], buf.size(), &err));
+
+ std::vector<PsshBox> kids;
+ EXPECT_TRUE(reader->SkipBytes(16) && reader->ReadAllChildren(&kids));
+ EXPECT_EQ(2u, kids.size());
+ EXPECT_EQ(kids[0].val, 0xdeadbeef); // Ensure order is preserved
+}
+
} // namespace mp4
} // namespace media
« no previous file with comments | « media/mp4/box_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698