OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" | 5 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "media/base/test_data_util.h" | 12 #include "media/base/test_data_util.h" |
13 #include "media/formats/common/stream_parser_test_base.h" | 13 #include "media/formats/common/stream_parser_test_base.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 class MPEG1AudioStreamParserTest | 18 class MPEG1AudioStreamParserTest |
19 : public StreamParserTestBase, public testing::Test { | 19 : public StreamParserTestBase, public testing::Test { |
20 public: | 20 public: |
21 MPEG1AudioStreamParserTest() | 21 MPEG1AudioStreamParserTest() |
22 : StreamParserTestBase(base::WrapUnique(new MPEG1AudioStreamParser())) {} | 22 : StreamParserTestBase(base::MakeUnique<MPEG1AudioStreamParser>()) {} |
23 }; | 23 }; |
24 | 24 |
25 // Test parsing with small prime sized chunks to smoke out "power of | 25 // Test parsing with small prime sized chunks to smoke out "power of |
26 // 2" field size assumptions. | 26 // 2" field size assumptions. |
27 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend) { | 27 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend) { |
28 const std::string expected = | 28 const std::string expected = |
29 "NewSegment" | 29 "NewSegment" |
30 "{ 0K }" | 30 "{ 0K }" |
31 "{ 0K }" | 31 "{ 0K }" |
32 "{ 0K }" | 32 "{ 0K }" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 buffer_ptr += kXingRemainingSize; | 91 buffer_ptr += kXingRemainingSize; |
92 | 92 |
93 // Append the first real frame and ensure we get a segment. | 93 // Append the first real frame and ensure we get a segment. |
94 const int kFirstRealFrameSize = 182; | 94 const int kFirstRealFrameSize = 182; |
95 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", | 95 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", |
96 ParseData(buffer_ptr, kFirstRealFrameSize)); | 96 ParseData(buffer_ptr, kFirstRealFrameSize)); |
97 EXPECT_TRUE(last_audio_config().IsValidConfig()); | 97 EXPECT_TRUE(last_audio_config().IsValidConfig()); |
98 } | 98 } |
99 | 99 |
100 } // namespace media | 100 } // namespace media |
OLD | NEW |