| OLD | NEW |
| 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 <vector> |
| 6 |
| 5 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 7 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "media/base/eme_constants.h" |
| 8 #include "media/base/pipeline_status.h" | 12 #include "media/base/pipeline_status.h" |
| 9 #include "media/test/pipeline_integration_test_base.h" | 13 #include "media/test/pipeline_integration_test_base.h" |
| 10 | 14 |
| 15 namespace { |
| 16 |
| 17 void OnEncryptedMediaInitData(media::PipelineIntegrationTestBase* test, |
| 18 media::EmeInitDataType /* type */, |
| 19 const std::vector<uint8_t>& /* init_data */) { |
| 20 test->OnError(media::PIPELINE_ERROR_INITIALIZATION_FAILED); |
| 21 } |
| 22 |
| 23 } // namespace |
| 24 |
| 11 // Entry point for LibFuzzer. | 25 // Entry point for LibFuzzer. |
| 12 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 26 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 13 // Media pipeline starts new threads, which needs AtExitManager. | 27 // Media pipeline starts new threads, which needs AtExitManager. |
| 14 base::AtExitManager at_exit; | 28 base::AtExitManager at_exit; |
| 15 | 29 |
| 16 // Media pipeline checks command line arguments internally. | 30 // Media pipeline checks command line arguments internally. |
| 17 base::CommandLine::Init(0, nullptr); | 31 base::CommandLine::Init(0, nullptr); |
| 18 | 32 |
| 19 media::PipelineIntegrationTestBase test; | 33 media::PipelineIntegrationTestBase test; |
| 20 | 34 |
| 35 test.set_encrypted_media_init_data_cb( |
| 36 base::Bind(&OnEncryptedMediaInitData, &test)); |
| 37 |
| 21 media::PipelineStatus pipeline_status = | 38 media::PipelineStatus pipeline_status = |
| 22 test.Start(data, size, media::PipelineIntegrationTestBase::kClockless); | 39 test.Start(data, size, media::PipelineIntegrationTestBase::kClockless); |
| 23 if (pipeline_status != media::PIPELINE_OK) | 40 if (pipeline_status != media::PIPELINE_OK) |
| 24 return 0; | 41 return 0; |
| 25 | 42 |
| 26 test.Play(); | 43 test.Play(); |
| 27 pipeline_status = test.WaitUntilEndedOrError(); | 44 pipeline_status = test.WaitUntilEndedOrError(); |
| 28 if (pipeline_status != media::PIPELINE_OK) | 45 if (pipeline_status != media::PIPELINE_OK) |
| 29 return 0; | 46 return 0; |
| 30 | 47 |
| 31 test.Seek(base::TimeDelta()); | 48 test.Seek(base::TimeDelta()); |
| 32 | 49 |
| 33 return 0; | 50 return 0; |
| 34 } | 51 } |
| OLD | NEW |