chromium/chromeos/components/sensors/BUILD.gn

# Copyright 2020 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/chromeos/ui_mode.gni")

component("sensors") {
  output_name = "chromeos_sensors"
  defines = [ "IS_CHROMEOS_SENSORS_IMPL" ]
  sources = [
    "sensor_util.cc",
    "sensor_util.h",
  ]
  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//chromeos/components/sensors/mojom",
    "//mojo/public/cpp/bindings",
  ]
  if (is_chromeos_ash) {
    sources += [
      "ash/sensor_hal_dispatcher.cc",
      "ash/sensor_hal_dispatcher.h",
    ]
    deps += [ "//chromeos/ash/components/mojo_service_manager" ]
  }
  if (is_chromeos_lacros) {
    deps += [
      "//chromeos/crosapi/mojom",
      "//chromeos/lacros",
    ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "fake_sensor_device.cc",
    "fake_sensor_device.h",
    "fake_sensor_hal_client.cc",
    "fake_sensor_hal_client.h",
    "fake_sensor_hal_server.cc",
    "fake_sensor_hal_server.h",
    "fake_sensor_service.cc",
    "fake_sensor_service.h",
  ]
  deps = [
    ":sensors",
    "//base",
    "//chromeos/components/sensors/mojom",
    "//mojo/public/cpp/bindings",
  ]
}

if (is_chromeos_ash) {
  source_set("ash_unit_tests") {
    testonly = true
    sources = [ "ash/sensor_hal_dispatcher_unittest.cc" ]
    deps = [
      ":sensors",
      ":test_support",
      "//base/test:test_support",
      "//chromeos/ash/components/mojo_service_manager",
      "//chromeos/components/sensors/mojom",
      "//mojo/public/cpp/bindings",
      "//testing/gtest",
    ]
  }
}