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

Unified 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: Final nits 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/media_file_checker.cc ('k') | media/filters/file_data_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_file_checker_unittest.cc
diff --git a/media/base/media_file_checker_unittest.cc b/media/base/media_file_checker_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..54decffd55f9f11db5bdc44194a3ee6d8e4901d0
--- /dev/null
+++ b/media/base/media_file_checker_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+#include "build/build_config.h"
+#include "media/base/media_file_checker.h"
+#include "media/base/test_data_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+static void RunMediaFileChecker(const std::string& filename, bool expectation) {
+ base::PlatformFileError error;
+ base::PlatformFile file = base::CreatePlatformFile(
+ GetTestDataFilePath(filename),
+ base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
+ NULL,
+ &error);
+ ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+
+ MediaFileChecker checker(file);
+ const base::TimeDelta check_time = base::TimeDelta::FromMilliseconds(100);
+ bool result = checker.Start(check_time);
+ EXPECT_EQ(expectation, result);
+
+ base::ClosePlatformFile(file);
+}
+
+TEST(MediaFileCheckerTest, InvalidFile) {
+ RunMediaFileChecker("ten_byte_file", false);
+}
+
+TEST(MediaFileCheckerTest, Video) {
+ RunMediaFileChecker("bear.ogv", true);
+}
+
+TEST(MediaFileCheckerTest, Audio) {
+ RunMediaFileChecker("sfx.ogg", true);
+}
+
+#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
+TEST(MediaFileCheckerTest, MP3) {
+ RunMediaFileChecker("sfx.mp3", true);
+}
+#endif
+
+} // namespace media
« no previous file with comments | « media/base/media_file_checker.cc ('k') | media/filters/file_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698