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

Unified Diff: testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc

Issue 1757603002: media: Add media pipeline fuzzer test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 4 years, 10 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
« testing/libfuzzer/fuzzers/BUILD.gn ('K') | « testing/libfuzzer/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc
diff --git a/testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc b/testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7a891eefae9248c50fea7f9b3957d081a181af9e
--- /dev/null
+++ b/testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
xhwang 2016/03/02 00:57:04 What's the recommendation about the location of th
kcc2 2016/03/02 01:00:11 My recommendation is to keep the fuzzing targets c
xhwang 2016/03/02 01:20:41 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "media/base/pipeline_status.h"
+#include "media/test/pipeline_integration_test_base.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ // Media pipeline starts new threads, which needs AtExitManager.
+ base::AtExitManager at_exit;
+
+ // Media pipeline checks command line arguments internally.
+ base::CommandLine::Init(0, NULL);
DaleCurtis 2016/03/02 01:05:39 nullptr ?
xhwang 2016/03/02 01:20:41 Done.
+
+ media::PipelineIntegrationTestBase test;
+
+ DVLOG(1) << "Start";
kcc2 2016/03/02 01:00:11 No logging please -- it just slows down fuzzing.
xhwang 2016/03/02 01:20:41 Done.
+ media::PipelineStatus pipeline_status =
+ test.Start(data, size, media::PipelineIntegrationTestBase::kClockless);
+ if (pipeline_status != media::PIPELINE_OK)
+ return 0;
+
+ DVLOG(1) << "Play";
+ test.Play();
+ pipeline_status = test.WaitUntilEndedOrError();
+ if (pipeline_status != media::PIPELINE_OK)
+ return 0;
+
+ DVLOG(1) << "Seek";
+ test.Seek(base::TimeDelta::FromMilliseconds(0));
DaleCurtis 2016/03/02 01:05:39 Also just base::TimeDelta() here.
xhwang 2016/03/02 01:20:41 Done.
+
+ return 0;
+}
« testing/libfuzzer/fuzzers/BUILD.gn ('K') | « testing/libfuzzer/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698