# Copyright 2018 The PDFium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("../../../pdfium.gni")
import("../../../testing/test.gni")

source_set("parser") {
  sources = [
    "cfdf_document.cpp",
    "cfdf_document.h",
    "cpdf_array.cpp",
    "cpdf_array.h",
    "cpdf_boolean.cpp",
    "cpdf_boolean.h",
    "cpdf_cross_ref_avail.cpp",
    "cpdf_cross_ref_avail.h",
    "cpdf_cross_ref_table.cpp",
    "cpdf_cross_ref_table.h",
    "cpdf_crypto_handler.cpp",
    "cpdf_crypto_handler.h",
    "cpdf_data_avail.cpp",
    "cpdf_data_avail.h",
    "cpdf_dictionary.cpp",
    "cpdf_dictionary.h",
    "cpdf_document.cpp",
    "cpdf_document.h",
    "cpdf_encryptor.cpp",
    "cpdf_encryptor.h",
    "cpdf_flateencoder.cpp",
    "cpdf_flateencoder.h",
    "cpdf_hint_tables.cpp",
    "cpdf_hint_tables.h",
    "cpdf_indirect_object_holder.cpp",
    "cpdf_indirect_object_holder.h",
    "cpdf_linearized_header.cpp",
    "cpdf_linearized_header.h",
    "cpdf_name.cpp",
    "cpdf_name.h",
    "cpdf_null.cpp",
    "cpdf_null.h",
    "cpdf_number.cpp",
    "cpdf_number.h",
    "cpdf_object.cpp",
    "cpdf_object.h",
    "cpdf_object_avail.cpp",
    "cpdf_object_avail.h",
    "cpdf_object_stream.cpp",
    "cpdf_object_stream.h",
    "cpdf_object_walker.cpp",
    "cpdf_object_walker.h",
    "cpdf_page_object_avail.cpp",
    "cpdf_page_object_avail.h",
    "cpdf_parser.cpp",
    "cpdf_parser.h",
    "cpdf_read_validator.cpp",
    "cpdf_read_validator.h",
    "cpdf_reference.cpp",
    "cpdf_reference.h",
    "cpdf_security_handler.cpp",
    "cpdf_security_handler.h",
    "cpdf_simple_parser.cpp",
    "cpdf_simple_parser.h",
    "cpdf_stream.cpp",
    "cpdf_stream.h",
    "cpdf_stream_acc.cpp",
    "cpdf_stream_acc.h",
    "cpdf_string.cpp",
    "cpdf_string.h",
    "cpdf_syntax_parser.cpp",
    "cpdf_syntax_parser.h",
    "fpdf_parser_decode.cpp",
    "fpdf_parser_decode.h",
    "fpdf_parser_utility.cpp",
    "fpdf_parser_utility.h",
    "object_tree_traversal_util.cpp",
    "object_tree_traversal_util.h",
  ]
  configs += [ "../../../:pdfium_strict_config" ]
  deps = [
    "../../../constants",
    "../../fdrm",
    "../../fxcodec",
    "../edit:contentstream_write_utils",
  ]
  public_deps = [ "../../fxcrt" ]
  allow_circular_includes_from = []
  visibility = [ "../../../*" ]

  if (pdf_enable_xfa) {
    sources += [
      "cpdf_seekablemultistream.cpp",
      "cpdf_seekablemultistream.h",
    ]
  }
  if (pdf_use_skia) {
    deps += [ "../../fxge" ]
    allow_circular_includes_from += [ "../../fxge" ]
  }
}

source_set("unit_test_support") {
  testonly = true
  sources = [
    "cpdf_test_document.cpp",
    "cpdf_test_document.h",
  ]
  configs += [ "../../../:pdfium_strict_config" ]
  deps = [
    ":parser",
    "../page",
    "../render",
  ]
}

pdfium_unittest_source_set("unittests") {
  sources = [
    "cpdf_array_unittest.cpp",
    "cpdf_cross_ref_avail_unittest.cpp",
    "cpdf_dictionary_unittest.cpp",
    "cpdf_document_unittest.cpp",
    "cpdf_hint_tables_unittest.cpp",
    "cpdf_indirect_object_holder_unittest.cpp",
    "cpdf_number_unittest.cpp",
    "cpdf_object_avail_unittest.cpp",
    "cpdf_object_stream_unittest.cpp",
    "cpdf_object_unittest.cpp",
    "cpdf_object_walker_unittest.cpp",
    "cpdf_page_object_avail_unittest.cpp",
    "cpdf_parser_unittest.cpp",
    "cpdf_read_validator_unittest.cpp",
    "cpdf_simple_parser_unittest.cpp",
    "cpdf_stream_acc_unittest.cpp",
    "cpdf_syntax_parser_unittest.cpp",
    "fpdf_parser_decode_unittest.cpp",
    "fpdf_parser_utility_unittest.cpp",
  ]
  deps = [
    ":parser",
    ":unit_test_support",
    "../../../constants",
    "../../fxcodec",
    "../page",
    "../page:unit_test_support",
    "../render",
  ]
  pdfium_root_dir = "../../../"

  if (pdf_enable_xfa) {
    sources += [ "cpdf_seekablemultistream_unittest.cpp" ]
  }
}

pdfium_embeddertest_source_set("embeddertests") {
  sources = [
    "cpdf_parser_embeddertest.cpp",
    "cpdf_security_handler_embeddertest.cpp",
    "fpdf_parser_decode_embeddertest.cpp",
    "object_tree_traversal_util_embeddertest.cpp",
  ]
  deps = [
    ":parser",
    "../../fxge",
  ]
  pdfium_root_dir = "../../../"
}
