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/seek_head_parser.h"
9
10 #include "gtest/gtest.h"
11
12 #include "test_utils/element_parser_test.h"
13 #include "webm/buffer_reader.h"
14
15 using webm::ElementParserTest;
16 using webm::Id;
17 using webm::SeekHeadParser;
18
19 namespace {
20
21 class SeekHeadParserTest
22 : public ElementParserTest<SeekHeadParser, Id::kSeekHead> {};
23
TEST_F(SeekHeadParserTest,DefaultValues)24 TEST_F(SeekHeadParserTest, DefaultValues) {
25 ParseAndVerify();
26
27 SetReaderData({
28 0x4D, 0xBB, // ID = 0x4DBB (Seek).
29 0x80, // Size = 0.
30 });
31 ParseAndVerify();
32 }
33
TEST_F(SeekHeadParserTest,RepeatedValues)34 TEST_F(SeekHeadParserTest, RepeatedValues) {
35 SetReaderData({
36 0x4D, 0xBB, // ID = 0x4DBB (Seek).
37 0x84, // Size = 4.
38
39 0x53, 0xAC, // ID = 0x53AC (SeekPosition).
40 0x81, // Size = 1.
41 0x01, // Body (value = 1).
42
43 0x4D, 0xBB, // ID = 0x4DBB (Seek).
44 0x84, // Size = 4.
45
46 0x53, 0xAC, // ID = 0x53AC (SeekPosition).
47 0x81, // Size = 1.
48 0x02, // Body (value = 2).
49 });
50
51 ParseAndVerify();
52 }
53
54 } // namespace
55