xref: /aosp_15_r20/external/libwebm/webm_parser/tests/cues_parser_test.cc (revision 103e46e4cd4b6efcf6001f23fa8665fb110abf8d)
1 // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS.  All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 #include "src/cues_parser.h"
9 
10 #include "gtest/gtest.h"
11 
12 #include "test_utils/element_parser_test.h"
13 #include "webm/id.h"
14 
15 using webm::CuesParser;
16 using webm::ElementParserTest;
17 using webm::Id;
18 
19 namespace {
20 
21 class CuesParserTest : public ElementParserTest<CuesParser, Id::kCues> {};
22 
TEST_F(CuesParserTest,DefaultValues)23 TEST_F(CuesParserTest, DefaultValues) {
24   ParseAndVerify();
25 
26   SetReaderData({
27       0xBB,  // ID = 0xBB (CuePoint).
28       0x80,  // Size = 0.
29   });
30   ParseAndVerify();
31 }
32 
TEST_F(CuesParserTest,RepeatedValues)33 TEST_F(CuesParserTest, RepeatedValues) {
34   SetReaderData({
35       0xBB,  // ID = 0xBB (CuePoint).
36       0x83,  // Size = 3.
37 
38       0xB3,  //   ID = 0xB3 (CueTime).
39       0x81,  //   Size = 1.
40       0x01,  //   Body (value = 1).
41 
42       0xBB,  // ID = 0xBB (CuePoint).
43       0x83,  // Size = 3.
44 
45       0xB3,  //   ID = 0xB3 (CueTime).
46       0x81,  //   Size = 1.
47       0x02,  //   Body (value = 2).
48   });
49 
50   ParseAndVerify();
51 }
52 
53 }  // namespace
54