| 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" |
| 6 |
| 5 #include <stdint.h> | 7 #include <stdint.h> |
| 6 | 8 |
| 9 #include <memory> |
| 10 |
| 11 #include "base/memory/ptr_util.h" |
| 7 #include "media/base/test_data_util.h" | 12 #include "media/base/test_data_util.h" |
| 8 #include "media/formats/common/stream_parser_test_base.h" | 13 #include "media/formats/common/stream_parser_test_base.h" |
| 9 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 15 |
| 12 namespace media { | 16 namespace media { |
| 13 | 17 |
| 14 class MPEG1AudioStreamParserTest | 18 class MPEG1AudioStreamParserTest |
| 15 : public StreamParserTestBase, public testing::Test { | 19 : public StreamParserTestBase, public testing::Test { |
| 16 public: | 20 public: |
| 17 MPEG1AudioStreamParserTest() | 21 MPEG1AudioStreamParserTest() |
| 18 : StreamParserTestBase(make_scoped_ptr(new MPEG1AudioStreamParser())) {} | 22 : StreamParserTestBase(base::WrapUnique(new MPEG1AudioStreamParser())) {} |
| 19 }; | 23 }; |
| 20 | 24 |
| 21 // 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 |
| 22 // 2" field size assumptions. | 26 // 2" field size assumptions. |
| 23 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend) { | 27 TEST_F(MPEG1AudioStreamParserTest, UnalignedAppend) { |
| 24 const std::string expected = | 28 const std::string expected = |
| 25 "NewSegment" | 29 "NewSegment" |
| 26 "{ 0K }" | 30 "{ 0K }" |
| 27 "{ 0K }" | 31 "{ 0K }" |
| 28 "{ 0K }" | 32 "{ 0K }" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 buffer_ptr += kXingRemainingSize; | 91 buffer_ptr += kXingRemainingSize; |
| 88 | 92 |
| 89 // Append the first real frame and ensure we get a segment. | 93 // Append the first real frame and ensure we get a segment. |
| 90 const int kFirstRealFrameSize = 182; | 94 const int kFirstRealFrameSize = 182; |
| 91 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", | 95 EXPECT_EQ("NewSegment{ 0K }EndOfSegment", |
| 92 ParseData(buffer_ptr, kFirstRealFrameSize)); | 96 ParseData(buffer_ptr, kFirstRealFrameSize)); |
| 93 EXPECT_TRUE(last_audio_config().IsValidConfig()); | 97 EXPECT_TRUE(last_audio_config().IsValidConfig()); |
| 94 } | 98 } |
| 95 | 99 |
| 96 } // namespace media | 100 } // namespace media |
| OLD | NEW |