blob: b55e0fa276a3dd82d03b836c56711eee9acb83ef [file] [log] [blame]
# Copyright 2017 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("//testing/test.gni")
import("//third_party/blink/renderer/build/scripts/scripts.gni")
import("//third_party/protobuf/proto_library.gni")
blink_python_runner("make_generated_permissions_policy_features") {
script = "../renderer/build/scripts/make_permissions_policy_features.py"
inputs = scripts_for_json5_files + [
"../renderer/build/scripts/make_permissions_policy_features.py",
"../renderer/core/permissions_policy/permissions_policy_features.json5",
"../renderer/build/scripts/templates/permissions_policy_features.cc.tmpl",
]
outputs = [ "$root_gen_dir/third_party/blink/common/permissions_policy/permissions_policy_features.cc" ]
args = [
rebase_path(
"../renderer/core/permissions_policy/permissions_policy_features.json5",
root_build_dir),
"--output_dir",
rebase_path("$root_gen_dir/third_party/blink/common/permissions_policy",
root_build_dir),
]
}
blink_python_runner("make_generated_document_policy_features") {
script = "../renderer/build/scripts/make_document_policy_features.py"
inputs =
scripts_for_json5_files + [
"../renderer/build/scripts/make_document_policy_features.py",
"../renderer/build/scripts/make_document_policy_features_util.py",
"../renderer/core/permissions_policy/document_policy_features.json5",
"../renderer/build/scripts/templates/document_policy_features.cc.tmpl",
]
outputs = [ "$root_gen_dir/third_party/blink/common/permissions_policy/document_policy_features.cc" ]
args = [
rebase_path(
"../renderer/core/permissions_policy/document_policy_features.json5",
root_build_dir),
"--output_dir",
rebase_path("$root_gen_dir/third_party/blink/common/permissions_policy",
root_build_dir),
]
}
blink_python_runner("make_generated_origin_trials") {
script = "../renderer/build/scripts/make_origin_trials.py"
inputs = scripts_for_json5_files + [
"../renderer/build/scripts/make_origin_trials.py",
"../renderer/platform/runtime_enabled_features.json5",
"../renderer/build/scripts/templates/origin_trials.cc.tmpl",
]
outputs = [
"$root_gen_dir/third_party/blink/common/origin_trials/origin_trials.cc",
]
args = [
rebase_path("../renderer/platform/runtime_enabled_features.json5",
root_build_dir),
"--output_dir",
rebase_path("$root_gen_dir/third_party/blink/common/origin_trials",
root_build_dir),
]
}
config("blink_common_implementation") {
defines = [ "BLINK_COMMON_IMPLEMENTATION=1" ]
}
source_set("common") {
# No target should directly depend on this target since this is just the
# source set rather than the actual component that can be linked to.
# Dependencies instead should be to //third_party/blink/public/common:common.
visibility = [
":*",
"//third_party/blink/public:all_blink",
"//third_party/blink/public/common",
]
configs += [ ":blink_common_implementation" ]
sources = [
# NOTE: Please do not add public headers that need to be referenced from
# outside WebKit, add them in public/common instead.
"associated_interfaces/associated_interface_provider.cc",
"associated_interfaces/associated_interface_registry.cc",
"blob/blob_utils.cc",
"bluetooth/web_bluetooth_device_id.cc",
"browser_interface_broker_proxy.cc",
"cache_storage/cache_storage_utils.cc",
"chrome_debug_urls.cc",
"client_hints/client_hints.cc",
"client_hints/enabled_client_hints.cc",
"context_menu_data/context_menu_mojom_traits.cc",
"context_menu_data/context_menu_params_builder.cc",
"context_menu_data/untrustworthy_context_menu_params.cc",
"crash_helpers.cc",
"crash_helpers.h",
"custom_handlers/protocol_handler_utils.cc",
"device_memory/approximated_device_memory.cc",
"dom_storage/session_storage_namespace_id.cc",
"features.cc",
"fetch/fetch_api_request_body_mojom_traits.cc",
"frame/event_page_show_persisted.cc",
"frame/frame_ad_evidence.cc",
"frame/frame_ad_evidence_mojom_traits.cc",
"frame/frame_policy.cc",
"frame/frame_policy_mojom_traits.cc",
"frame/frame_visual_properties.cc",
"frame/frame_visual_properties_mojom_traits.cc",
"frame/from_ad_state.cc",
"frame/payment_request_token.cc",
"frame/transient_allow_fullscreen.cc",
"frame/user_activation_state.cc",
"indexeddb/indexed_db_default_mojom_traits.cc",
"indexeddb/indexeddb_key.cc",
"indexeddb/indexeddb_key_path.cc",
"indexeddb/indexeddb_key_range.cc",
"indexeddb/indexeddb_metadata.cc",
"input/synthetic_web_input_event_builders.cc",
"input/web_coalesced_input_event.cc",
"input/web_coalesced_input_event_mojom_traits.cc",
"input/web_gesture_event.cc",
"input/web_input_event.cc",
"input/web_keyboard_event.cc",
"input/web_mouse_event.cc",
"input/web_mouse_wheel_event.cc",
"input/web_pointer_event.cc",
"input/web_touch_event.cc",
"interest_group/interest_group.cc",
"interest_group/interest_group_mojom_traits.cc",
"link_to_text/link_to_text_mojom_traits.cc",
"loader/inter_process_time_ticks_converter.cc",
"loader/loader_constants.cc",
"loader/mime_sniffing_throttle.cc",
"loader/mime_sniffing_url_loader.cc",
"loader/network_utils.cc",
"loader/record_load_histograms.cc",
"loader/referrer_utils.cc",
"loader/resource_type_util.cc",
"loader/throttling_url_loader.cc",
"loader/url_loader_factory_bundle.cc",
"loader/url_loader_factory_bundle_mojom_traits.cc",
"loader/url_loader_throttle.cc",
"logging/logging_utils.cc",
"manifest/manifest.cc",
"manifest/manifest_icon_selector.cc",
"manifest/manifest_util.cc",
"media/watch_time_component.cc",
"media/watch_time_reporter.cc",
"mediastream/media_devices.cc",
"mediastream/media_devices_mojom_traits.cc",
"mediastream/media_stream_controls.cc",
"mediastream/media_stream_mojom_traits.cc",
"mediastream/media_stream_request.cc",
"messaging/cloneable_message.cc",
"messaging/cloneable_message_mojom_traits.cc",
"messaging/message_port_channel.cc",
"messaging/message_port_descriptor.cc",
"messaging/message_port_descriptor_mojom_traits.cc",
"messaging/string_message_codec.cc",
"messaging/transferable_message.cc",
"messaging/transferable_message_mojom_traits.cc",
"messaging/web_message_port.cc",
"metrics/post_message_counter.cc",
"mime_util/mime_util.cc",
"mobile_metrics/mobile_friendliness.cc",
"native_io/native_io_utils.cc",
"navigation/impression.cc",
"navigation/impression_mojom_traits.cc",
"navigation/navigation_params.cc",
"navigation/navigation_policy.cc",
"navigation/navigation_policy_mojom_traits.cc",
"navigation/prefetched_signed_exchange_info_mojom_traits.cc",
"notifications/notification_mojom_traits.cc",
"notifications/notification_resources.cc",
"notifications/platform_notification_data.cc",
"origin_trials/manual_completion_origin_trial_features.cc",
"origin_trials/navigation_origin_trial_features.cc",
"origin_trials/trial_token.cc",
"origin_trials/trial_token_result.cc",
"origin_trials/trial_token_validator.cc",
"page/content_to_visible_time_reporter.cc",
"page/drag_mojom_traits.cc",
"page/drag_operation.cc",
"page/page_zoom.cc",
"page_state/page_state.cc",
"page_state/page_state_serialization.cc",
"peerconnection/webrtc_ip_handling_policy.cc",
"permissions/permission_utils.cc",
"permissions_policy/document_policy.cc",
"permissions_policy/permissions_policy.cc",
"permissions_policy/permissions_policy_mojom_traits.cc",
"permissions_policy/policy_value.cc",
"renderer_preferences/renderer_preferences.cc",
"renderer_preferences/renderer_preferences_mojom_traits.cc",
"scheduler/web_scheduler_tracked_feature.cc",
"scheme_registry.cc",
"security/address_space_feature.cc",
"service_worker/service_worker_loader_helpers.cc",
"service_worker/service_worker_scope_match.cc",
"service_worker/service_worker_status_code.cc",
"service_worker/service_worker_type_converters.cc",
"shared_storage/shared_storage_mojom_traits.cc",
"shared_storage/shared_storage_utils.cc",
"storage_key/storage_key.cc",
"storage_key/storage_key_mojom_traits.cc",
"switches.cc",
"thread_safe_browser_interface_broker_proxy.cc",
"unique_name/unique_name_helper.cc",
"use_counter/use_counter_feature.cc",
"use_counter/use_counter_feature_tracker.cc",
"user_agent/user_agent_metadata.cc",
"web_package/signed_exchange_consts.cc",
"web_package/web_package_request_matcher.cc",
"web_preferences/web_preferences.cc",
"web_preferences/web_preferences_mojom_traits.cc",
"widget/constants.cc",
"widget/device_emulation_params_mojom_traits.cc",
"widget/visual_properties.cc",
"widget/visual_properties_mojom_traits.cc",
]
sources += get_target_outputs(":make_generated_document_policy_features")
sources += get_target_outputs(":make_generated_origin_trials")
sources += get_target_outputs(":make_generated_permissions_policy_features")
public_deps = [
":make_generated_document_policy_features",
":make_generated_origin_trials",
":make_generated_permissions_policy_features",
"//third_party/blink/common/privacy_budget:privacy_budget",
"//third_party/blink/public/common:common_export",
"//third_party/blink/public/common:headers",
]
deps = [
"//base",
"//build:chromeos_buildflags",
"//media/capture:capture_base",
"//media/capture/mojom:video_capture_mojom_support",
"//mojo/public/cpp/system",
"//net",
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/metrics/public/mojom:mojom",
"//services/network/public/cpp:cpp",
"//third_party/blink/public/common:buildflags",
"//third_party/blink/public/mojom:mobile_metrics_shared",
"//ui/base:base",
"//ui/base/dragdrop/mojom:mojom_shared",
"//ui/display",
"//ui/display/mojom",
"//ui/events:events_base",
"//ui/latency/mojom:shared_mojom_traits",
]
# iOS doesn't use and must not depend on //media
if (!is_ios) {
deps += [ "//media" ]
}
if (is_android || is_win) {
sources += [
"font_unique_name_lookup/font_table_matcher.cc",
"font_unique_name_lookup/font_table_persistence.cc",
"font_unique_name_lookup/icu_fold_case_util.cc",
]
deps += [ "//third_party/icu" ]
}
if (is_win) {
sources += [ "dwrite_rasterizer_support/dwrite_rasterizer_support.cc" ]
deps += [ "//ui/gfx/" ]
}
}
test("blink_common_unittests") {
visibility = [ "*" ]
deps = [
":common_unittests_sources",
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/metrics/public/mojom:mojom",
"//third_party/blink/common/privacy_budget:unit_tests",
"//third_party/blink/public/common",
"//ui/gfx:test_support",
]
if (is_android) {
deps += [
"//base:base_java",
"//media/base/android:media_java",
]
}
if (is_fuchsia) {
# TODO(https://crbug.com/1185811): Investigate removing the requirement for
# job_policy_ambient_mark_vmo_exec for the sake of V8's allocator in tests.
test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml"
# TODO(crbug.com/1313103): Remove and apply use_cfv1=false once the roller
# is updated to launch the test via the .cm manifest.
additional_manifest_fragments =
[ "//build/config/fuchsia/test/jit_capabilities.test-cmx" ]
}
data_deps = [ ":common_unittests_data" ]
}
source_set("common_unittests_sources") {
testonly = true
sources = [
"bluetooth/web_bluetooth_device_id_unittest.cc",
"client_hints/client_hints_unittest.cc",
"client_hints/enabled_client_hints_unittest.cc",
"device_memory/approximated_device_memory_unittest.cc",
"frame/transient_allow_fullscreen_unittest.cc",
"frame/user_activation_state_unittest.cc",
"indexeddb/indexeddb_key_unittest.cc",
"input/synthetic_web_input_event_builders_unittest.cc",
"input/web_input_event_unittest.cc",
"interest_group/interest_group_mojom_traits_test.cc",
"loader/inter_process_time_ticks_converter_unittest.cc",
"loader/mime_sniffing_throttle_unittest.cc",
"loader/referrer_utils_unittest.cc",
"loader/throttling_url_loader_unittest.cc",
"manifest/manifest_icon_selector_unittest.cc",
"manifest/manifest_util_unittest.cc",
"media/watch_time_component_unittest.cc",
"mediastream/media_devices_unittest.cc",
"messaging/message_port_descriptor_unittest.cc",
"metrics/post_message_counter_unittest.cc",
"mime_util/mime_util_unittest.cc",
"notifications/notification_mojom_traits_unittest.cc",
"origin_trials/origin_trials_test.cc",
"origin_trials/trial_token_unittest.cc",
"origin_trials/trial_token_validator_unittest.cc",
"page/content_to_visible_time_reporter_unittest.cc",
"page_state/page_state_serialization_unittest.cc",
"permissions_policy/document_policy_unittest.cc",
"permissions_policy/permissions_policy_unittest.cc",
"permissions_policy/policy_value_unittest.cc",
"scheduler/web_scheduler_tracked_feature_unittest.cc",
"security/address_space_feature_unittest.cc",
"service_worker/service_worker_scope_match_unittest.cc",
"shared_storage/shared_storage_mojom_traits_unittest.cc",
"storage_key/storage_key_mojom_traits_unittest.cc",
"storage_key/storage_key_unittest.cc",
"test/run_all_unittests.cc",
"tokens/multi_token_unittest.cc",
"tokens/tokens_mojom_traits_unittest.cc",
"unique_name/unique_name_helper_unittest.cc",
"user_agent/user_agent_metadata_unittest.cc",
"web_package/web_package_request_matcher_unittest.cc",
]
deps = [
"//base",
"//base/test:test_support",
"//components/ukm:test_support",
"//media/capture:capture_base",
"//mojo/core/embedder",
"//mojo/public/cpp/test_support:test_utils",
"//net",
"//net:test_support",
"//services/device:test_support",
"//services/network:test_support",
"//services/viz/public/mojom",
"//skia/public/mojom",
"//testing/gmock",
"//testing/gtest",
"//third_party/blink/public/common:buildflags",
"//third_party/blink/public/common:headers",
"//third_party/blink/public/mojom/tokens:tokens_traits_headers",
"//third_party/boringssl",
"//url/mojom:url_mojom_gurl",
"//v8",
"//v8:v8_libplatform",
]
if (!is_android) {
# TODO(crbug.com/845384): Enable these tests also on Android. Currently
# they are excluded as they require V8 environment but V8 snapshot is
# not available in the current minimum test setting.
sources += [
"messaging/string_message_codec_unittest.cc",
"messaging/web_message_port_unittest.cc",
]
}
if (is_android || is_win) {
sources += [
"font_unique_name_lookup/font_table_matcher_unittest.cc",
"font_unique_name_lookup/icu_fold_case_util_unittest.cc",
]
}
}
group("common_unittests_data") {
data = [ "page_state/test_data/" ]
}
static_library("test_support") {
testonly = true
sources = [ "origin_trials/scoped_test_origin_trial_policy.cc" ]
deps = [ "//third_party/blink/public:test_headers" ]
visibility = [ "//third_party/blink/public:test_support" ]
}
if (use_libfuzzer) {
proto_library("storage_key_fuzzer_proto") {
testonly = true
proto_in_dir = "//"
sources = [ "storage_key/storage_key_fuzzer.proto" ]
proto_deps = [ "//third_party/blink/public/common:storage_key_proto" ]
}
fuzzer_test("storage_key_fuzzer") {
sources = [ "storage_key/storage_key_fuzzer.cc" ]
deps = [
":common",
":storage_key_fuzzer_proto",
"//base/test:test_support",
"//third_party/blink/public/common:storage_key_proto_converter",
"//third_party/libprotobuf-mutator",
]
}
}