Temporarily remove DCHECK that triggers during hardware teardown.
[chromium-blink-merge.git] / media / formats / mp4 / es_descriptor_unittest.cc
blob6334f5bd1c54a7a264c7662004df7eccbeadd4f0
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/formats/mp4/es_descriptor.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace media {
11 namespace mp4 {
13 TEST(ESDescriptorTest, SingleByteLengthTest) {
14 ESDescriptor es_desc;
15 uint8 buffer[] = {
16 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x40,
17 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10,
19 0x06, 0x01, 0x02
21 std::vector<uint8> data;
23 data.assign(buffer, buffer + sizeof(buffer));
25 EXPECT_EQ(es_desc.object_type(), kForbidden);
26 EXPECT_TRUE(es_desc.Parse(data));
27 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
28 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
29 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
30 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
33 TEST(ESDescriptorTest, NonAACTest) {
34 ESDescriptor es_desc;
35 uint8 buffer[] = {
36 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x66,
37 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10,
39 0x06, 0x01, 0x02
41 std::vector<uint8> data;
43 data.assign(buffer, buffer + sizeof(buffer));
45 EXPECT_TRUE(es_desc.Parse(data));
46 EXPECT_NE(es_desc.object_type(), kISO_14496_3);
47 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
48 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
49 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
52 TEST(ESDescriptorTest, MultiByteLengthTest) {
53 ESDescriptor es_desc;
54 uint8 buffer[] = {
55 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80,
56 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
58 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06, 0x01,
59 0x02
61 std::vector<uint8> data;
63 data.assign(buffer, buffer + sizeof(buffer));
65 EXPECT_TRUE(es_desc.Parse(data));
66 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
67 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
68 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
69 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
72 TEST(ESDescriptorTest, FiveByteLengthTest) {
73 ESDescriptor es_desc;
74 uint8 buffer[] = {
75 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80,
76 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
78 0x80, 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06,
79 0x01, 0x02
81 std::vector<uint8> data;
83 data.assign(buffer, buffer + sizeof(buffer));
85 EXPECT_TRUE(es_desc.Parse(data));
86 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
87 EXPECT_EQ(es_desc.decoder_specific_info().size(), 0u);
90 } // namespace mp4
92 } // namespace media