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

Side by Side Diff: media/test/pipeline_integration_fuzzertest.cc

Issue 1761603002: media: Handle "encrypted" event in pipeline_integration_fuzzertest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 9 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
« no previous file with comments | « no previous file | media/test/pipeline_integration_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <vector>
7 8
8 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "media/base/eme_constants.h"
11 #include "media/base/pipeline_status.h" 14 #include "media/base/pipeline_status.h"
12 #include "media/test/pipeline_integration_test_base.h" 15 #include "media/test/pipeline_integration_test_base.h"
13 16
17 namespace {
18
19 void OnEncryptedMediaInitData(media::PipelineIntegrationTestBase* test,
20 media::EmeInitDataType /* type */,
21 const std::vector<uint8_t>& /* init_data */) {
22 // Encrypted media is not supported in this test. For an encrypted media file,
23 // we will start demuxing the data but media pipeline will wait for a CDM to
24 // be available to start initialization, which will not happen in this case.
25 // To prevent the test timeout, we'll just fail the test immediately here.
26 // TODO(xhwang): Support encrypted media in this fuzzer test.
27 test->FailTest(media::PIPELINE_ERROR_INITIALIZATION_FAILED);
28 }
29
30 } // namespace
31
14 // Entry point for LibFuzzer. 32 // Entry point for LibFuzzer.
15 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 33 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
16 // Media pipeline starts new threads, which needs AtExitManager. 34 // Media pipeline starts new threads, which needs AtExitManager.
17 base::AtExitManager at_exit; 35 base::AtExitManager at_exit;
18 36
19 // Media pipeline checks command line arguments internally. 37 // Media pipeline checks command line arguments internally.
20 base::CommandLine::Init(0, nullptr); 38 base::CommandLine::Init(0, nullptr);
21 39
22 media::PipelineIntegrationTestBase test; 40 media::PipelineIntegrationTestBase test;
23 41
42 test.set_encrypted_media_init_data_cb(
43 base::Bind(&OnEncryptedMediaInitData, &test));
44
24 media::PipelineStatus pipeline_status = 45 media::PipelineStatus pipeline_status =
25 test.Start(data, size, media::PipelineIntegrationTestBase::kClockless); 46 test.Start(data, size, media::PipelineIntegrationTestBase::kClockless);
26 if (pipeline_status != media::PIPELINE_OK) 47 if (pipeline_status != media::PIPELINE_OK)
27 return 0; 48 return 0;
28 49
29 test.Play(); 50 test.Play();
30 pipeline_status = test.WaitUntilEndedOrError(); 51 pipeline_status = test.WaitUntilEndedOrError();
31 if (pipeline_status != media::PIPELINE_OK) 52 if (pipeline_status != media::PIPELINE_OK)
32 return 0; 53 return 0;
33 54
34 test.Seek(base::TimeDelta()); 55 test.Seek(base::TimeDelta());
35 56
36 return 0; 57 return 0;
37 } 58 }
OLDNEW
« no previous file with comments | « no previous file | media/test/pipeline_integration_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698