chromium/extensions/common/BUILD.gn

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//components/nacl/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/libfuzzer/fuzzer_test.gni")

assert(enable_extensions_core)

group("common_constants") {
  if (is_component_build) {
    public_deps = [ "//extensions" ]
  } else {
    public_deps = [ ":constants_impl" ]
  }
}

group("export") {
  if (is_component_build) {
    public_deps = [ "//extensions" ]
  } else {
    public_deps = [ ":export_impl" ]
  }
}

source_set("export_impl") {
  visibility = [
    "//extensions",
    "//extensions/common:*",
  ]

  configs += [ "//extensions:component_implementation" ]

  sources = [ "extensions_export.h" ]
}

source_set("constants_impl") {
  visibility = [
    "//extensions",
    "//extensions/common:common_constants",
  ]

  configs += [ "//extensions:component_implementation" ]

  sources = [
    "constants.cc",
    "constants.h",
    "logging_constants.h",
  ]

  public_deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//extensions/common:export_impl",
  ]

  deps = [ "//build:chromecast_buildflags" ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

mojom("mojom") {
  # We don't want Blink variants of bindings to be generated.
  disable_variants = true

  sources = [
    "mojom/api_permission_id.mojom",
    "mojom/app_window.mojom",
    "mojom/automation_registry.mojom",
    "mojom/channel.mojom",
    "mojom/code_injection.mojom",
    "mojom/context_type.mojom",
    "mojom/css_origin.mojom",
    "mojom/event_dispatcher.mojom",
    "mojom/event_router.mojom",
    "mojom/execution_world.mojom",
    "mojom/extra_response_data.mojom",
    "mojom/feature_session_type.mojom",
    "mojom/frame.mojom",
    "mojom/host_id.mojom",
    "mojom/injection_type.mojom",
    "mojom/keep_alive.mojom",
    "mojom/manifest.mojom",
    "mojom/message_port.mojom",
    "mojom/permission_set.mojom",
    "mojom/renderer.mojom",
    "mojom/renderer_host.mojom",
    "mojom/run_location.mojom",
    "mojom/service_worker.mojom",
    "mojom/service_worker_host.mojom",
    "mojom/stack_frame.mojom",
    "mojom/url_pattern_set.mojom",
    "mojom/view_type.mojom",
  ]

  public_deps = [
    "//content/public/common:interfaces",
    "//extensions/common/api:mojom",
    "//mojo/public/mojom/base",
    "//services/accessibility/public/mojom:automation",
    "//third_party/blink/public/mojom:mojom_core",
    "//ui/gfx/geometry/mojom",
    "//url/mojom:url_mojom_gurl",
  ]

  if (enable_guest_view) {
    sources += [ "mojom/guest_view.mojom" ]
  }

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "extensions.mojom.Channel"
          cpp = "version_info::Channel"
        },
      ]
      traits_headers = [ "//extensions/common/mojom/channel_mojom_traits.h" ]
      traits_public_deps = [ "//components/version_info:channel" ]
    },
    {
      types = [
        {
          mojom = "extensions.mojom.APIPermission"
          cpp = "::std::unique_ptr<::extensions::APIPermission>"
          move_only = true
        },
        {
          mojom = "extensions.mojom.APIPermissionSet"
          cpp = "::extensions::APIPermissionSet"
          move_only = true
        },
        {
          mojom = "extensions.mojom.ManifestPermission"
          cpp = "::std::unique_ptr<::extensions::ManifestPermission>"
          move_only = true
        },
        {
          mojom = "extensions.mojom.ManifestPermissionSet"
          cpp = "::extensions::ManifestPermissionSet"
          move_only = true
        },
        {
          mojom = "extensions.mojom.PermissionSet"
          cpp = "::extensions::PermissionSet"
          move_only = true
        },
      ]
      traits_headers =
          [ "//extensions/common/mojom/permission_set_mojom_traits.h" ]
      traits_sources =
          [ "//extensions/common/mojom/permission_set_mojom_traits.cc" ]
    },
    {
      types = [
        {
          mojom = "extensions.mojom.URLPattern"
          cpp = "::URLPattern"
        },
        {
          mojom = "extensions.mojom.URLPatternSet"
          cpp = "::extensions::URLPatternSet"
          move_only = true
        },
      ]
      traits_headers =
          [ "//extensions/common/mojom/url_pattern_set_mojom_traits.h" ]
      traits_sources =
          [ "//extensions/common/mojom/url_pattern_set_mojom_traits.cc" ]
    },
    {
      types = [
        {
          mojom = "extensions.mojom.StackFrame"
          cpp = "::extensions::StackFrame"
        },
      ]
      traits_headers =
          [ "//extensions/common/mojom/stack_frame_mojom_traits.h" ]
      traits_sources =
          [ "//extensions/common/mojom/stack_frame_mojom_traits.cc" ]
    },
    {
      types = [
        {
          mojom = "extensions.mojom.Message"
          cpp = "::extensions::Message"
          move_only = true
        },
        {
          mojom = "extensions.mojom.PortId"
          cpp = "::extensions::PortId"
        },
        {
          mojom = "extensions.mojom.MessagingEndpoint"
          cpp = "::extensions::MessagingEndpoint"
        },
      ]
      traits_headers =
          [ "//extensions/common/mojom/message_port_mojom_traits.h" ]
      traits_sources =
          [ "//extensions/common/mojom/message_port_mojom_traits.cc" ]
    },
  ]
  overridden_deps = [
    "//content/public/common:interfaces",
    "//third_party/blink/public/mojom:mojom_core",
  ]

  component_deps = [ "//content/public/common" ]
}

