chromium/components/subresource_filter/core/common/BUILD.gn

# Copyright 2016 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")

static_library("common") {
  sources = [
    "activation_decision.h",
    "activation_list.cc",
    "activation_list.h",
    "activation_scope.cc",
    "activation_scope.h",
    "common_features.cc",
    "common_features.h",
    "constants.cc",
    "constants.h",
    "document_subresource_filter.cc",
    "document_subresource_filter.h",
    "first_party_origin.cc",
    "first_party_origin.h",
    "indexed_ruleset.cc",
    "indexed_ruleset.h",
    "load_policy.cc",
    "load_policy.h",
    "memory_mapped_ruleset.cc",
    "memory_mapped_ruleset.h",
    "ruleset_config.h",
    "ruleset_dealer.cc",
    "ruleset_dealer.h",
    "scoped_timers.h",
    "time_measurements.cc",
    "time_measurements.h",
    "unindexed_ruleset.cc",
    "unindexed_ruleset.h",
  ]

  public_deps = [
    "//components/subresource_filter/core/common/flat:indexed_ruleset",
    "//components/subresource_filter/core/mojom",
    "//components/url_pattern_index",
  ]

  deps = [
    "//base",
    "//net",
    "//third_party/abseil-cpp:absl",
    "//third_party/flatbuffers",
    "//third_party/protobuf:protobuf_lite",
    "//url",
  ]

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

static_library("test_support") {
  testonly = true
  sources = [
    "test_ruleset_creator.cc",
    "test_ruleset_creator.h",
    "test_ruleset_utils.cc",
    "test_ruleset_utils.h",
  ]
  public_deps = [ ":common" ]
  deps = [
    "//base",
    "//net",
    "//testing/gtest",
    "//third_party/protobuf:protobuf_lite",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "document_subresource_filter_unittest.cc",
    "first_party_origin_unittest.cc",
    "indexed_ruleset_unittest.cc",
    "load_policy_unittest.cc",
    "ruleset_dealer_unittest.cc",
    "scoped_timers_unittest.cc",
    "time_measurements_unittest.cc",
    "unindexed_ruleset_unittest.cc",
  ]
  deps = [
    ":common",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/url_pattern_index:test_support",
    "//testing/gtest",
    "//third_party/protobuf:protobuf_lite",
    "//url",
  ]
  if (is_ios) {
    deps += [ "//components/test:subresource_filter_test_bundle_data" ]
  }
}

fuzzer_test("indexed_ruleset_fuzzer") {
  sources = [ "indexed_ruleset_fuzzer.cc" ]
  deps = [
    ":common",
    "//base",
    "//base/test:test_support",
    "//url",
  ]
}