Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: media/formats/mpeg/mp3_stream_parser_unittest.cc

Issue 195973006: Allow StreamParsers to request automatic timestampOffset updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ADTS tests. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/common/stream_parser_test_base.h" 5 #include "media/formats/common/stream_parser_test_base.h"
6 #include "media/formats/mpeg/mp3_stream_parser.h" 6 #include "media/formats/mpeg/mp3_stream_parser.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 class MP3StreamParserTest : public StreamParserTestBase, public testing::Test { 11 class MP3StreamParserTest : public StreamParserTestBase, public testing::Test {
12 public: 12 public:
13 MP3StreamParserTest() 13 MP3StreamParserTest()
14 : StreamParserTestBase( 14 : StreamParserTestBase(
15 scoped_ptr<StreamParser>(new MP3StreamParser()).Pass()) {} 15 scoped_ptr<StreamParser>(new MP3StreamParser()).Pass()) {}
16 virtual ~MP3StreamParserTest() {} 16 virtual ~MP3StreamParserTest() {}
17 }; 17 };
18 18
19 // Test parsing with small prime sized chunks to smoke out "power of 19 // Test parsing with small prime sized chunks to smoke out "power of
20 // 2" field size assumptions. 20 // 2" field size assumptions.
21 TEST_F(MP3StreamParserTest, UnalignedAppend) { 21 TEST_F(MP3StreamParserTest, UnalignedAppend) {
22 const std::string expected = 22 const std::string expected =
23 "NewSegment" 23 "NewSegment"
24 "{ 0K }" 24 "{ 0K }"
25 "{ 26K }" 25 "{ 0K }"
26 "{ 52K }" 26 "{ 0K }"
27 "{ 78K }" 27 "{ 0K }"
28 "{ 104K }" 28 "{ 0K }"
29 "{ 130K }" 29 "{ 0K }"
30 "{ 156K }" 30 "{ 0K }"
31 "{ 182K }" 31 "{ 0K }"
32 "EndOfSegment" 32 "EndOfSegment"
33 "NewSegment" 33 "NewSegment"
34 "{ 208K }" 34 "{ 0K }"
35 "{ 235K }" 35 "{ 0K }"
36 "{ 261K }" 36 "{ 0K }"
37 "EndOfSegment" 37 "EndOfSegment"
38 "NewSegment" 38 "NewSegment"
39 "{ 287K }" 39 "{ 0K }"
40 "{ 313K }" 40 "{ 0K }"
41 "EndOfSegment"; 41 "EndOfSegment";
42 EXPECT_EQ(expected, ParseFile("sfx.mp3", 17)); 42 EXPECT_EQ(expected, ParseFile("sfx.mp3", 17));
43 } 43 }
44 44
45 // Test parsing with a larger piece size to verify that multiple buffers 45 // Test parsing with a larger piece size to verify that multiple buffers
46 // are passed to |new_buffer_cb_|. 46 // are passed to |new_buffer_cb_|.
47 TEST_F(MP3StreamParserTest, UnalignedAppend512) { 47 TEST_F(MP3StreamParserTest, UnalignedAppend512) {
48 const std::string expected = 48 const std::string expected =
49 "NewSegment" 49 "NewSegment"
50 "{ 0K }" 50 "{ 0K }"
51 "{ 26K 52K 78K 104K }" 51 "{ 0K 26K 52K 78K }"
52 "EndOfSegment" 52 "EndOfSegment"
53 "NewSegment" 53 "NewSegment"
54 "{ 130K 156K 182K }" 54 "{ 0K 26K 52K }"
55 "{ 208K 235K 261K 287K }" 55 "{ 0K 26K 52K 78K }"
56 "{ 313K }" 56 "{ 0K }"
57 "EndOfSegment"; 57 "EndOfSegment";
58 EXPECT_EQ(expected, ParseFile("sfx.mp3", 512)); 58 EXPECT_EQ(expected, ParseFile("sfx.mp3", 512));
59 } 59 }
60 60
61 } // namespace media 61 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mpeg/adts_stream_parser_unittest.cc ('k') | media/formats/mpeg/mpeg_audio_stream_parser_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698