# This must be a static library because extensions common depends on
# GetTrustedICAPublicKey in extensions/browser which isn't always linked
# in. TODO(brettw): This reverse dependency should be fixed.
static_library("common") {
  sources = [
    "alias.h",
    "api/bluetooth/bluetooth_manifest_data.cc",
    "api/bluetooth/bluetooth_manifest_data.h",
    "api/bluetooth/bluetooth_manifest_handler.cc",
    "api/bluetooth/bluetooth_manifest_handler.h",
    "api/bluetooth/bluetooth_manifest_permission.cc",
    "api/bluetooth/bluetooth_manifest_permission.h",
    "api/commands/commands_handler.cc",
    "api/commands/commands_handler.h",
    "api/declarative/declarative_constants.cc",
    "api/declarative/declarative_constants.h",
    "api/declarative/declarative_manifest_data.cc",
    "api/declarative/declarative_manifest_data.h",
    "api/declarative/declarative_manifest_handler.cc",
    "api/declarative/declarative_manifest_handler.h",
    "api/declarative_net_request/constants.cc",
    "api/declarative_net_request/constants.h",
    "api/declarative_net_request/dnr_manifest_data.cc",
    "api/declarative_net_request/dnr_manifest_data.h",
    "api/declarative_net_request/dnr_manifest_handler.cc",
    "api/declarative_net_request/dnr_manifest_handler.h",
    "api/extension_action/action_info.cc",
    "api/extension_action/action_info.h",
    "api/messaging/message.h",
    "api/messaging/messaging_endpoint.cc",
    "api/messaging/messaging_endpoint.h",
    "api/messaging/port_context.cc",
    "api/messaging/port_context.h",
    "api/messaging/port_id.cc",
    "api/messaging/port_id.h",
    "api/printer_provider/usb_printer_manifest_data.cc",
    "api/printer_provider/usb_printer_manifest_data.h",
    "api/printer_provider/usb_printer_manifest_handler.cc",
    "api/printer_provider/usb_printer_manifest_handler.h",
    "api/scripts_internal/script_serialization.cc",
    "api/scripts_internal/script_serialization.h",
    "api/sockets/sockets_manifest_data.cc",
    "api/sockets/sockets_manifest_data.h",
    "api/sockets/sockets_manifest_handler.cc",
    "api/sockets/sockets_manifest_handler.h",
    "api/sockets/sockets_manifest_permission.cc",
    "api/sockets/sockets_manifest_permission.h",
    "api/web_request/web_request_activity_log_constants.cc",
    "api/web_request/web_request_activity_log_constants.h",
    "command.cc",
    "command.h",
    "common_manifest_handlers.cc",
    "common_manifest_handlers.h",
    "common_param_traits.h",
    "content_script_injection_url_getter.cc",
    "content_script_injection_url_getter.h",
    "context_data.h",
    "cors_util.cc",
    "cors_util.h",
    "crash_keys.cc",
    "crash_keys.h",
    "csp_validator.cc",
    "csp_validator.h",
    "dom_action_types.h",
    "error_utils.cc",
    "error_utils.h",
    "event_filter.cc",
    "event_filter.h",
    "event_matcher.cc",
    "event_matcher.h",
    "extension.cc",
    "extension.h",
    "extension_api.cc",
    "extension_api.h",
    "extension_features.cc",
    "extension_features.h",
    "extension_id.h",
    "extension_l10n_util.cc",
    "extension_l10n_util.h",
    "extension_paths.cc",
    "extension_paths.h",
    "extension_resource.cc",
    "extension_resource.h",
    "extension_resource_path_normalizer.cc",
    "extension_resource_path_normalizer.h",
    "extension_set.cc",
    "extension_set.h",
    "extension_updater_uma.h",
    "extension_urls.cc",
    "extension_urls.h",
    "extension_utility_types.h",
    "extensions_client.cc",
    "extensions_client.h",
    "feature_switch.cc",
    "feature_switch.h",
    "features/behavior_feature.cc",
    "features/behavior_feature.h",
    "features/complex_feature.cc",
    "features/complex_feature.h",
    "features/feature.cc",
    "features/feature.h",
    "features/feature_channel.cc",
    "features/feature_channel.h",
    "features/feature_developer_mode_only.cc",
    "features/feature_developer_mode_only.h",
    "features/feature_flags.cc",
    "features/feature_flags.h",
    "features/feature_provider.cc",
    "features/feature_provider.h",
    "features/feature_session_type.cc",
    "features/feature_session_type.h",
    "features/json_feature_provider_source.cc",
    "features/json_feature_provider_source.h",
    "features/manifest_feature.cc",
    "features/manifest_feature.h",
    "features/permission_feature.cc",
    "features/permission_feature.h",
    "features/simple_feature.cc",
    "features/simple_feature.h",
    "file_util.cc",
    "file_util.h",
    "frame_context_data.h",
    "hashed_extension_id.cc",
    "hashed_extension_id.h",
    "icons/extension_icon_set.cc",
    "icons/extension_icon_set.h",
    "icons/extension_icon_variant.cc",
    "icons/extension_icon_variant.h",
    "icons/extension_icon_variants.cc",
    "icons/extension_icon_variants.h",
    "icons/extension_icon_variants_diagnostics.cc",
    "icons/extension_icon_variants_diagnostics.h",
    "image_util.cc",
    "image_util.h",
    "install_warning.cc",
    "install_warning.h",
    "manifest.cc",
    "manifest.h",
    "manifest_constants.h",
    "manifest_handler.cc",
    "manifest_handler.h",
    "manifest_handler_helpers.cc",
    "manifest_handler_helpers.h",
    "manifest_handler_registry.cc",
    "manifest_handler_registry.h",
    "manifest_handlers/app_display_info.cc",
    "manifest_handlers/app_display_info.h",
    "manifest_handlers/automation.cc",
    "manifest_handlers/automation.h",
    "manifest_handlers/background_info.cc",
    "manifest_handlers/background_info.h",
    "manifest_handlers/content_capabilities_handler.cc",
    "manifest_handlers/content_capabilities_handler.h",
    "manifest_handlers/content_scripts_handler.cc",
    "manifest_handlers/content_scripts_handler.h",
    "manifest_handlers/cross_origin_isolation_info.cc",
    "manifest_handlers/cross_origin_isolation_info.h",
    "manifest_handlers/csp_info.cc",
    "manifest_handlers/csp_info.h",
    "manifest_handlers/default_locale_handler.cc",
    "manifest_handlers/default_locale_handler.h",
    "manifest_handlers/extension_action_handler.cc",
    "manifest_handlers/extension_action_handler.h",
    "manifest_handlers/externally_connectable.cc",
    "manifest_handlers/externally_connectable.h",
    "manifest_handlers/file_handler_info.cc",
    "manifest_handlers/file_handler_info.h",
    "manifest_handlers/icon_variants_handler.cc",
    "manifest_handlers/icon_variants_handler.h",
    "manifest_handlers/icons_handler.cc",
    "manifest_handlers/icons_handler.h",
    "manifest_handlers/incognito_info.cc",
    "manifest_handlers/incognito_info.h",
    "manifest_handlers/kiosk_mode_info.cc",
    "manifest_handlers/kiosk_mode_info.h",
    "manifest_handlers/mime_types_handler.cc",
    "manifest_handlers/mime_types_handler.h",
    "manifest_handlers/oauth2_manifest_handler.cc",
    "manifest_handlers/oauth2_manifest_handler.h",
    "manifest_handlers/offline_enabled_info.cc",
    "manifest_handlers/offline_enabled_info.h",
    "manifest_handlers/options_page_info.cc",
    "manifest_handlers/options_page_info.h",
    "manifest_handlers/permissions_parser.cc",
    "manifest_handlers/permissions_parser.h",
    "manifest_handlers/replacement_apps.cc",
    "manifest_handlers/replacement_apps.h",
    "manifest_handlers/requirements_info.cc",
    "manifest_handlers/requirements_info.h",
    "manifest_handlers/sandboxed_page_info.cc",
    "manifest_handlers/sandboxed_page_info.h",
    "manifest_handlers/shared_module_info.cc",
    "manifest_handlers/shared_module_info.h",
    "manifest_handlers/trial_tokens_handler.cc",
    "manifest_handlers/trial_tokens_handler.h",
    "manifest_handlers/web_accessible_resources_info.cc",
    "manifest_handlers/web_accessible_resources_info.h",
    "manifest_handlers/web_file_handlers_info.cc",
    "manifest_handlers/web_file_handlers_info.h",
    "manifest_handlers/webview_info.cc",
    "manifest_handlers/webview_info.h",
    "manifest_url_handlers.cc",
    "manifest_url_handlers.h",
    "message_bundle.cc",
    "message_bundle.h",
    "permissions/api_permission.cc",
    "permissions/api_permission.h",
    "permissions/api_permission_set.cc",
    "permissions/api_permission_set.h",
    "permissions/base_set_operators.h",
    "permissions/extensions_api_permissions.cc",
    "permissions/extensions_api_permissions.h",
    "permissions/manifest_permission.cc",
    "permissions/manifest_permission.h",
    "permissions/manifest_permission_set.cc",
    "permissions/manifest_permission_set.h",
    "permissions/permission_message.cc",
    "permissions/permission_message.h",
    "permissions/permission_message_provider.cc",
    "permissions/permission_message_provider.h",
    "permissions/permission_message_util.cc",
    "permissions/permission_message_util.h",
    "permissions/permission_set.cc",
    "permissions/permission_set.h",
    "permissions/permissions_data.cc",
    "permissions/permissions_data.h",
    "permissions/permissions_info.cc",
    "permissions/permissions_info.h",
    "permissions/set_disjunction_permission.h",
    "permissions/settings_override_permission.cc",
    "permissions/settings_override_permission.h",
    "permissions/socket_permission.cc",
    "permissions/socket_permission.h",
    "permissions/socket_permission_data.cc",
    "permissions/socket_permission_data.h",
    "permissions/socket_permission_entry.cc",
    "permissions/socket_permission_entry.h",
    "permissions/usb_device_permission.cc",
    "permissions/usb_device_permission.h",
    "permissions/usb_device_permission_data.cc",
    "permissions/usb_device_permission_data.h",
    "process_context_data.h",
    "script_constants.h",
    "stack_frame.cc",
    "stack_frame.h",
    "switches.cc",
    "switches.h",
    "trace_util.cc",
    "trace_util.h",
    "url_pattern.cc",
    "url_pattern.h",
    "url_pattern_set.cc",
    "url_pattern_set.h",
    "user_script.cc",
    "user_script.h",
    "utils/base_string.cc",
    "utils/base_string.h",
    "utils/content_script_utils.cc",
    "utils/content_script_utils.h",
    "utils/extension_types_utils.cc",
    "utils/extension_types_utils.h",
    "utils/extension_utils.cc",
    "utils/extension_utils.h",
    "value_counter.cc",
    "value_counter.h",
    "verifier_formats.cc",
    "verifier_formats.h",
    "view_type_util.cc",
    "view_type_util.h",
    "web_file_handler_constants.h",
  ]

  configs += [
    "//build/config:precompiled_headers",
    "//build/config/compiler:wexit_time_destructors",
  ]

  public_deps = [
    ":common_constants",
    ":mojom",
    "//components/services/app_service",
    "//content/public/common",
    "//ipc",
    "//skia",
  ]

  # Allows including manifest_handler.h and permissions/permissions_info.h
  # from mojom/permission_set_mojom_traits.cc.
  allow_circular_includes_from = [ ":mojom" ]

  deps = [
    "//base",
    "//build:android_buildflags",
    "//build:branding_buildflags",
    "//build:chromeos_buildflags",
    "//components/crash/core/common",
    "//components/crx_file",
    "//components/nacl/common:buildflags",
    "//components/safe_browsing/core/common",
    "//components/safe_browsing/core/common/hashprefix_realtime:hash_realtime_utils",
    "//components/url_formatter",
    "//components/url_matcher",
    "//components/version_info",
    "//crypto",
    "//device/bluetooth",
    "//device/bluetooth/public/cpp",
    "//extensions/common/api",
    "//extensions/strings",
    "//net",
    "//services/device/public/cpp/usb",
    "//services/device/public/mojom:usb",
    "//services/network/public/mojom",
    "//third_party/boringssl",
    "//third_party/icu",
    "//third_party/re2",
    "//third_party/zlib/google:compression_utils",
    "//tools/json_schema_compiler:generated_api_util",
    "//ui/base",
    "//ui/gfx/geometry",
    "//ui/gfx/ipc",
    "//ui/gfx/ipc/geometry",
    "//ui/gfx/ipc/skia",
    "//url",
  ]

  if (enable_extensions) {
    deps += [ "//extensions:extensions_resources" ]
  }

  if (enable_nacl) {
    sources += [
      "manifest_handlers/nacl_modules_handler.cc",
      "manifest_handlers/nacl_modules_handler.h",
    ]
  }

  if (is_chromeos) {
    sources += [
      "manifest_handlers/action_handlers_handler.cc",
      "manifest_handlers/action_handlers_handler.h",
    ]
  }
  if (is_chromeos_ash) {
    sources += [
      "manifest_handlers/input_components_handler.cc",
      "manifest_handlers/input_components_handler.h",
    ]
  }
}

