chromium/components/cronet/native/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.

import("//components/cronet/native/include/headers.gni")
import("//components/grpc_support/include/headers.gni")
import("//testing/test.gni")

config("cronet_native_include_config") {
  include_dirs = [
    "//components/cronet/native/generated",
    "//components/cronet/native/include",
    "//components/grpc_support/include",
  ]
}

source_set("cronet_native_headers") {
  deps = [
    "//base",
    "//components/grpc_support:headers",
  ]

  configs += [ ":cronet_native_include_config" ]
  public_configs = [ ":cronet_native_include_config" ]

  public = [
    "include/cronet_c.h",
    "include/cronet_export.h",

    # Generated from cronet.idl.
    "generated/cronet.idl_c.h",
    "generated/cronet.idl_impl_interface.h",
    "generated/cronet.idl_impl_struct.h",
  ]
}

# Cross-platform portion of Cronet native API implementation.
source_set("cronet_native_impl") {
  deps = [
    ":cronet_native_headers",
    "//base",
    "//components/cronet:cronet_common",
    "//components/cronet:cronet_version_header",
    "//components/cronet:metrics_util",
    "//components/grpc_support:grpc_support",
    "//net",
  ]

  configs += [ ":cronet_native_include_config" ]
  public_configs = [ ":cronet_native_include_config" ]
  public_deps = [ ":cronet_native_headers" ]

  sources = [
    "buffer.cc",
    "engine.cc",
    "engine.h",
    "io_buffer_with_cronet_buffer.cc",
    "io_buffer_with_cronet_buffer.h",
    "native_metrics_util.cc",
    "native_metrics_util.h",
    "runnables.cc",
    "runnables.h",
    "upload_data_sink.cc",
    "upload_data_sink.h",
    "url_request.cc",
    "url_request.h",

    # Generated from cronet.idl.
    "generated/cronet.idl_impl_interface.cc",
    "generated/cronet.idl_impl_struct.cc",
  ]
}

# Unit tests for Cronet native API. Depends on cronet_native_impl to test
# implementation details.
source_set("cronet_native_unittests") {
  testonly = true

  deps = [
    ":cronet_native_impl",
    "//base/test:test_support",
    "//components/cronet/native/test:cronet_native_testutil",
    "//net:test_support",
    "//testing/gtest",
  ]

  configs += [ ":cronet_native_include_config" ]

  sources = [
    "engine_unittest.cc",
    "native_metrics_util_test.cc",
    "runnables_unittest.cc",

    # Generated from cronet.idl.
    "generated/cronet.idl_impl_interface_unittest.cc",
    "generated/cronet.idl_impl_struct_unittest.cc",
  ]
}