Remove old about scheme URL constants.
[chromium-blink-merge.git] / media / base / audio_video_metadata_extractor_unittest.cc
blobc55cd5df3b2c1bcee4da9748c188e66dde1ab317
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 "base/logging.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "build/build_config.h"
8 #include "media/base/audio_video_metadata_extractor.h"
9 #include "media/base/test_data_util.h"
10 #include "media/filters/file_data_source.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace media {
15 scoped_ptr<AudioVideoMetadataExtractor> GetExtractor(
16 const std::string& filename,
17 bool expected_result,
18 double expected_duration,
19 int expected_width,
20 int expected_height) {
21 FileDataSource source;
22 EXPECT_TRUE(source.Initialize(GetTestDataFilePath(filename)));
24 scoped_ptr<AudioVideoMetadataExtractor> extractor(
25 new AudioVideoMetadataExtractor);
26 bool extracted = extractor->Extract(&source);
27 EXPECT_EQ(expected_result, extracted);
29 if (!extracted)
30 return extractor.Pass();
32 EXPECT_EQ(expected_duration, extractor->duration());
34 EXPECT_EQ(expected_width, extractor->width());
35 EXPECT_EQ(expected_height, extractor->height());
37 return extractor.Pass();
40 TEST(AudioVideoMetadataExtractorTest, InvalidFile) {
41 GetExtractor("ten_byte_file", false, 0, -1, -1);
44 TEST(AudioVideoMetadataExtractorTest, AudioOGG) {
45 scoped_ptr<AudioVideoMetadataExtractor> extractor =
46 GetExtractor("9ch.ogg", true, 0, -1, -1);
47 EXPECT_EQ("Processed by SoX", extractor->comment());
50 TEST(AudioVideoMetadataExtractorTest, AudioWAV) {
51 scoped_ptr<AudioVideoMetadataExtractor> extractor =
52 GetExtractor("sfx_u8.wav", true, 0, -1, -1);
53 EXPECT_EQ("Lavf54.37.100", extractor->encoder());
54 EXPECT_EQ("Amadeus Pro", extractor->encoded_by());
57 TEST(AudioVideoMetadataExtractorTest, VideoWebM) {
58 scoped_ptr<AudioVideoMetadataExtractor> extractor =
59 GetExtractor("bear-320x240-multitrack.webm", true, 2, 320, 240);
60 EXPECT_EQ("Lavf53.9.0", extractor->encoder());
63 #if defined(USE_PROPRIETARY_CODECS)
64 TEST(AudioVideoMetadataExtractorTest, AudioMP3) {
65 scoped_ptr<AudioVideoMetadataExtractor> extractor =
66 GetExtractor("id3_png_test.mp3", true, 1, -1, -1);
68 EXPECT_EQ("Airbag", extractor->title());
69 EXPECT_EQ("Radiohead", extractor->artist());
70 EXPECT_EQ("OK Computer", extractor->album());
71 EXPECT_EQ(1, extractor->track());
72 EXPECT_EQ("Alternative", extractor->genre());
73 EXPECT_EQ("1997", extractor->date());
74 EXPECT_EQ("Lavf54.4.100", extractor->encoder());
76 #endif
78 } // namespace media