# NOTE: This is separate from ":common" because it depends on
# extensions/common/api:extensions_features, which in turn depends on
# :common.
source_set("core_api_provider") {
  sources = [
    "core_extensions_api_provider.cc",
    "core_extensions_api_provider.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]
  deps = [
    ":common",
    "//extensions:extensions_resources",
    "//extensions/common/api",
    "//extensions/common/api:extensions_features",
  ]
}

source_set("test_support") {
  testonly = true

  sources = [
    "api/declarative_net_request/test_utils.cc",
    "api/declarative_net_request/test_utils.h",
    "api/extension_action/action_info_test_util.cc",
    "api/extension_action/action_info_test_util.h",
    "warnings_test_util.cc",
    "warnings_test_util.h",
  ]

  deps = [
    ":common",
    "//base",
    "//base/test:test_support",
    "//components/version_info:channel",
    "//extensions/common/api",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

# TODO(https://crbug.com/356905053): Gradually include more of these sources
# in the desktop-android build.
if (enable_extensions) {
  source_set("unit_tests") {
    testonly = true
    sources = [
      "api/commands/commands_manifest_unittest.cc",
      "api/declarative/declarative_manifest_unittest.cc",
      "api/declarative_net_request/dnr_manifest_unittest.cc",
      "api/messaging/messaging_endpoint_unittest.cc",
      "api/printer_provider/usb_printer_manifest_unittest.cc",
      "api/scripts_internal/script_serialization_unittest.cc",
      "api/sockets/sockets_manifest_permission_unittest.cc",
      "command_unittest.cc",
      "component_extension_url_pattern_unittest.cc",
      "crash_keys_unittest.cc",
      "csp_validator_unittest.cc",
      "error_utils_unittest.cc",
      "event_filter_unittest.cc",
      "extension_builder_unittest.cc",
      "extension_l10n_util_unittest.cc",
      "extension_resource_path_normalizer_unittest.cc",
      "extension_resource_unittest.cc",
      "extension_set_unittest.cc",
      "extension_unittest.cc",
      "extension_urls_unittest.cc",
      "feature_switch_unittest.cc",
      "features/complex_feature_unittest.cc",
      "features/feature_provider_unittest.cc",
      "features/simple_feature_unittest.cc",
      "file_util_unittest.cc",
      "hashed_extension_id_unittest.cc",
      "icons/extension_icon_set_unittest.cc",
      "image_util_unittest.cc",
      "manifest_handler_perf_test.cc",
      "manifest_handler_unittest.cc",
      "manifest_handlers/content_capabilities_manifest_unittest.cc",
      "manifest_handlers/csp_info_unittest.cc",
      "manifest_handlers/default_locale_manifest_unittest.cc",
      "manifest_handlers/extension_action_handler_unittest.cc",
      "manifest_handlers/extension_action_page_action_unittest.cc",
      "manifest_handlers/extension_manifests_icon_variants_unittest.cc",
      "manifest_handlers/externally_connectable_unittest.cc",
      "manifest_handlers/homepage_url_unittest.cc",
      "manifest_handlers/icons_handler_unittest.cc",
      "manifest_handlers/incognito_manifest_unittest.cc",
      "manifest_handlers/kiosk_mode_info_unittest.cc",
      "manifest_handlers/manifest_url_about_unittest.cc",
      "manifest_handlers/manifest_v3_permissions_unittest.cc",
      "manifest_handlers/mime_types_handler_unittest.cc",
      "manifest_handlers/oauth2_manifest_unittest.cc",
      "manifest_handlers/replacement_apps_unittest.cc",
      "manifest_handlers/requirements_unittest.cc",
      "manifest_handlers/shared_module_manifest_unittest.cc",
      "manifest_handlers/trial_tokens_unittest.cc",
      "manifest_handlers/update_url_unittest.cc",
      "manifest_unittest.cc",
      "message_bundle_unittest.cc",
      "mojom/message_port_mojom_traits_unittest.cc",
      "mojom/permission_set_mojom_traits_unittest.cc",
      "mojom/url_pattern_set_mojom_traits_unittest.cc",
      "permissions/api_permission_set_unittest.cc",
      "permissions/api_permission_unittest.cc",
      "permissions/base_set_operators_unittest.cc",
      "permissions/manifest_permission_set_unittest.cc",
      "permissions/socket_permission_unittest.cc",
      "permissions/usb_device_permission_unittest.cc",
      "stack_frame_unittest.cc",
      "url_pattern_set_unittest.cc",
      "url_pattern_unittest.cc",
      "user_script_unittest.cc",
      "utils/extension_types_utils_unittest.cc",
      "value_counter_unittest.cc",
    ]

    deps = [
      ":common",
      ":test_support",
      "//base",
      "//base:i18n",
      "//base/test:test_support",
      "//components/crx_file",
      "//components/version_info:version_info",
      "//content/test:test_support",
      "//extensions:extensions_resources",
      "//extensions/common:mojom",
      "//extensions/common/api",
      "//mojo/public/cpp/test_support:test_utils",
      "//tools/json_schema_compiler:generated_api_util",

      # TODO(brettw) these tests should not be including headers from browser.
      "//extensions:test_support",
      "//extensions/browser",
      "//extensions/strings",
      "//ipc",
      "//services/device/public/cpp:test_support",
      "//testing/gmock",
      "//testing/gtest",
      "//third_party/zlib/google:compression_utils",
      "//ui/base",
      "//ui/gfx",
      "//url",
    ]

    if (is_chromeos) {
      sources += [ "manifest_handlers/file_handler_manifest_unittest.cc" ]
    }

    if (is_chromeos_ash) {
      sources += [ "manifest_handlers/action_handlers_handler_unittest.cc" ]
    }

    data = [
      "//extensions/common/mojom/api_permission_id.mojom",
      "//tools/metrics/histograms/metadata/extensions/enums.xml",
    ]
  }

  fuzzer_test("extension_fuzzer") {
    sources = [ "extension_fuzzer.cc" ]
    deps = [
      ":common",
      "//base",
    ]
  }

  fuzzer_test("extension_manifest_fuzzer") {
    sources = [ "manifest_fuzzer.cc" ]
    deps = [
      ":common",
      "//base",
      "//extensions:test_support",
    ]

    # The fuzzed code needs more RAM that the default limit.
    libfuzzer_options = [ "rss_limit_mb=4096" ]
  }

  fuzzer_test("extension_url_pattern_fuzzer") {
    sources = [ "url_pattern_fuzzer.cc" ]
    deps = [
      ":common",
      "//base",
    ]
  }

  fuzzer_test("extension_csp_validator_fuzzer") {
    sources = [ "csp_validator_fuzzer.cc" ]
    deps = [
      ":common",
      "//base",
      "//third_party/icu/fuzzers:fuzzer_support",
    ]

    # The fuzzed code needs more RAM that the default limit.
    libfuzzer_options = [ "rss_limit_mb=4096" ]
  }

  fuzzer_test("extension_api_scripts_internal_serialization_fuzzer") {
    sources = [ "api/scripts_internal/script_serialization_fuzzer.cc" ]
    deps = [
      ":common",
      "//base",
      "//extensions:test_support",
      "//extensions/common/api",
      "//third_party/abseil-cpp:absl",
      "//third_party/icu/fuzzers:fuzzer_support",
    ]

    # The fuzzed code needs more RAM that the default limit.
    libfuzzer_options = [ "rss_limit_mb=4096" ]
  }
}