# 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("//services/service_manager/public/cpp/service.gni")
import("//services/service_manager/public/service_manifest.gni")

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

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

  public_deps = [
    "//components/services/filesystem/public/interfaces",
    "//components/services/unzip/public/interfaces",
    "//services/service_manager/public/cpp",
  ]
}

bundle_data("unit_tests_bundle_data") {
  visibility = [ ":unit_tests" ]
  testonly = true
  sources = [
    "//components/test/data/unzip_service/bad_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",
    "//services/service_manager/public/cpp/test:test_support",
    "//testing/gtest",
  ]
}

service_manifest("manifest") {
  name = "unzip_service"
  source = "manifest.json"
}
