# 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("//third_party/protobuf/proto_library.gni") import("//testing/libfuzzer/fuzzer_test.gni") proto_library("safebrowsing_proto") { sources = [ "safebrowsing.proto", ] } proto_library("v4_store_proto") { sources = [ "v4_store.proto", ] deps = [ ":safebrowsing_proto", ] } proto_library("metadata_proto") { sources = [ "metadata.proto", ] } # This target is shared between the desktop and mobile versions. group("safe_browsing_db_shared") { deps = [ ":database_manager", ":hit_report", ":prefix_set", ":safebrowsing_proto", ":util", ":v4_feature_list", # Used by SafeBrowsingService "//components/safe_browsing/common:safe_browsing_prefs", ] } # This target is for the desktop version. group("db") { deps = [ ":safe_browsing_db_shared", ":v4_local_database_manager", ] } static_library("database_manager") { sources = [ "database_manager.cc", "database_manager.h", ] deps = [ ":hit_report", ":util", ":v4_get_hash_protocol_manager", ":v4_protocol_manager_util", "//base", "//content/public/browser", "//content/public/common", "//net", "//url", ] public_deps = [ ":safebrowsing_proto", ] } static_library("hit_report") { sources = [ "hit_report.cc", "hit_report.h", ] public_deps = [ ":util", ] deps = [ "//components/metrics", "//components/safe_browsing/common:safe_browsing_prefs", "//url", ] } static_library("prefix_set") { sources = [ "prefix_set.cc", "prefix_set.h", ] deps = [ ":util", "//base", ] } static_library("test_database_manager") { sources = [ "test_database_manager.cc", "test_database_manager.h", ] deps = [ ":database_manager", ":v4_protocol_manager_util", "//base:base", "//net", ] } static_library("util") { sources = [ "util.cc", "util.h", ] public_deps = [ ":v4_protocol_manager_util", "//components/safe_browsing/common:safe_browsing_prefs", ] deps = [ "//base", "//components/version_info:version_info", "//crypto", "//google_apis:google_apis", "//net", "//url", ] if (is_win) { # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. cflags = [ "/wd4267" ] # Conversion from size_t to 'type'. } } static_library("v4_database") { sources = [ "v4_database.cc", "v4_database.h", ] public_deps = [ ":safebrowsing_proto", ] deps = [ ":v4_protocol_manager_util", ":v4_store", "//base", "//components/safe_browsing:webui_proto", "//content/public/browser", ] } static_library("v4_feature_list") { sources = [ "v4_feature_list.cc", "v4_feature_list.h", ] deps = [ "//base", "//components/safe_browsing:features", ] } static_library("v4_get_hash_protocol_manager") { sources = [ "v4_get_hash_protocol_manager.cc", "v4_get_hash_protocol_manager.h", ] public_deps = [ ":safebrowsing_proto", ] deps = [ ":util", ":v4_protocol_manager_util", "//base", "//components/data_use_measurement/core", "//components/safe_browsing:webui_proto", "//content/public/browser", "//net", "//url", ] } static_library("v4_local_database_manager") { sources = [ "v4_local_database_manager.cc", "v4_local_database_manager.h", ] deps = [ ":database_manager", ":hit_report", ":safebrowsing_proto", ":v4_database", ":v4_feature_list", ":v4_get_hash_protocol_manager", ":v4_protocol_manager_util", ":v4_update_protocol_manager", "//base", "//components/safe_browsing:webui_proto", "//content/public/browser", "//crypto", "//net", "//url", ] } source_set("v4_protocol_manager_util") { sources = [ "v4_protocol_manager_util.cc", "v4_protocol_manager_util.h", ] public_deps = [ ":safebrowsing_proto", ] deps = [ "//base", "//net", "//url", ] } if (is_android) { import("//build/config/android/rules.gni") java_cpp_enum("sb_threat_values") { sources = [ "v4_protocol_manager_util.h", ] } } source_set("v4_rice") { sources = [ "v4_rice.cc", "v4_rice.h", ] deps = [ "//base", "//third_party/protobuf:protobuf_lite", ] } source_set("v4_store") { sources = [ "v4_store.cc", "v4_store.h", ] public_deps = [ ":safebrowsing_proto", ":v4_store_proto", ] deps = [ ":v4_protocol_manager_util", ":v4_rice", "//base", "//components/safe_browsing:webui_proto", "//crypto", ] } static_library("v4_test_util") { testonly = true sources = [ "v4_embedded_test_server_util.cc", "v4_embedded_test_server_util.h", "v4_test_util.cc", "v4_test_util.h", ] deps = [ ":util", ":v4_database", ":v4_get_hash_protocol_manager", ":v4_protocol_manager_util", "//base", "//net:test_support", ] } static_library("v4_update_protocol_manager") { sources = [ "v4_update_protocol_manager.cc", "v4_update_protocol_manager.h", ] deps = [ ":safebrowsing_proto", ":util", ":v4_protocol_manager_util", "//base", "//components/data_use_measurement/core", "//components/safe_browsing:webui_proto", "//components/safe_browsing/common:safe_browsing_prefs", "//net", "//url", ] } source_set("v4_database_unittest") { testonly = true sources = [ "v4_database_unittest.cc", ] deps = [ ":v4_database", ":v4_store", "//base", "//base/test:test_support", "//content/test:test_support", "//testing/gtest", ] } source_set("v4_get_hash_protocol_manager_unittest") { testonly = true sources = [ "v4_get_hash_protocol_manager_unittest.cc", ] deps = [ ":safebrowsing_proto", ":util", ":v4_database", ":v4_get_hash_protocol_manager", ":v4_local_database_manager", ":v4_test_util", "//base", "//base/test:test_support", "//content/test:test_support", "//net", "//net:test_support", "//testing/gtest", ] } source_set("v4_local_database_manager_unittest") { testonly = true sources = [ "v4_local_database_manager_unittest.cc", ] deps = [ ":v4_database", ":v4_local_database_manager", ":v4_protocol_manager_util", ":v4_test_util", "//base", "//base/test:test_support", "//content/test:test_support", "//net", "//net:test_support", "//testing/gtest", ] } source_set("v4_update_protocol_manager_unittest") { testonly = true sources = [ "v4_update_protocol_manager_unittest.cc", ] deps = [ ":safebrowsing_proto", ":util", ":v4_test_util", ":v4_update_protocol_manager", "//base", "//base/test:test_support", "//net", "//net:test_support", "//testing/gtest", ] } source_set("unit_tests_shared") { testonly = true sources = [ "database_manager_unittest.cc", "prefix_set_unittest.cc", "util_unittest.cc", "v4_get_hash_protocol_manager_unittest.cc", "v4_protocol_manager_util_unittest.cc", "whitelist_checker_client_unittest.cc", ] deps = [ ":database_manager", ":prefix_set", ":safebrowsing_proto", ":test_database_manager", ":util", ":v4_get_hash_protocol_manager", ":v4_protocol_manager_util", ":v4_test_util", ":whitelist_checker_client", "//base", "//content/public/browser", "//content/test:test_support", "//net", "//net:test_support", "//testing/gtest", ] if (is_win) { # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. cflags = [ "/wd4267" ] # Conversion from size_t to 'type'. } } source_set("unit_tests_desktop") { testonly = true sources = [ "v4_database_unittest.cc", "v4_local_database_manager_unittest.cc", "v4_rice_unittest.cc", "v4_store_unittest.cc", "v4_update_protocol_manager_unittest.cc", ] deps = [ ":unit_tests_shared", ":util", ":v4_database", ":v4_local_database_manager", ":v4_protocol_manager_util", ":v4_rice", ":v4_store", ":v4_store_proto", ":v4_test_util", ":v4_update_protocol_manager", "//base", "//components/prefs:test_support", "//components/safe_browsing/common:safe_browsing_prefs", "//content/test:test_support", "//crypto", "//net", "//net:test_support", "//testing/gtest", "//url", ] if (is_win) { # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. cflags = [ "/wd4267" ] # Conversion from size_t to 'type'. } } static_library("whitelist_checker_client") { sources = [ "whitelist_checker_client.cc", "whitelist_checker_client.h", ] deps = [ ":database_manager", "//base:base", ] } source_set("whitelist_checker_client_unittest") { testonly = true sources = [ "whitelist_checker_client_unittest.cc", ] deps = [ ":database_manager", ":test_database_manager", ":whitelist_checker_client", "//base:base", "//base/test:test_support", "//content/public/browser", "//content/test:test_support", "//testing/gmock:gmock", "//testing/gtest:gtest", ] } fuzzer_test("v4_get_hash_protocol_manager_fuzzer") { sources = [ "v4_get_hash_protocol_manager_fuzzer.cc", ] deps = [ ":safebrowsing_proto", ":v4_get_hash_protocol_manager", ] }