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

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
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 test->FailTest(media::PIPELINE_ERROR_INITIALIZATION_FAILED);
23 }
24
25 } // namespace
26
14 // Entry point for LibFuzzer. 27 // Entry point for LibFuzzer.
15 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
16 // Media pipeline starts new threads, which needs AtExitManager. 29 // Media pipeline starts new threads, which needs AtExitManager.
17 base::AtExitManager at_exit; 30 base::AtExitManager at_exit;
18 31
19 // Media pipeline checks command line arguments internally. 32 // Media pipeline checks command line arguments internally.
20 base::CommandLine::Init(0, nullptr); 33 base::CommandLine::Init(0, nullptr);
21 34
22 media::PipelineIntegrationTestBase test; 35 media::PipelineIntegrationTestBase test;
23 36
37 test.set_encrypted_media_init_data_cb(
38 base::Bind(&OnEncryptedMediaInitData, &test));
39
24 media::PipelineStatus pipeline_status = 40 media::PipelineStatus pipeline_status =
25 test.Start(data, size, media::PipelineIntegrationTestBase::kClockless); 41 test.Start(data, size, media::PipelineIntegrationTestBase::kClockless);
26 if (pipeline_status != media::PIPELINE_OK) 42 if (pipeline_status != media::PIPELINE_OK)
27 return 0; 43 return 0;
28 44
29 test.Play(); 45 test.Play();
30 pipeline_status = test.WaitUntilEndedOrError(); 46 pipeline_status = test.WaitUntilEndedOrError();
31 if (pipeline_status != media::PIPELINE_OK) 47 if (pipeline_status != media::PIPELINE_OK)
32 return 0; 48 return 0;
33 49
34 test.Seek(base::TimeDelta()); 50 test.Seek(base::TimeDelta());
35 51
36 return 0; 52 return 0;
37 } 53 }
OLDNEW
« no previous file with comments | « no previous file | media/test/pipeline_integration_test_base.h » ('j') | media/test/pipeline_integration_test_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698