chromium/components/services/unzip/BUILD.gn

# 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.

source_set("lib") {
  sources = [
    "unzipper_impl.cc",
    "unzipper_impl.h",
  ]

  deps = [
    "//base",
    "//mojo/public/cpp/bindings",
    "//third_party/ced",
    "//third_party/zlib",
    "//third_party/zlib/google:zip",
  ]

  public_deps = [
    "//components/services/storage/public/cpp/filesystem",
    "//components/services/unzip/public/mojom",
  ]
}

source_set("in_process") {
  # NOTE: In-process unzipping is unsafe! Unfortunately on iOS we have no other
  # choice. On all other platforms, this target is restricted to tests.
  testonly = !is_ios

  sources = [
    "in_process_unzipper.cc",
    "in_process_unzipper.h",
  ]

  deps = [
    ":lib",
    "//base",
  ]

  public_deps = [
    "//components/services/unzip/public/mojom",
    "//mojo/public/cpp/bindings",
  ]
}

bundle_data("unit_tests_bundle_data") {
  visibility = [ ":unit_tests" ]
  testonly = true
  sources = [
    "//components/test/data/unzip_service/DifferentEncryptions.zip",
    "//components/test/data/unzip_service/Duplicate Filenames.zip",
    "//components/test/data/unzip_service/SJIS 00.zip",
    "//components/test/data/unzip_service/SJIS 01.zip",
    "//components/test/data/unzip_service/SJIS 02.zip",
    "//components/test/data/unzip_service/SJIS 03.zip",
    "//components/test/data/unzip_service/SJIS 04.zip",
    "//components/test/data/unzip_service/SJIS 05.zip",
    "//components/test/data/unzip_service/SJIS 06.zip",
    "//components/test/data/unzip_service/SJIS 07.zip",
    "//components/test/data/unzip_service/SJIS 08.zip",
    "//components/test/data/unzip_service/SJIS 09.zip",
    "//components/test/data/unzip_service/SJIS 10.zip",
    "//components/test/data/unzip_service/SJIS 11.zip",
    "//components/test/data/unzip_service/SJIS 12.zip",
    "//components/test/data/unzip_service/SJIS 13.zip",
    "//components/test/data/unzip_service/UTF8 (Bug 903664).zip",
    "//components/test/data/unzip_service/Wrong CRC.zip",
    "//components/test/data/unzip_service/bad_archive.zip",
    "//components/test/data/unzip_service/bug953599.zip",
    "//components/test/data/unzip_service/encrypted_archive.zip",
    "//components/test/data/unzip_service/good_archive.zip",
  ]
  outputs = [ "{{bundle_resources_dir}}/" +
              "{{source_root_relative_dir}}/{{source_file_part}}" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [ "public/cpp/unzip_unittest.cc" ]

  deps = [
    ":lib",
    ":unit_tests_bundle_data",
    "//base",
    "//base/test:test_support",
    "//components/services/unzip/public/cpp",
    "//testing/gtest",
  ]
}