| # Copyright 2019 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//testing/libfuzzer/fuzzer_test.gni") |
| import("//third_party/protobuf/proto_library.gni") |
| |
| declare_args() { |
| seed_corpus_dir = "$target_gen_dir/binary_seed_corpus" |
| } |
| |
| proto_library("compositor_frame_fuzzer_proto") { |
| sources = [ |
| "compositor_frame_fuzzer.proto", |
| ] |
| } |
| |
| # Encodes text-format protobuf messages into binary-format protobuf |
| # messages in seed_corpus_dir. |
| # |
| # The messages must be of type RenderPass, as defined in the proto2 file |
| # compositor_frame_fuzzer.proto (these assumptions are all hardcoded into |
| # generate_renderpass_binary.py) |
| action_foreach("generate_seed_corpus") { |
| script = "generate_renderpass_binary.py" |
| pyproto_path = "$root_out_dir/pyproto" |
| |
| input_dir = "text_format_seed_corpus" |
| sources = [ |
| "$input_dir/1_quad_renderpass.asciipb", |
| "$input_dir/2_quad_renderpass.asciipb", |
| "$input_dir/nested_render_pass_draw_quads.asciipb", |
| "$input_dir/overlapping_quads_in_render_pass_draw_quad.asciipb", |
| "$input_dir/solid_color_tiled_background_with_2_quads_on_top.asciipb", |
| ] |
| outputs = [ |
| "$seed_corpus_dir/{{source_name_part}}.pb", |
| ] |
| |
| deps = [ |
| ":compositor_frame_fuzzer_proto", |
| "//third_party/protobuf:py_proto", |
| ] |
| |
| args = [ |
| "-i", |
| "{{source}}", |
| "-d", |
| rebase_path(seed_corpus_dir, root_build_dir), |
| "-o", |
| "{{source_name_part}}.pb", |
| "-p", |
| rebase_path(pyproto_path, root_build_dir), |
| "-p", |
| rebase_path("$pyproto_path/components/viz/service/compositor_frame_fuzzer", |
| root_build_dir), |
| ] |
| } |
| |
| fuzzer_test("compositor_frame_fuzzer") { |
| sources = [ |
| "compositor_frame_fuzzer.cc", |
| "compositor_frame_fuzzer_util.cc", |
| "compositor_frame_fuzzer_util.h", |
| "fuzzer_browser_process.cc", |
| "fuzzer_browser_process.h", |
| "fuzzer_software_display_provider.cc", |
| "fuzzer_software_display_provider.h", |
| ] |
| |
| deps = [ |
| ":compositor_frame_fuzzer_proto", |
| ":generate_seed_corpus", |
| "//components/viz/service", |
| "//components/viz/test:test_support", |
| "//mojo/core/embedder", |
| "//third_party/libprotobuf-mutator", |
| ] |
| |
| seed_corpus = "$seed_corpus_dir" |
| seed_corpus_deps = [ ":generate_seed_corpus" ] |
| } |