# 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("//build/config/features.gni")
import("//components/optimization_guide/features.gni")
import("//components/safe_browsing/buildflags.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
source_set("phishing_classifier") {
if (safe_browsing_mode != 0) {
sources = [
"features.cc",
"features.h",
"murmurhash3_util.cc",
"murmurhash3_util.h",
"phishing_classifier.cc",
"phishing_classifier.h",
"phishing_classifier_delegate.cc",
"phishing_classifier_delegate.h",
"phishing_dom_feature_extractor.cc",
"phishing_dom_feature_extractor.h",
"phishing_image_embedder.cc",
"phishing_image_embedder.h",
"phishing_image_embedder_delegate.cc",
"phishing_image_embedder_delegate.h",
"phishing_model_setter_impl.cc",
"phishing_model_setter_impl.h",
"phishing_term_feature_extractor.cc",
"phishing_term_feature_extractor.h",
"phishing_url_feature_extractor.cc",
"phishing_url_feature_extractor.h",
"phishing_visual_feature_extractor.cc",
"phishing_visual_feature_extractor.h",
"scorer.cc",
"scorer.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps = [ "//base" ]
deps = [
"//cc/paint",
"//components/optimization_guide:machine_learning_tflite_buildflags",
"//components/paint_preview/common",
"//components/safe_browsing:buildflags",
"//components/safe_browsing/content/common:interfaces",
"//components/safe_browsing/content/common:visual_utils",
"//components/safe_browsing/content/renderer",
"//components/safe_browsing/core/common",
"//components/safe_browsing/core/common/fbs:client_model",
"//components/safe_browsing/core/common/proto:client_model_proto",
"//components/safe_browsing/core/common/proto:csd_proto",
"//content/public/renderer",
"//crypto",
"//mojo/public/mojom/base:protobuf_support",
"//skia",
"//third_party/blink/public:blink_headers",
"//third_party/smhasher:murmurhash3",
"//third_party/tflite",
"//third_party/tflite:tflite_public_headers",
"//third_party/tflite_support",
"//third_party/tflite_support:tflite_support_proto",
"//ui/base",
"//ui/gfx/geometry:geometry",
"//url",
"//v8",
]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"features_unittest.cc",
"murmurhash3_util_unittest.cc",
"phishing_term_feature_extractor_unittest.cc",
"phishing_url_feature_extractor_unittest.cc",
"scorer_unittest.cc",
]
deps = [
":phishing_classifier",
"//base:base",
"//base/test:test_support",
"//components/safe_browsing/content/renderer/phishing_classifier:unit_tests_support",
"//components/safe_browsing/core/common/fbs:client_model",
"//components/safe_browsing/core/common/proto:client_model_proto",
"//components/safe_browsing/core/common/proto:csd_proto",
"//crypto",
"//skia",
"//testing/gmock",
"//testing/gtest",
"//url",
]
}
source_set("unit_tests_support") {
testonly = true
sources = [
"test_utils.cc",
"test_utils.h",
]
deps = [
":phishing_classifier",
"//testing/gmock",
]
}
if (use_fuzzing_engine_with_lpm) {
fuzzer_test("client_side_phishing_fuzzer") {
sources = [ "client_side_phishing_fuzzer.cc" ]
deps = [
":client_side_phishing_fuzzer_proto",
":phishing_classifier",
"//base:base",
"//components/safe_browsing/core/common/fbs:client_model",
"//components/safe_browsing/core/common/proto:client_model_proto",
"//skia",
"//third_party/libprotobuf-mutator",
]
}
fuzzable_proto_library("client_side_phishing_fuzzer_proto") {
proto_in_dir = "//"
sources = [ "client_side_phishing_fuzzer.proto" ]
deps = [ "//components/safe_browsing/core/common/proto:client_model_proto" ]
}
}