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}/device_status/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 "bundle_framework:appexecfwk_core", 53 "cJSON:cjson_static", 54 "c_utils:utils", 55 "googletest:gtest_main", 56 "graphic_2d:librender_service_client", 57 "hilog:libhilog", 58 "image_framework:image_native", 59 "input:libmmi-client", 60 "ipc:ipc_single", 61 "safwk:system_ability_fwk", 62 "samgr:samgr_proxy", 63 "window_manager:libdm", 64 "window_manager:libwm", 65 ] 66 defines = [] 67 if (device_status_sensor_enable) { 68 external_deps += [ "sensor:sensor_interface_native" ] 69 defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ] 70 } 71} 72 73ohos_unittest("device_status_datahub_test") { 74 module_out_path = module_output_path 75 76 sources = [ "src/device_status_datahub_test.cpp" ] 77 78 configs = [ 79 "${device_status_utils_path}:devicestatus_utils_config", 80 ":devicestatus_private_config", 81 ] 82 83 deps = [ 84 "${device_status_interfaces_path}/innerkits:devicestatus_client", 85 "${device_status_root_path}/services:devicestatus_static_service", 86 "../../../libs:devicestatus_algo", 87 "../../../libs:devicestatus_mock", 88 ] 89 90 external_deps = [ 91 "ability_base:base", 92 "access_token:libaccesstoken_sdk", 93 "cJSON:cjson_static", 94 "c_utils:utils", 95 "googletest:gtest_main", 96 "hilog:libhilog", 97 "image_framework:image_native", 98 "input:libmmi-client", 99 "ipc:ipc_single", 100 "safwk:system_ability_fwk", 101 "samgr:samgr_proxy", 102 ] 103 defines = [] 104 if (device_status_sensor_enable) { 105 external_deps += [ "sensor:sensor_interface_native" ] 106 defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ] 107 } 108} 109 110ohos_unittest("device_status_mock_test") { 111 module_out_path = module_output_path 112 113 sources = [ "src/device_status_mock_test.cpp" ] 114 115 configs = [ 116 "${device_status_utils_path}:devicestatus_utils_config", 117 ":devicestatus_private_config", 118 ] 119 120 cflags = [ "-Dprivate=public" ] 121 122 deps = [ 123 "${device_status_interfaces_path}/innerkits:devicestatus_client", 124 "${device_status_root_path}/services:devicestatus_static_service", 125 "../../../libs:devicestatus_algo", 126 "../../../libs:devicestatus_mock", 127 ] 128 129 external_deps = [ 130 "ability_base:base", 131 "access_token:libaccesstoken_sdk", 132 "cJSON:cjson_static", 133 "c_utils:utils", 134 "googletest:gtest_main", 135 "hilog:libhilog", 136 "image_framework:image_native", 137 "input:libmmi-client", 138 "ipc:ipc_single", 139 "relational_store:native_rdb", 140 "safwk:system_ability_fwk", 141 "samgr:samgr_proxy", 142 ] 143 defines = [] 144 if (device_status_sensor_enable) { 145 external_deps += [ "sensor:sensor_interface_native" ] 146 defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ] 147 } 148} 149 150ohos_unittest("device_status_algo_mgr_test") { 151 module_out_path = module_output_path 152 153 sources = [ "src/device_status_algo_mgr_test.cpp" ] 154 155 configs = [ 156 "${device_status_utils_path}:devicestatus_utils_config", 157 ":devicestatus_private_config", 158 ] 159 160 deps = [ 161 "${device_status_interfaces_path}/innerkits:devicestatus_client", 162 "${device_status_root_path}/services:devicestatus_static_service", 163 "../../../libs:devicestatus_algo", 164 ] 165 166 external_deps = [ 167 "ability_base:base", 168 "access_token:libaccesstoken_sdk", 169 "bundle_framework:appexecfwk_core", 170 "cJSON:cjson_static", 171 "c_utils:utils", 172 "graphic_2d:librender_service_client", 173 "hilog:libhilog", 174 "image_framework:image_native", 175 "input:libmmi-client", 176 "ipc:ipc_single", 177 "safwk:system_ability_fwk", 178 "samgr:samgr_proxy", 179 "window_manager:libdm", 180 "window_manager:libwm", 181 ] 182 defines = [] 183 if (device_status_sensor_enable) { 184 external_deps += [ "sensor:sensor_interface_native" ] 185 defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ] 186 } 187} 188 189ohos_unittest("device_status_algo_mock_test") { 190 module_out_path = module_output_path 191 192 sources = [ "src/device_status_algo_mock_test.cpp" ] 193 194 configs = [ 195 "${device_status_utils_path}:devicestatus_utils_config", 196 ":devicestatus_private_config", 197 ] 198 199 cflags = [ "-Dprivate=public" ] 200 201 deps = [ 202 "${device_status_interfaces_path}/innerkits:devicestatus_client", 203 "${device_status_root_path}/services:devicestatus_static_service", 204 "../../../libs:devicestatus_algo", 205 "../../../libs:devicestatus_mock", 206 ] 207 208 external_deps = [ 209 "ability_base:base", 210 "access_token:libaccesstoken_sdk", 211 "cJSON:cjson_static", 212 "c_utils:utils", 213 "googletest:gtest_main", 214 "hilog:libhilog", 215 "image_framework:image_native", 216 "input:libmmi-client", 217 "ipc:ipc_single", 218 "relational_store:native_rdb", 219 "safwk:system_ability_fwk", 220 "samgr:samgr_proxy", 221 ] 222 defines = [] 223 if (device_status_sensor_enable) { 224 external_deps += [ "sensor:sensor_interface_native" ] 225 defines += [ "DEVICE_STATUS_SENSOR_ENABLE" ] 226 } 227} 228 229group("unittest") { 230 testonly = true 231 deps = [] 232 233 deps += [ 234 ":device_status_algorithm_test", 235 ":device_status_datahub_test", 236 ":device_status_algo_mgr_test", 237 ":device_status_algo_mock_test", 238 ] 239} 240