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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerFuzzer.cpp

Issue 2318283002: DCHECK that the document url is valid in HTMLPreloadScanner (Closed)
Patch Set: fix unit test Created 4 years, 3 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 | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | 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 "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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 mediaData.displayMode = WebDisplayModeBrowser; 60 mediaData.displayMode = WebDisplayModeBrowser;
61 61
62 MockResourcePreloader preloader; 62 MockResourcePreloader preloader;
63 63
64 std::unique_ptr<HTMLPreloadScanner> scanner = HTMLPreloadScanner::create(opt ions, documentURL, std::move(documentParameters), mediaData); 64 std::unique_ptr<HTMLPreloadScanner> scanner = HTMLPreloadScanner::create(opt ions, documentURL, std::move(documentParameters), mediaData);
65 65
66 TextResourceDecoderForFuzzing decoder(fuzzedData); 66 TextResourceDecoderForFuzzing decoder(fuzzedData);
67 CString bytes = fuzzedData.ConsumeRemainingBytes(); 67 CString bytes = fuzzedData.ConsumeRemainingBytes();
68 String decodedBytes = decoder.decode(bytes.data(), bytes.length()); 68 String decodedBytes = decoder.decode(bytes.data(), bytes.length());
69 scanner->appendToEnd(decodedBytes); 69 scanner->appendToEnd(decodedBytes);
70 scanner->scanAndPreload(&preloader, KURL(), nullptr); 70 scanner->scanAndPreload(&preloader, documentURL, nullptr);
71 return 0; 71 return 0;
72 } 72 }
73 73
74 } // namespace blink 74 } // namespace blink
75 75
76 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) 76 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
77 { 77 {
78 return blink::LLVMFuzzerTestOneInput(data, size); 78 return blink::LLVMFuzzerTestOneInput(data, size);
79 } 79 }
80 80
81 extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) 81 extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
82 { 82 {
83 blink::InitializeBlinkFuzzTest(argc, argv); 83 blink::InitializeBlinkFuzzTest(argc, argv);
84 return 0; 84 return 0;
85 } 85 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698