Index: media/mp4/box_reader_unittest.cc |
diff --git a/media/mp4/box_reader_unittest.cc b/media/mp4/box_reader_unittest.cc |
index 4c5fc71106f388170f5b568438cb0ba3f20476ae..b7c1cca2332d530d6cdd33a28e724ec215ec3bca 100644 |
--- a/media/mp4/box_reader_unittest.cc |
+++ b/media/mp4/box_reader_unittest.cc |
@@ -15,18 +15,19 @@ namespace media { |
namespace mp4 { |
static const uint8 kTestBox[] = { |
- // Test box containing three children |
- 0x00, 0x00, 0x00, 0x40, 't', 'e', 's', 't', |
+ // Test box containing three children. The FourCCs used for these boxes were |
+ // chosen arbitrarily. |
acolwell GONE FROM CHROMIUM
2012/08/02 20:38:18
Why did these need to change if they are chosen ar
strobe_
2012/08/02 21:27:50
They didn't, I was just removing the test variable
acolwell GONE FROM CHROMIUM
2012/08/02 21:40:25
Yeah. I think it is best to revert this text since
|
+ 0x00, 0x00, 0x00, 0x40, 's', 'k', 'i', 'p', |
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
0xf9, 0x0a, 0x0b, 0x0c, 0xfd, 0x0e, 0x0f, 0x10, |
- // Ordinary child box |
- 0x00, 0x00, 0x00, 0x0c, 'c', 'h', 'l', 'd', 0xde, 0xad, 0xbe, 0xef, |
- // Extended-size child box |
- 0x00, 0x00, 0x00, 0x01, 'c', 'h', 'l', 'd', |
+ // Ordinary (8-byte header) child box |
+ 0x00, 0x00, 0x00, 0x0c, 'p', 's', 's', 'h', 0xde, 0xad, 0xbe, 0xef, |
+ // Extended-size header child box |
+ 0x00, 0x00, 0x00, 0x01, 'p', 's', 's', 'h', |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, |
0xfa, 0xce, 0xca, 0xfe, |
- // Empty box |
- 0x00, 0x00, 0x00, 0x08, 'm', 'p', 't', 'y', |
+ // Empty free box |
+ 0x00, 0x00, 0x00, 0x08, 'f', 'r', 'e', 'e', |
// Trailing garbage |
0x00 }; |
@@ -34,7 +35,7 @@ struct EmptyBox : Box { |
virtual bool Parse(BoxReader* reader) OVERRIDE { |
return true; |
} |
- virtual FourCC BoxType() const OVERRIDE { return FOURCC_MPTY; } |
+ virtual FourCC BoxType() const OVERRIDE { return FOURCC_FREE; } |
}; |
struct ChildBox : Box { |
@@ -43,7 +44,7 @@ struct ChildBox : Box { |
virtual bool Parse(BoxReader* reader) OVERRIDE { |
return reader->Read4(&val); |
} |
- virtual FourCC BoxType() const OVERRIDE { return FOURCC_CHLD; } |
+ virtual FourCC BoxType() const OVERRIDE { return FOURCC_PSSH; } |
}; |
struct TestBox : Box { |
@@ -66,7 +67,7 @@ struct TestBox : Box { |
reader->ReadChildren(&kids) && |
reader->MaybeReadChild(&mpty); |
} |
- virtual FourCC BoxType() const OVERRIDE { return FOURCC_TEST; } |
+ virtual FourCC BoxType() const OVERRIDE { return FOURCC_SKIP; } |
TestBox(); |
~TestBox(); |
@@ -137,23 +138,12 @@ TEST_F(BoxReaderTest, WrongFourCCTest) { |
std::vector<uint8> buf = GetBuf(); |
bool err; |
- // Use an unknown FourCC both on an outer box and an inner one. |
+ // Set an unrecognized top-level FourCC. |
buf[5] = 1; |
- buf[28] = 1; |
scoped_ptr<BoxReader> reader( |
BoxReader::ReadTopLevelBox(&buf[0], buf.size(), &err)); |
- |
- TestBox box; |
- std::vector<ChildBox> kids; |
- // This should still work; the outer box reader doesn't care about the FourCC, |
- // since it assumes you've already examined it before deciding what to parse. |
- EXPECT_TRUE(box.Parse(reader.get())); |
- EXPECT_EQ(0x74017374, reader->type()); |
- // Parsing the TestBox should have left the modified inner box unread, which |
- // we collect here. |
- EXPECT_TRUE(reader->ReadAllChildren(&kids)); |
- EXPECT_EQ(1u, kids.size()); |
- EXPECT_EQ(0xdeadbeef, kids[0].val); |
+ EXPECT_FALSE(reader.get()); |
+ EXPECT_TRUE(err); |
} |
TEST_F(BoxReaderTest, ChildrenTest) { |