Update V8 to version 4.7.56.
[chromium-blink-merge.git] / media / base / media_file_checker_unittest.cc
blob001fe04694ce1c7b26fe151a46ad102389d41290
1 // Copyright 2013 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/files/file.h"
6 #include "base/logging.h"
7 #include "build/build_config.h"
8 #include "media/base/media_file_checker.h"
9 #include "media/base/test_data_util.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace media {
14 static void RunMediaFileChecker(const std::string& filename, bool expectation) {
15 base::File file(GetTestDataFilePath(filename),
16 base::File::FLAG_OPEN | base::File::FLAG_READ);
17 ASSERT_TRUE(file.IsValid());
19 MediaFileChecker checker(file.Pass());
20 const base::TimeDelta check_time = base::TimeDelta::FromMilliseconds(100);
21 bool result = checker.Start(check_time);
22 EXPECT_EQ(expectation, result);
25 TEST(MediaFileCheckerTest, InvalidFile) {
26 RunMediaFileChecker("ten_byte_file", false);
29 TEST(MediaFileCheckerTest, Video) {
30 RunMediaFileChecker("bear.ogv", true);
33 TEST(MediaFileCheckerTest, Audio) {
34 RunMediaFileChecker("sfx.ogg", true);
37 #if defined(USE_PROPRIETARY_CODECS)
38 TEST(MediaFileCheckerTest, MP3) {
39 RunMediaFileChecker("sfx.mp3", true);
41 #endif
43 } // namespace media