File size: 2,130 Bytes
f8dc3a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright 2018 The Chromium Authors. All rights reserved.
# 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")

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

source_set("cpp") {
  sources = [
    "service_connection.cc",
    "service_connection.h",
  ]
  defines = [ "IS_CHROMEOS_MLSERVICE_IMPL" ]
  deps = [
    "//base",
    "//chromeos/services/machine_learning/public/mojom",
  ]

  if (is_chromeos_ash) {
    sources += [
      "../../cpp/ash/handwriting_model_loader.cc",
      "../../cpp/ash/handwriting_model_loader.h",
      "../../cpp/ash/service_connection_ash.cc",
    ]
    deps += [
      "//ash/constants:constants",
      "//chromeos/dbus/dlcservice",
      "//chromeos/dbus/dlcservice:dlcservice_proto",
      "//chromeos/dbus/machine_learning",
    ]
  } else if (is_chromeos_lacros) {
    sources += [ "../../cpp/lacros/service_connection_lacros.cc" ]
    deps += [
      "//chromeos/lacros",
      "//mojo/public/cpp/bindings",
      "//skia",
    ]
  }
}

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",
  ]
}

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