# Copyright 2017 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/buildflag_header.gni") import("//build/config/sanitizers/sanitizers.gni") import("//chrome/services/file_util/public/features.gni") import("//components/safe_browsing/buildflags.gni") import("//testing/test.gni") source_set("file_util") { sources = [ "file_util_service.cc", "file_util_service.h", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] deps = [ ":buildflags", "//base", "//build:chromeos_buildflags", "//components/enterprise/obfuscation/core:enterprise_obfuscation", "//components/safe_browsing:buildflags", "//extensions/buildflags", "//mojo/public/cpp/bindings", "//third_party/zlib", ] public_deps = [ "//chrome/services/file_util/public/mojom", "//components/safe_browsing/core/common", "//mojo/public/cpp/bindings", "//mojo/public/mojom/base", ] defines = [ "USE_UNRAR=$safe_browsing_use_unrar" ] if (safe_browsing_use_unrar) { deps += [ "//third_party/unrar" ] } if (is_chromeos) { sources += [ "zip_file_creator.cc", "zip_file_creator.h", ] deps += [ "//components/services/filesystem/public/mojom" ] } if (is_mac) { deps += [ "//chrome/utility/safe_browsing" ] } if (safe_browsing_mode == 1) { sources += [ "obfuscated_archive_analysis_delegate.cc", "obfuscated_archive_analysis_delegate.h", "regular_archive_analysis_delegate.cc", "regular_archive_analysis_delegate.h", "safe_archive_analyzer.cc", "safe_archive_analyzer.h", ] deps += [ "//chrome/common/safe_browsing", "//chrome/common/safe_browsing:archive_analyzer_results", "//chrome/utility/safe_browsing", "//components/enterprise/obfuscation/core:enterprise_obfuscation", ] } if (enable_extractors) { sources += [ "single_file_tar_file_extractor.cc", "single_file_tar_file_extractor.h", "single_file_tar_reader.cc", "single_file_tar_reader.h", "single_file_tar_xz_file_extractor.cc", "single_file_tar_xz_file_extractor.h", ] deps += [ "//third_party/lzma_sdk", "//third_party/lzma_sdk:lzma_sdk_xz", ] } } source_set("unit_tests") { testonly = true if (enable_extractors) { sources = [ "single_file_tar_file_extractor_unittest.cc", "single_file_tar_reader_unittest.cc", "single_file_tar_xz_file_extractor_unittest.cc", ] deps = [ ":file_util", "//base/test:test_support", "//chrome/common:constants", "//testing/gmock", "//testing/gtest", ] } } source_set("test_support") { testonly = true sources = [ "fake_file_util_service.cc", "fake_file_util_service.h", ] deps = [ ":buildflags", "//base", "//build:chromeos_buildflags", "//chrome/services/file_util/public/mojom", "//components/safe_browsing:buildflags", "//extensions/buildflags", "//mojo/public/cpp/bindings", "//testing/gmock", "//third_party/abseil-cpp:absl", ] } buildflag_header("buildflags") { header = "buildflags.h" flags = [ "ENABLE_EXTRACTORS=$enable_extractors" ] } if (enable_extractors) { test("single_file_tar_reader_fuzzer") { sources = [ "single_file_tar_reader_fuzzer.cc" ] fuzztests = [ "SingleFileTarReaderTest.ExtractChunkNeverCrashes" ] deps = [ ":file_util", "//third_party/fuzztest:fuzztest_gtest_main", ] if (safe_browsing_mode == 1) { deps += [ "//chrome/common" ] } if (is_mac) { frameworks = [ "AppKit.framework" ] } } }