Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / media / formats / mpeg / adts_stream_parser_unittest.cc
blob27b5e4f2edb8c5f0dedc833548ddb9f9a7a5cbb6
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"
9 namespace media {
11 class ADTSStreamParserTest : public StreamParserTestBase, public testing::Test {
12 public:
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 =
21 "NewSegment"
22 "{ 0K }"
23 "{ 0K }"
24 "{ 0K }"
25 "{ 0K }"
26 "{ 0K }"
27 "{ 0K }"
28 "{ 0K }"
29 "{ 0K }"
30 "{ 0K }"
31 "EndOfSegment"
32 "NewSegment"
33 "{ 0K }"
34 "{ 0K }"
35 "{ 0K }"
36 "{ 0K }"
37 "{ 0K }"
38 "EndOfSegment";
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 =
46 "NewSegment"
47 "{ 0K 23K 46K }"
48 "{ 0K 23K 46K 69K 92K }"
49 "{ 0K 23K 46K 69K 92K }"
50 "EndOfSegment"
51 "NewSegment"
52 "{ 0K }"
53 "EndOfSegment";
54 EXPECT_EQ(expected, ParseFile("sfx.adts", 512));
57 } // namespace media