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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "media/base/audio_video_metadata_extractor.h" | 9 #include "media/base/audio_video_metadata_extractor.h" |
10 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 int expected_height) { | 22 int expected_height) { |
23 FileDataSource source; | 23 FileDataSource source; |
24 EXPECT_TRUE(source.Initialize(GetTestDataFilePath(filename))); | 24 EXPECT_TRUE(source.Initialize(GetTestDataFilePath(filename))); |
25 | 25 |
26 scoped_ptr<AudioVideoMetadataExtractor> extractor( | 26 scoped_ptr<AudioVideoMetadataExtractor> extractor( |
27 new AudioVideoMetadataExtractor); | 27 new AudioVideoMetadataExtractor); |
28 bool extracted = extractor->Extract(&source, extract_attached_images); | 28 bool extracted = extractor->Extract(&source, extract_attached_images); |
29 EXPECT_EQ(expected_result, extracted); | 29 EXPECT_EQ(expected_result, extracted); |
30 | 30 |
31 if (!extracted) | 31 if (!extracted) |
32 return extractor.Pass(); | 32 return extractor; |
33 | 33 |
34 EXPECT_EQ(expected_duration, extractor->duration()); | 34 EXPECT_EQ(expected_duration, extractor->duration()); |
35 | 35 |
36 EXPECT_EQ(expected_width, extractor->width()); | 36 EXPECT_EQ(expected_width, extractor->width()); |
37 EXPECT_EQ(expected_height, extractor->height()); | 37 EXPECT_EQ(expected_height, extractor->height()); |
38 | 38 |
39 return extractor.Pass(); | 39 return extractor; |
40 } | 40 } |
41 | 41 |
42 TEST(AudioVideoMetadataExtractorTest, InvalidFile) { | 42 TEST(AudioVideoMetadataExtractorTest, InvalidFile) { |
43 GetExtractor("ten_byte_file", true, false, 0, -1, -1); | 43 GetExtractor("ten_byte_file", true, false, 0, -1, -1); |
44 } | 44 } |
45 | 45 |
46 TEST(AudioVideoMetadataExtractorTest, AudioOGG) { | 46 TEST(AudioVideoMetadataExtractorTest, AudioOGG) { |
47 scoped_ptr<AudioVideoMetadataExtractor> extractor = | 47 scoped_ptr<AudioVideoMetadataExtractor> extractor = |
48 GetExtractor("9ch.ogg", true, true, 0, -1, -1); | 48 GetExtractor("9ch.ogg", true, true, 0, -1, -1); |
49 EXPECT_EQ("Processed by SoX", extractor->comment()); | 49 EXPECT_EQ("Processed by SoX", extractor->comment()); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 extractor->attached_images_bytes()[0].substr(0, 8)); | 198 extractor->attached_images_bytes()[0].substr(0, 8)); |
199 EXPECT_EQ("IEND\xae\x42\x60\x82", | 199 EXPECT_EQ("IEND\xae\x42\x60\x82", |
200 extractor->attached_images_bytes()[0].substr( | 200 extractor->attached_images_bytes()[0].substr( |
201 extractor->attached_images_bytes()[0].size() - 8, 8)); | 201 extractor->attached_images_bytes()[0].size() - 8, 8)); |
202 EXPECT_EQ("\xF3\xED\x8F\xC7\xC7\x98\xB9V|p\xC0u!\xB5\x82\xCF\x95\xF0\xCD\xCE", | 202 EXPECT_EQ("\xF3\xED\x8F\xC7\xC7\x98\xB9V|p\xC0u!\xB5\x82\xCF\x95\xF0\xCD\xCE", |
203 base::SHA1HashString(extractor->attached_images_bytes()[0])); | 203 base::SHA1HashString(extractor->attached_images_bytes()[0])); |
204 } | 204 } |
205 #endif | 205 #endif |
206 | 206 |
207 } // namespace media | 207 } // namespace media |
OLD | NEW |