[M120 Migration][hbbtv] Audio tracks count notification
[platform/framework/web/chromium-efl.git] / media / filters / media_file_checker_unittest.cc
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/filters/media_file_checker.h"
6
7 #include <utility>
8
9 #include "base/files/file.h"
10 #include "build/build_config.h"
11 #include "media/base/test_data_util.h"
12 #include "media/media_buildflags.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace media {
16
17 static void RunMediaFileChecker(const std::string& filename, bool expectation) {
18   base::File file(GetTestDataFilePath(filename),
19                   base::File::FLAG_OPEN | base::File::FLAG_READ);
20   ASSERT_TRUE(file.IsValid());
21
22   MediaFileChecker checker(std::move(file));
23   const base::TimeDelta check_time = base::Milliseconds(100);
24   bool result = checker.Start(check_time);
25   EXPECT_EQ(expectation, result);
26 }
27
28 TEST(MediaFileCheckerTest, InvalidFile) {
29   RunMediaFileChecker("ten_byte_file", false);
30 }
31
32 TEST(MediaFileCheckerTest, Video) {
33   RunMediaFileChecker("bear.ogv", true);
34 }
35
36 TEST(MediaFileCheckerTest, Audio) {
37   RunMediaFileChecker("sfx.ogg", true);
38 }
39
40 TEST(MediaFileCheckerTest, MP3) {
41   RunMediaFileChecker("sfx.mp3", true);
42 }
43
44 }  // namespace media