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 "core/MediaTypeNames.h" | 5 #include "core/MediaTypeNames.h" |
6 #include "core/css/MediaValuesCached.h" | 6 #include "core/css/MediaValuesCached.h" |
7 #include "core/html/HTMLDocument.h" | 7 #include "core/html/HTMLDocument.h" |
8 #include "core/html/parser/HTMLDocumentParser.h" | 8 #include "core/html/parser/HTMLDocumentParser.h" |
9 #include "core/html/parser/ResourcePreloader.h" | 9 #include "core/html/parser/ResourcePreloader.h" |
10 #include "core/html/parser/TextResourceDecoderForFuzzing.h" | 10 #include "core/html/parser/TextResourceDecoderForFuzzing.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 document_parameters->viewport_meta_enabled = fuzzed_data.ConsumeBool(); | 27 document_parameters->viewport_meta_enabled = fuzzed_data.ConsumeBool(); |
28 return document_parameters; | 28 return document_parameters; |
29 } | 29 } |
30 | 30 |
31 class MockResourcePreloader : public ResourcePreloader { | 31 class MockResourcePreloader : public ResourcePreloader { |
32 void Preload(std::unique_ptr<PreloadRequest>, | 32 void Preload(std::unique_ptr<PreloadRequest>, |
33 const NetworkHintsInterface&) override {} | 33 const NetworkHintsInterface&) override {} |
34 }; | 34 }; |
35 | 35 |
36 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 36 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 37 static BlinkFuzzerTestSupport test_support = BlinkFuzzerTestSupport(); |
37 FuzzedDataProvider fuzzed_data(data, size); | 38 FuzzedDataProvider fuzzed_data(data, size); |
38 | 39 |
39 HTMLParserOptions options; | 40 HTMLParserOptions options; |
40 options.script_enabled = fuzzed_data.ConsumeBool(); | 41 options.script_enabled = fuzzed_data.ConsumeBool(); |
41 options.plugins_enabled = fuzzed_data.ConsumeBool(); | 42 options.plugins_enabled = fuzzed_data.ConsumeBool(); |
42 | 43 |
43 std::unique_ptr<CachedDocumentParameters> document_parameters = | 44 std::unique_ptr<CachedDocumentParameters> document_parameters = |
44 CachedDocumentParametersForFuzzing(fuzzed_data); | 45 CachedDocumentParametersForFuzzing(fuzzed_data); |
45 | 46 |
46 KURL document_url(kParsedURLString, "http://whatever.test/"); | 47 KURL document_url(kParsedURLString, "http://whatever.test/"); |
(...skipping 27 matching lines...) Expand all Loading... |
74 PreloadRequestStream requests = scanner->Scan(document_url, nullptr); | 75 PreloadRequestStream requests = scanner->Scan(document_url, nullptr); |
75 preloader.TakeAndPreload(requests); | 76 preloader.TakeAndPreload(requests); |
76 return 0; | 77 return 0; |
77 } | 78 } |
78 | 79 |
79 } // namespace blink | 80 } // namespace blink |
80 | 81 |
81 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 82 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
82 return blink::LLVMFuzzerTestOneInput(data, size); | 83 return blink::LLVMFuzzerTestOneInput(data, size); |
83 } | 84 } |
84 | |
85 extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { | |
86 blink::InitializeBlinkFuzzTest(argc, argv); | |
87 return 0; | |
88 } | |
OLD | NEW |