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

assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos")

source_set("cpp") {
  sources = [
    "../../cpp/ash/handwriting_model_loader.cc",
    "../../cpp/ash/handwriting_model_loader.h",
    "../../cpp/ash/service_connection_ash.cc",
    "ml_switches.cc",
    "ml_switches.h",
    "service_connection.cc",
    "service_connection.h",
  ]
  defines = [ "IS_CHROMEOS_MLSERVICE_IMPL" ]
  deps = [
    "//ash/constants",
    "//base",
    "//chromeos/ash/components/dbus/dlcservice",
    "//chromeos/ash/components/dbus/dlcservice:dlcservice_proto",
    "//chromeos/dbus/machine_learning",
    "//chromeos/services/machine_learning/public/mojom",
  ]
}

component("stub") {
  sources = [
    "fake_service_connection.cc",
    "fake_service_connection.h",
  ]
  defines = [ "IS_CHROMEOS_MLSERVICE_IMPL" ]
  deps = [
    "//base",
    "//chromeos/services/machine_learning/public/mojom",
    "//mojo/public/cpp/bindings",
  ]
  public_deps = [ ":cpp" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "service_connection_unittest.cc" ]
  deps = [
    ":cpp",
    ":stub",
    "//base/test:test_support",
    "//chromeos/dbus/machine_learning",
    "//chromeos/services/machine_learning/public/mojom",
    "//mojo/core/embedder",
    "//mojo/public/cpp/bindings",
    "//testing/gtest",
  ]
}

source_set("ash_unit_tests") {
  sources = [ "../../cpp/ash/handwriting_model_loader_unittest.cc" ]
  testonly = true
  deps = [
    ":cpp",
    "//ash/constants",
    "//base/test:test_support",
    "//chromeos/ash/components/dbus/dlcservice",
    "//chromeos/services/machine_learning/public/cpp:stub",
    "//testing/gtest",
  ]
}
