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/chapters_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::ChaptersParser;
16 using webm::ElementParserTest;
17 using webm::Id;
18
19 namespace {
20
21 class ChaptersParserTest
22 : public ElementParserTest<ChaptersParser, Id::kChapters> {};
23
TEST_F(ChaptersParserTest,DefaultValues)24 TEST_F(ChaptersParserTest, DefaultValues) {
25 ParseAndVerify();
26
27 SetReaderData({
28 0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
29 0x80, // Size = 0.
30 });
31 ParseAndVerify();
32 }
33
TEST_F(ChaptersParserTest,RepeatedValues)34 TEST_F(ChaptersParserTest, RepeatedValues) {
35 SetReaderData({
36 0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
37 0x84, // Size = 4.
38
39 0x45, 0xBC, // ID = 0x45BC (EditionUID).
40 0x81, // Size = 1.
41 0x01, // Body (value = 1).
42
43 0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
44 0x84, // Size = 4.
45
46 0x45, 0xBC, // ID = 0x45BC (EditionUID).
47 0x81, // Size = 1.
48 0x02, // Body (value = 2).
49 });
50
51 ParseAndVerify();
52 }
53
54 } // namespace
55