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

Side by Side Diff: media/formats/mp4/es_descriptor_unittest.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/mp4/es_descriptor.h" 5 #include "media/formats/mp4/es_descriptor.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 namespace mp4 { 11 namespace mp4 {
12 12
13 TEST(ESDescriptorTest, SingleByteLengthTest) { 13 TEST(ESDescriptorTest, SingleByteLengthTest) {
14 ESDescriptor es_desc; 14 ESDescriptor es_desc;
15 uint8 buffer[] = { 15 uint8_t buffer[] = {0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x40, 0x15,
16 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x40, 16 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 17 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, 0x06, 0x01, 0x02};
18 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, 18 std::vector<uint8_t> data;
19 0x06, 0x01, 0x02
20 };
21 std::vector<uint8> data;
22 19
23 data.assign(buffer, buffer + sizeof(buffer)); 20 data.assign(buffer, buffer + sizeof(buffer));
24 21
25 EXPECT_EQ(es_desc.object_type(), kForbidden); 22 EXPECT_EQ(es_desc.object_type(), kForbidden);
26 EXPECT_TRUE(es_desc.Parse(data)); 23 EXPECT_TRUE(es_desc.Parse(data));
27 EXPECT_EQ(es_desc.object_type(), kISO_14496_3); 24 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
28 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u); 25 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
29 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12); 26 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
30 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10); 27 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
31 } 28 }
32 29
33 TEST(ESDescriptorTest, NonAACTest) { 30 TEST(ESDescriptorTest, NonAACTest) {
34 ESDescriptor es_desc; 31 ESDescriptor es_desc;
35 uint8 buffer[] = { 32 uint8_t buffer[] = {0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x66, 0x15,
36 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x66, 33 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, 0x06, 0x01, 0x02};
38 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10, 35 std::vector<uint8_t> data;
39 0x06, 0x01, 0x02
40 };
41 std::vector<uint8> data;
42 36
43 data.assign(buffer, buffer + sizeof(buffer)); 37 data.assign(buffer, buffer + sizeof(buffer));
44 38
45 EXPECT_TRUE(es_desc.Parse(data)); 39 EXPECT_TRUE(es_desc.Parse(data));
46 EXPECT_NE(es_desc.object_type(), kISO_14496_3); 40 EXPECT_NE(es_desc.object_type(), kISO_14496_3);
47 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u); 41 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
48 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12); 42 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
49 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10); 43 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
50 } 44 }
51 45
52 TEST(ESDescriptorTest, MultiByteLengthTest) { 46 TEST(ESDescriptorTest, MultiByteLengthTest) {
53 ESDescriptor es_desc; 47 ESDescriptor es_desc;
54 uint8 buffer[] = { 48 uint8_t buffer[] = {0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, 0x80,
55 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, 49 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 50 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x80, 0x80,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 51 0x02, 0x12, 0x10, 0x06, 0x01, 0x02};
58 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06, 0x01, 52 std::vector<uint8_t> data;
59 0x02
60 };
61 std::vector<uint8> data;
62 53
63 data.assign(buffer, buffer + sizeof(buffer)); 54 data.assign(buffer, buffer + sizeof(buffer));
64 55
65 EXPECT_TRUE(es_desc.Parse(data)); 56 EXPECT_TRUE(es_desc.Parse(data));
66 EXPECT_EQ(es_desc.object_type(), kISO_14496_3); 57 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
67 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u); 58 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
68 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12); 59 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
69 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10); 60 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
70 } 61 }
71 62
72 TEST(ESDescriptorTest, FiveByteLengthTest) { 63 TEST(ESDescriptorTest, FiveByteLengthTest) {
73 ESDescriptor es_desc; 64 ESDescriptor es_desc;
74 uint8 buffer[] = { 65 uint8_t buffer[] = {0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, 0x80,
75 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80, 66 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 67 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x80, 0x80,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 68 0x80, 0x02, 0x12, 0x10, 0x06, 0x01, 0x02};
78 0x80, 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06, 69 std::vector<uint8_t> data;
79 0x01, 0x02
80 };
81 std::vector<uint8> data;
82 70
83 data.assign(buffer, buffer + sizeof(buffer)); 71 data.assign(buffer, buffer + sizeof(buffer));
84 72
85 EXPECT_TRUE(es_desc.Parse(data)); 73 EXPECT_TRUE(es_desc.Parse(data));
86 EXPECT_EQ(es_desc.object_type(), kISO_14496_3); 74 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
87 EXPECT_EQ(es_desc.decoder_specific_info().size(), 0u); 75 EXPECT_EQ(es_desc.decoder_specific_info().size(), 0u);
88 } 76 }
89 77
90 } // namespace mp4 78 } // namespace mp4
91 79
92 } // namespace media 80 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698