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

Side by Side Diff: media/base/media_file_checker_unittest.cc

Issue 20572004: Add media file validation to utility process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude test when source is excluded Created 7 years, 4 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
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "base/logging.h"
6 #include "build/build_config.h"
7 #include "media/base/media_file_checker.h"
8 #include "media/base/test_data_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace media {
12
13 namespace {
vandebo (ex-Chrome) 2013/08/09 04:26:14 Also killed this namespace.
14
15 const base::TimeDelta check_time = base::TimeDelta::FromMilliseconds(100);
DaleCurtis 2013/08/09 00:58:04 Move inside function to avoid potential static ini
vandebo (ex-Chrome) 2013/08/09 04:26:14 Done.
16
17 void RunMediaFileChecker(const std::string& filename, bool expectation) {
18 base::PlatformFileError error;
19 base::PlatformFile file = base::CreatePlatformFile(
20 GetTestDataFilePath(filename),
21 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
22 NULL,
23 &error);
24 ASSERT_EQ(base::PLATFORM_FILE_OK, error);
25
26 MediaFileChecker checker(file);
27 bool result = checker.Start(check_time);
28 EXPECT_EQ(expectation, result);
29
30 base::ClosePlatformFile(file);
31 }
32
33 } // namespace
34
35 TEST(MediaFileCheckerTest, InvalidFile) {
36 RunMediaFileChecker("ten_byte_file", false);
37 }
38
39 TEST(MediaFileCheckerTest, Video) {
40 RunMediaFileChecker("bear.ogv", true);
41 }
42
43 TEST(MediaFileCheckerTest, Audio) {
44 RunMediaFileChecker("sfx.ogg", true);
45 }
46
47 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
48 TEST(MediaFileCheckerTest, MP3) {
49 RunMediaFileChecker("sfx.mp3", true);
50 }
51 #endif
52
53 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698