1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/formats/common/stream_parser_test_base.h"
6 #include "media/formats/mpeg/adts_stream_parser.h"
7 #include "testing/gtest/include/gtest/gtest.h"
11 class ADTSStreamParserTest
: public StreamParserTestBase
, public testing::Test
{
13 ADTSStreamParserTest()
14 : StreamParserTestBase(make_scoped_ptr(new ADTSStreamParser())) {}
17 // Test parsing with small prime sized chunks to smoke out "power of
18 // 2" field size assumptions.
19 TEST_F(ADTSStreamParserTest
, UnalignedAppend
) {
20 const std::string expected
=
39 EXPECT_EQ(expected
, ParseFile("sfx.adts", 17));
42 // Test parsing with a larger piece size to verify that multiple buffers
43 // are passed to |new_buffer_cb_|.
44 TEST_F(ADTSStreamParserTest
, UnalignedAppend512
) {
45 const std::string expected
=
48 "{ 0K 23K 46K 69K 92K }"
49 "{ 0K 23K 46K 69K 92K }"
54 EXPECT_EQ(expected
, ParseFile("sfx.adts", 512));