Index: media/formats/webm/webm_parser_unittest.cc |
diff --git a/media/formats/webm/webm_parser_unittest.cc b/media/formats/webm/webm_parser_unittest.cc |
index a1249e89c42b7c6a7f2ca0af86248889c3cd2379..26f5f4bbf6e0944c2cb43682cfb37f2729035637 100644 |
--- a/media/formats/webm/webm_parser_unittest.cc |
+++ b/media/formats/webm/webm_parser_unittest.cc |
@@ -25,9 +25,9 @@ class MockWebMParserClient : public WebMParserClient { |
// WebMParserClient methods. |
MOCK_METHOD1(OnListStart, WebMParserClient*(int)); |
MOCK_METHOD1(OnListEnd, bool(int)); |
- MOCK_METHOD2(OnUInt, bool(int, int64)); |
+ MOCK_METHOD2(OnUInt, bool(int, int64_t)); |
MOCK_METHOD2(OnFloat, bool(int, double)); |
- MOCK_METHOD3(OnBinary, bool(int, const uint8*, int)); |
+ MOCK_METHOD3(OnBinary, bool(int, const uint8_t*, int)); |
MOCK_METHOD2(OnString, bool(int, const std::string&)); |
}; |
@@ -41,7 +41,7 @@ static scoped_ptr<Cluster> CreateCluster(int block_count) { |
cb.SetClusterTimecode(0); |
for (int i = 0; i < block_count; i++) { |
- uint8 data[] = { 0x00 }; |
+ uint8_t data[] = {0x00}; |
cb.AddSimpleBlock(0, i, 0, data, sizeof(data)); |
} |
@@ -67,8 +67,8 @@ static void CreateClusterExpectations(int block_count, |
} |
TEST_F(WebMParserTest, EmptyCluster) { |
- const uint8 kEmptyCluster[] = { |
- 0x1F, 0x43, 0xB6, 0x75, 0x80 // CLUSTER (size = 0) |
+ const uint8_t kEmptyCluster[] = { |
+ 0x1F, 0x43, 0xB6, 0x75, 0x80 // CLUSTER (size = 0) |
}; |
int size = sizeof(kEmptyCluster); |
@@ -82,9 +82,9 @@ TEST_F(WebMParserTest, EmptyCluster) { |
} |
TEST_F(WebMParserTest, EmptyClusterInSegment) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x85, // SEGMENT (size = 5) |
- 0x1F, 0x43, 0xB6, 0x75, 0x80, // CLUSTER (size = 0) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x85, // SEGMENT (size = 5) |
+ 0x1F, 0x43, 0xB6, 0x75, 0x80, // CLUSTER (size = 0) |
}; |
int size = sizeof(kBuffer); |
@@ -102,9 +102,9 @@ TEST_F(WebMParserTest, EmptyClusterInSegment) { |
// Test the case where a non-list child element has a size |
// that is beyond the end of the parent. |
TEST_F(WebMParserTest, ChildNonListLargerThanParent) { |
- const uint8 kBuffer[] = { |
- 0x1F, 0x43, 0xB6, 0x75, 0x81, // CLUSTER (size = 1) |
- 0xE7, 0x81, 0x01, // Timecode (size=1, value=1) |
+ const uint8_t kBuffer[] = { |
+ 0x1F, 0x43, 0xB6, 0x75, 0x81, // CLUSTER (size = 1) |
+ 0xE7, 0x81, 0x01, // Timecode (size=1, value=1) |
}; |
InSequence s; |
@@ -118,9 +118,10 @@ TEST_F(WebMParserTest, ChildNonListLargerThanParent) { |
// Test the case where a list child element has a size |
// that is beyond the end of the parent. |
TEST_F(WebMParserTest, ChildListLargerThanParent) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x85, // SEGMENT (size = 5) |
- 0x1F, 0x43, 0xB6, 0x75, 0x81, 0x11 // CLUSTER (size = 1) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x85, // SEGMENT (size = 5) |
+ 0x1F, 0x43, 0xB6, 0x75, 0x81, |
+ 0x11 // CLUSTER (size = 1) |
}; |
InSequence s; |
@@ -133,8 +134,8 @@ TEST_F(WebMParserTest, ChildListLargerThanParent) { |
// Expecting to parse a Cluster, but get a Segment. |
TEST_F(WebMParserTest, ListIdDoesNotMatch) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x80, // SEGMENT (size = 0) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x80, // SEGMENT (size = 0) |
}; |
WebMListParser parser(kWebMIdCluster, &client_); |
@@ -143,9 +144,9 @@ TEST_F(WebMParserTest, ListIdDoesNotMatch) { |
} |
TEST_F(WebMParserTest, InvalidElementInList) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x82, // SEGMENT (size = 2) |
- 0xAE, 0x80, // TrackEntry (size = 0) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x82, // SEGMENT (size = 2) |
+ 0xAE, 0x80, // TrackEntry (size = 0) |
}; |
InSequence s; |
@@ -159,9 +160,9 @@ TEST_F(WebMParserTest, InvalidElementInList) { |
// Test specific case of InvalidElementInList to verify EBMLHEADER within |
// known-sized cluster causes parse error. |
TEST_F(WebMParserTest, InvalidEBMLHeaderInCluster) { |
- const uint8 kBuffer[] = { |
- 0x1F, 0x43, 0xB6, 0x75, 0x85, // CLUSTER (size = 5) |
- 0x1A, 0x45, 0xDF, 0xA3, 0x80, // EBMLHEADER (size = 0) |
+ const uint8_t kBuffer[] = { |
+ 0x1F, 0x43, 0xB6, 0x75, 0x85, // CLUSTER (size = 5) |
+ 0x1A, 0x45, 0xDF, 0xA3, 0x80, // EBMLHEADER (size = 0) |
}; |
InSequence s; |
@@ -174,9 +175,11 @@ TEST_F(WebMParserTest, InvalidEBMLHeaderInCluster) { |
// Verify that EBMLHEADER ends a preceding "unknown"-sized CLUSTER. |
TEST_F(WebMParserTest, UnknownSizeClusterFollowedByEBMLHeader) { |
- const uint8 kBuffer[] = { |
- 0x1F, 0x43, 0xB6, 0x75, 0xFF, // CLUSTER (size = unknown; really 0 due to:) |
- 0x1A, 0x45, 0xDF, 0xA3, 0x80, // EBMLHEADER (size = 0) |
+ const uint8_t kBuffer[] = { |
+ 0x1F, 0x43, 0xB6, |
+ 0x75, 0xFF, // CLUSTER (size = unknown; really 0 due to:) |
+ 0x1A, 0x45, 0xDF, |
+ 0xA3, 0x80, // EBMLHEADER (size = 0) |
}; |
InSequence s; |
@@ -191,13 +194,13 @@ TEST_F(WebMParserTest, UnknownSizeClusterFollowedByEBMLHeader) { |
} |
TEST_F(WebMParserTest, VoidAndCRC32InList) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x99, // SEGMENT (size = 25) |
- 0xEC, 0x83, 0x00, 0x00, 0x00, // Void (size = 3) |
- 0xBF, 0x83, 0x00, 0x00, 0x00, // CRC32 (size = 3) |
- 0x1F, 0x43, 0xB6, 0x75, 0x8A, // CLUSTER (size = 10) |
- 0xEC, 0x83, 0x00, 0x00, 0x00, // Void (size = 3) |
- 0xBF, 0x83, 0x00, 0x00, 0x00, // CRC32 (size = 3) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x99, // SEGMENT (size = 25) |
+ 0xEC, 0x83, 0x00, 0x00, 0x00, // Void (size = 3) |
+ 0xBF, 0x83, 0x00, 0x00, 0x00, // CRC32 (size = 3) |
+ 0x1F, 0x43, 0xB6, 0x75, 0x8A, // CLUSTER (size = 10) |
+ 0xEC, 0x83, 0x00, 0x00, 0x00, // Void (size = 3) |
+ 0xBF, 0x83, 0x00, 0x00, 0x00, // CRC32 (size = 3) |
}; |
int size = sizeof(kBuffer); |
@@ -226,7 +229,7 @@ TEST_F(WebMParserTest, ParseListElementWithMultipleCalls) { |
scoped_ptr<Cluster> cluster(CreateCluster(kBlockCount)); |
CreateClusterExpectations(kBlockCount, true, &client_); |
- const uint8* data = cluster->data(); |
+ const uint8_t* data = cluster->data(); |
int size = cluster->size(); |
int default_parse_size = 3; |
WebMListParser parser(kWebMIdCluster, &client_); |
@@ -283,13 +286,13 @@ TEST_F(WebMParserTest, Reset) { |
// Test the case where multiple clients are used for different lists. |
TEST_F(WebMParserTest, MultipleClients) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x94, // SEGMENT (size = 20) |
- 0x16, 0x54, 0xAE, 0x6B, 0x85, // TRACKS (size = 5) |
- 0xAE, 0x83, // TRACKENTRY (size = 3) |
- 0xD7, 0x81, 0x01, // TRACKNUMBER (size = 1) |
- 0x1F, 0x43, 0xB6, 0x75, 0x85, // CLUSTER (size = 5) |
- 0xEC, 0x83, 0x00, 0x00, 0x00, // Void (size = 3) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x94, // SEGMENT (size = 20) |
+ 0x16, 0x54, 0xAE, 0x6B, 0x85, // TRACKS (size = 5) |
+ 0xAE, 0x83, // TRACKENTRY (size = 3) |
+ 0xD7, 0x81, 0x01, // TRACKNUMBER (size = 1) |
+ 0x1F, 0x43, 0xB6, 0x75, 0x85, // CLUSTER (size = 5) |
+ 0xEC, 0x83, 0x00, 0x00, 0x00, // Void (size = 3) |
}; |
int size = sizeof(kBuffer); |
@@ -315,9 +318,9 @@ TEST_F(WebMParserTest, MultipleClients) { |
// Test the case where multiple clients are used for different lists. |
TEST_F(WebMParserTest, InvalidClient) { |
- const uint8 kBuffer[] = { |
- 0x18, 0x53, 0x80, 0x67, 0x85, // SEGMENT (size = 20) |
- 0x16, 0x54, 0xAE, 0x6B, 0x80, // TRACKS (size = 5) |
+ const uint8_t kBuffer[] = { |
+ 0x18, 0x53, 0x80, 0x67, 0x85, // SEGMENT (size = 20) |
+ 0x16, 0x54, 0xAE, 0x6B, 0x80, // TRACKS (size = 5) |
}; |
InSequence s; |
@@ -329,20 +332,16 @@ TEST_F(WebMParserTest, InvalidClient) { |
} |
TEST_F(WebMParserTest, ReservedIds) { |
- const uint8 k1ByteReservedId[] = { 0xFF, 0x81 }; |
- const uint8 k2ByteReservedId[] = { 0x7F, 0xFF, 0x81 }; |
- const uint8 k3ByteReservedId[] = { 0x3F, 0xFF, 0xFF, 0x81 }; |
- const uint8 k4ByteReservedId[] = { 0x1F, 0xFF, 0xFF, 0xFF, 0x81 }; |
- const uint8* kBuffers[] = { |
- k1ByteReservedId, |
- k2ByteReservedId, |
- k3ByteReservedId, |
- k4ByteReservedId |
- }; |
+ const uint8_t k1ByteReservedId[] = {0xFF, 0x81}; |
+ const uint8_t k2ByteReservedId[] = {0x7F, 0xFF, 0x81}; |
+ const uint8_t k3ByteReservedId[] = {0x3F, 0xFF, 0xFF, 0x81}; |
+ const uint8_t k4ByteReservedId[] = {0x1F, 0xFF, 0xFF, 0xFF, 0x81}; |
+ const uint8_t* kBuffers[] = {k1ByteReservedId, k2ByteReservedId, |
+ k3ByteReservedId, k4ByteReservedId}; |
for (size_t i = 0; i < arraysize(kBuffers); i++) { |
int id; |
- int64 element_size; |
+ int64_t element_size; |
int buffer_size = 2 + i; |
EXPECT_EQ(buffer_size, WebMParseElementHeader(kBuffers[i], buffer_size, |
&id, &element_size)); |
@@ -352,31 +351,25 @@ TEST_F(WebMParserTest, ReservedIds) { |
} |
TEST_F(WebMParserTest, ReservedSizes) { |
- const uint8 k1ByteReservedSize[] = { 0xA3, 0xFF }; |
- const uint8 k2ByteReservedSize[] = { 0xA3, 0x7F, 0xFF }; |
- const uint8 k3ByteReservedSize[] = { 0xA3, 0x3F, 0xFF, 0xFF }; |
- const uint8 k4ByteReservedSize[] = { 0xA3, 0x1F, 0xFF, 0xFF, 0xFF }; |
- const uint8 k5ByteReservedSize[] = { 0xA3, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF }; |
- const uint8 k6ByteReservedSize[] = { 0xA3, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, |
- 0xFF }; |
- const uint8 k7ByteReservedSize[] = { 0xA3, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
- 0xFF }; |
- const uint8 k8ByteReservedSize[] = { 0xA3, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
- 0xFF, 0xFF }; |
- const uint8* kBuffers[] = { |
- k1ByteReservedSize, |
- k2ByteReservedSize, |
- k3ByteReservedSize, |
- k4ByteReservedSize, |
- k5ByteReservedSize, |
- k6ByteReservedSize, |
- k7ByteReservedSize, |
- k8ByteReservedSize |
- }; |
+ const uint8_t k1ByteReservedSize[] = {0xA3, 0xFF}; |
+ const uint8_t k2ByteReservedSize[] = {0xA3, 0x7F, 0xFF}; |
+ const uint8_t k3ByteReservedSize[] = {0xA3, 0x3F, 0xFF, 0xFF}; |
+ const uint8_t k4ByteReservedSize[] = {0xA3, 0x1F, 0xFF, 0xFF, 0xFF}; |
+ const uint8_t k5ByteReservedSize[] = {0xA3, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF}; |
+ const uint8_t k6ByteReservedSize[] = {0xA3, 0x07, 0xFF, 0xFF, |
+ 0xFF, 0xFF, 0xFF}; |
+ const uint8_t k7ByteReservedSize[] = {0xA3, 0x03, 0xFF, 0xFF, |
+ 0xFF, 0xFF, 0xFF, 0xFF}; |
+ const uint8_t k8ByteReservedSize[] = {0xA3, 0x01, 0xFF, 0xFF, 0xFF, |
+ 0xFF, 0xFF, 0xFF, 0xFF}; |
+ const uint8_t* kBuffers[] = {k1ByteReservedSize, k2ByteReservedSize, |
+ k3ByteReservedSize, k4ByteReservedSize, |
+ k5ByteReservedSize, k6ByteReservedSize, |
+ k7ByteReservedSize, k8ByteReservedSize}; |
for (size_t i = 0; i < arraysize(kBuffers); i++) { |
int id; |
- int64 element_size; |
+ int64_t element_size; |
int buffer_size = 2 + i; |
EXPECT_EQ(buffer_size, WebMParseElementHeader(kBuffers[i], buffer_size, |
&id, &element_size)); |
@@ -386,12 +379,13 @@ 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" |
+ const uint8_t 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); |