# Copyright 2015 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("//pdf/features.gni")
import("//testing/test.gni")

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

  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//components/services/font/public/mojom",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/system",
    "//pdf:buildflags",
    "//third_party/fontconfig",
    "//ui/gfx",
  ]

  public_deps = [ "//skia" ]

  if (enable_pdf && (is_linux || is_chromeos)) {
    sources += [
      "pdf_fontconfig_matching.cc",
      "pdf_fontconfig_matching.h",
    ]

    deps += [
      "//third_party/blink/public:blink_headers",
      "//third_party/pdfium:pdfium_public_headers",
    ]
  }
}

test("font_service_unittests") {
  sources = [ "font_loader_unittest.cc" ]

  deps = [
    ":lib",
    "//base",
    "//base/test:test_support",
    "//components/services/font/public/cpp",
    "//components/services/font/public/mojom",
    "//mojo/core/test:run_all_unittests",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/system",
    "//pdf:buildflags",
    "//skia",
    "//testing/gtest",
  ]

  if (enable_pdf) {
    deps += [
      "//third_party:freetype_harfbuzz",
      "//third_party/pdfium:pdfium_public_headers",
    ]
  }
}