1# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/test.gni")
15import("../../../device_status.gni")
16
17module_output_path = "${device_status_part_name}/devicestatussrv"
18
19config("devicestatus_private_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "include",
24    "../../../services/native/include",
25    "../../../libs/include",
26    "../../../libs/include/algorithm",
27    "../../../libs/include/datahub",
28    "../../../libs/interface",
29    "${device_status_interfaces_path}/innerkits/include",
30  ]
31}
32
33ohos_unittest("device_status_algorithm_test") {
34  module_out_path = module_output_path
35
36  sources = [ "src/device_status_algorithm_test.cpp" ]
37
38  configs = [
39    "${device_status_utils_path}:devicestatus_utils_config",
40    ":devicestatus_private_config",
41  ]
42
43  deps = [
44    "${device_status_interfaces_path}/innerkits:devicestatus_client",
45    "${device_status_root_path}/services:devicestatus_static_service",
46    "../../../libs:devicestatus_algo",
47  ]
48
49  external_deps = [
50    "ability_base:base",
51    "access_token:libaccesstoken_sdk",
52    "cJSON:cjson_static",
53    "c_utils:utils",
54    "googletest:gtest_main",
55    "graphic_2d:librender_service_client",
56    "hilog:libhilog",
57    "image_framework:image_native",
58    "input:libmmi-client",
59    "ipc:ipc_single",
60    "safwk:system_ability_fwk",
61    "samgr:samgr_proxy",
62    "window_manager:libdm",
63  ]
64  defines = []
65  if (device_status_sensor_enable) {
66    external_deps += [ "sensor:sensor_interface_native" ]
67    defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
68  }
69}
70
71ohos_unittest("device_status_datahub_test") {
72  module_out_path = module_output_path
73
74  sources = [ "src/device_status_datahub_test.cpp" ]
75
76  configs = [
77    "${device_status_utils_path}:devicestatus_utils_config",
78    ":devicestatus_private_config",
79  ]
80
81  deps = [
82    "${device_status_interfaces_path}/innerkits:devicestatus_client",
83    "${device_status_root_path}/services:devicestatus_static_service",
84    "../../../libs:devicestatus_algo",
85    "../../../libs:devicestatus_mock",
86  ]
87
88  external_deps = [
89    "ability_base:base",
90    "access_token:libaccesstoken_sdk",
91    "cJSON:cjson_static",
92    "c_utils:utils",
93    "googletest:gtest_main",
94    "hilog:libhilog",
95    "image_framework:image_native",
96    "input:libmmi-client",
97    "ipc:ipc_single",
98    "safwk:system_ability_fwk",
99    "samgr:samgr_proxy",
100  ]
101  defines = []
102  if (device_status_sensor_enable) {
103    external_deps += [ "sensor:sensor_interface_native" ]
104    defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
105  }
106}
107
108ohos_unittest("device_status_mock_test") {
109  module_out_path = module_output_path
110
111  sources = [ "src/device_status_mock_test.cpp" ]
112
113  configs = [
114    "${device_status_utils_path}:devicestatus_utils_config",
115    ":devicestatus_private_config",
116  ]
117
118  cflags = [ "-Dprivate=public" ]
119
120  deps = [
121    "${device_status_interfaces_path}/innerkits:devicestatus_client",
122    "${device_status_root_path}/services:devicestatus_static_service",
123    "../../../libs:devicestatus_algo",
124    "../../../libs:devicestatus_mock",
125  ]
126
127  external_deps = [
128    "ability_base:base",
129    "access_token:libaccesstoken_sdk",
130    "cJSON:cjson_static",
131    "c_utils:utils",
132    "googletest:gtest_main",
133    "hilog:libhilog",
134    "image_framework:image_native",
135    "input:libmmi-client",
136    "ipc:ipc_single",
137    "relational_store:native_rdb",
138    "safwk:system_ability_fwk",
139    "samgr:samgr_proxy",
140  ]
141  defines = []
142  if (device_status_sensor_enable) {
143    external_deps += [ "sensor:sensor_interface_native" ]
144    defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ]
145  }
146}
147
148group("unittest") {
149  testonly = true
150  deps = []
151
152  deps += [
153    ":device_status_algorithm_test",
154    ":device_status_datahub_test",
155    ":device_status_mock_test",
156  ]
157}
158