chromium/services/device/public/cpp/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("//build/config/features.gni")
import("//services/device/public/cpp/compute_pressure/buildflags.gni")
import("//services/device/public/cpp/geolocation/buildflags.gni")

component("device_features") {
  public = [ "device_features.h" ]
  sources = [
    "device_features.cc",
    "device_features_export.h",
  ]
  configs += [ "//build/config/compiler:wexit_time_destructors" ]
  deps = [
    "//services/device/public/cpp/geolocation:buildflags",
    "//services/device/public/mojom:geolocation_internals",
  ]
  public_deps = [ "//base" ]

  defines = [ "DEVICE_FEATURES_IMPLEMENTATION" ]
}

if (is_android) {
  source_set("device_feature_list") {
    sources = [ "device_feature_map.cc" ]
    configs += [ "//build/config/compiler:wexit_time_destructors" ]
    deps = [
      ":device_features",
      "//base",
      "//device/fido",
      "//services/device/public/java:device_feature_list_jni",
    ]
  }
}

source_set("test_support") {
  testonly = true

  sources = [
    "test/fake_sensor_and_provider.cc",
    "test/fake_sensor_and_provider.h",
    "test/fake_serial_port_client.cc",
    "test/fake_serial_port_client.h",
    "test/fake_serial_port_manager.cc",
    "test/fake_serial_port_manager.h",
    "test/fake_usb_device.cc",
    "test/fake_usb_device.h",
    "test/fake_usb_device_info.cc",
    "test/fake_usb_device_info.h",
    "test/fake_usb_device_manager.cc",
    "test/fake_usb_device_manager.h",
    "test/mock_usb_mojo_device.cc",
    "test/mock_usb_mojo_device.h",
    "test/scoped_geolocation_overrider.cc",
    "test/scoped_geolocation_overrider.h",
    "test/test_wake_lock_provider.cc",
    "test/test_wake_lock_provider.h",
  ]

  public_deps = [
    "//base",
    "//services/device/public/cpp/generic_sensor",
    "//services/device/public/cpp/geolocation",
    "//services/device/public/cpp/usb",
    "//services/device/public/mojom",
    "//services/device/public/mojom:usb",
    "//services/service_manager/public/cpp",
  ]

  deps = [
    "//build:chromeos_buildflags",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/system",
    "//services/device:lib",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]

  if (os_level_geolocation_permission_supported) {
    sources += [
      "test/fake_geolocation_system_permission_manager.cc",
      "test/fake_geolocation_system_permission_manager.h",
      "test/fake_system_geolocation_source.cc",
      "test/fake_system_geolocation_source.h",
    ]
  }

  if (is_android) {
    sources += [
      "test/scoped_nfc_overrider.cc",
      "test/scoped_nfc_overrider.h",
    ]
  } else {
    sources += [
      "test/fake_hid_manager.cc",
      "test/fake_hid_manager.h",
      "test/hid_test_util.cc",
      "test/hid_test_util.h",
      "test/mock_hid_connection.cc",
      "test/mock_hid_connection.h",
      "test/mock_hid_service.cc",
      "test/mock_hid_service.h",
      "test/test_report_descriptors.cc",
      "test/test_report_descriptors.h",
    ]

    public_deps += [ "//services/device/public/cpp/hid" ]

    deps += [ "//services/device/hid" ]
  }

  if (enable_compute_pressure) {
    sources += [
      "test/scoped_pressure_manager_overrider.cc",
      "test/scoped_pressure_manager_overrider.h",
    ]
  }
}