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/tracks_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::TracksParser;
18 
19 namespace {
20 
21 class TracksParserTest : public ElementParserTest<TracksParser, Id::kTracks> {};
22 
23 // TODO(mjbshaw): validate results via Callback.
24 
TEST_F(TracksParserTest,DefaultValues)25 TEST_F(TracksParserTest, DefaultValues) {
26   ParseAndVerify();
27 
28   SetReaderData({
29       0xAE,  // ID = 0xAE (TrackEntry).
30       0x80,  // Size = 0.
31   });
32   ParseAndVerify();
33 }
34 
TEST_F(TracksParserTest,RepeatedValues)35 TEST_F(TracksParserTest, RepeatedValues) {
36   SetReaderData({
37       0xAE,  // ID = 0xAE (TrackEntry).
38       0x83,  // Size = 3.
39 
40       0xD7,  //   ID = 0xD7 (TrackNumber).
41       0x81,  //   Size = 1.
42       0x01,  //   Body (value = 1).
43 
44       0xAE,  // ID = 0xAE (TrackEntry).
45       0x83,  // Size = 3.
46 
47       0xD7,  //   ID = 0xD7 (TrackNumber).
48       0x81,  //   Size = 1.
49       0x02,  //   Body (value = 2).
50   });
51 
52   ParseAndVerify();
53 }
54 
55 }  // namespace
56