chromium/components/lookalikes/core/BUILD.gn

# Copyright 2020 The Chromium Authors
# 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")

static_library("core") {
  sources = [
    "lookalike_url_ui_util.cc",
    "lookalike_url_ui_util.h",
    "lookalike_url_util.cc",
    "lookalike_url_util.h",
  ]
  deps = [
    ":proto",
    ":safety_tips",
    "//base",
    "//components/pref_registry",
    "//components/prefs:prefs",
    "//components/security_interstitials/core",
    "//components/strings",
    "//components/url_formatter",
    "//components/url_formatter/spoof_checks/common_words:common",
    "//components/url_formatter/spoof_checks/top_domains:common",
    "//components/url_formatter/spoof_checks/top_domains:top_bucket_domains",
    "//components/url_formatter/spoof_checks/top_domains:top_bucket_domains_header",
    "//components/version_info:channel",
    "//net",
    "//services/metrics/public/cpp:metrics_cpp",
    "//services/metrics/public/cpp:ukm_builders",
    "//ui/base",
  ]
}

static_library("safety_tips") {
  sources = [
    "safety_tip_test_utils.cc",
    "safety_tip_test_utils.h",
    "safety_tips_config.cc",
    "safety_tips_config.h",
  ]
  deps = [
    ":proto",
    "//components/safe_browsing/core/browser/db:v4_protocol_manager_util",
    "//components/security_state/core",
    "//third_party/re2",
    "//url",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "lookalike_url_util_unittest.cc",
    "safety_tips_config_unittest.cc",
  ]

  deps = [
    ":core",
    ":proto",
    ":safety_tips",
    "//components/url_formatter/spoof_checks/common_words:common",
    "//components/url_formatter/spoof_checks/common_words:common_words_dafsa",
    "//components/url_formatter/spoof_checks/top_domains:generate_top_domains_test_trie",
    "//components/url_formatter/spoof_checks/top_domains:test_top_bucket_domains",
    "//components/url_formatter/spoof_checks/top_domains:test_top_bucket_domains_header",
    "//components/version_info:channel",
    "//net:test_support",
    "//testing/gtest",
  ]
}

proto_library("proto") {
  sources = [ "safety_tips.proto" ]
}

fuzzer_test("lookalike_url_util_fuzzer") {
  sources = [ "lookalike_url_util_fuzzer.cc" ]
  deps = [
    ":core",
    ":proto",
    "//base:i18n",
    "//third_party/abseil-cpp:absl",
    "//third_party/icu",
  ]
}