chromium/components/custom_handlers/BUILD.gn

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

static_library("custom_handlers") {
  sources = [
    "pref_names.cc",
    "pref_names.h",
    "protocol_handler.cc",
    "protocol_handler.h",
    "protocol_handler_registry.cc",
    "protocol_handler_registry.h",
    "protocol_handler_throttle.cc",
    "protocol_handler_throttle.h",
  ]

  deps = [
    "//build:chromeos_buildflags",
    "//components/keyed_service/content",
    "//components/keyed_service/core",
    "//components/pref_registry",
    "//components/prefs",
    "//components/strings",
    "//components/user_prefs",
    "//content/public/browser",
    "//content/public/common",
    "//net",
    "//services/network/public/cpp:cpp_base",
    "//third_party/blink/public/common:headers",
  ]

  if (!is_android) {
    sources += [
      "register_protocol_handler_permission_request.cc",
      "register_protocol_handler_permission_request.h",
    ]

    deps += [
      "//components/permissions",
      "//ui/base",
    ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "simple_protocol_handler_registry_factory.cc",
    "simple_protocol_handler_registry_factory.h",
    "test_protocol_handler_registry_delegate.cc",
    "test_protocol_handler_registry_delegate.h",
  ]
  deps = [
    ":custom_handlers",
    "//base",
    "//components/keyed_service/content",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [ "protocol_handler_registry_unittest.cc" ]

  deps = [
    ":custom_handlers",
    ":test_support",
    "//base/test:test_support",
    "//components/pref_registry",
    "//components/sync_preferences",
    "//components/sync_preferences:test_support",
    "//components/user_prefs",
    "//content/public/browser",
    "//content/public/common",
    "//content/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/blink/public/common:headers",
  ]
}

source_set("browser_tests") {
  testonly = true
  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
  sources = [ "protocol_handler_registry_browsertest.cc" ]
  deps = [
    ":custom_handlers",
    ":test_support",
    "//base/test:test_support",
    "//components/keyed_service/content",
    "//content/shell:content_shell_lib",
    "//content/test:browsertest_support",
    "//content/test:test_support",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
  if (is_ios) {
    deps += [
      "//components/test:custom_handlers_test_bundle_data",
      "//components/test:fenced_frames_test_bundle_data",
    ]
  }
}