1# Copyright (c) 2021-2023 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("//base/notification/distributed_notification_service/notification.gni") 15import("//build/ohos.gni") 16import("//build/test.gni") 17 18group("ans_unit_test") { 19 testonly = true 20 deps = [] 21 22 if (distributed_notification_supported) { 23 deps += [ 24 ":ans_distributed_unit_test", 25 ":distributed_database_branch_test", 26 ":distributed_database_callback_test", 27 ":distributed_device_callback_test", 28 ":distributed_flow_control_test", 29 ":distributed_preferences_branch_test", 30 ":distributed_preferences_database_test", 31 ":distributed_screen_status_manager_branch_test", 32 ] 33 } 34} 35 36ohos_unittest("ans_distributed_unit_test") { 37 module_out_path = "${component_name}/unittest" 38 include_dirs = [ 39 "/${services_path}/distributed/include", 40 "${ffrt_path}/interfaces/kits", 41 ] 42 43 sources = [ 44 "${services_path}/distributed/src/distributed_database.cpp", 45 "${services_path}/distributed/src/distributed_database_callback.cpp", 46 "${services_path}/distributed/src/distributed_device_callback.cpp", 47 "${services_path}/distributed/src/distributed_flow_control.cpp", 48 "${services_path}/distributed/src/distributed_notification_manager.cpp", 49 "${services_path}/distributed/src/distributed_preferences.cpp", 50 "${services_path}/distributed/src/distributed_preferences_database.cpp", 51 "${services_path}/distributed/src/distributed_preferences_info.cpp", 52 "${services_path}/distributed/src/distributed_screen_status_manager.cpp", 53 "${services_path}/distributed/test/unittest/distributed_database_test.cpp", 54 "${services_path}/distributed/test/unittest/distributed_notification_manager_test.cpp", 55 "${services_path}/distributed/test/unittest/distributed_preferences_test.cpp", 56 "${services_path}/distributed/test/unittest/distributed_screen_status_manager_test.cpp", 57 "${services_path}/distributed/test/unittest/mock/mock_blob.cpp", 58 "${services_path}/distributed/test/unittest/mock/mock_change_notification.cpp", 59 "${services_path}/distributed/test/unittest/mock/mock_device_manager_impl.cpp", 60 "${services_path}/distributed/test/unittest/mock/mock_event_handler.cpp", 61 "${services_path}/distributed/test/unittest/mock/mock_single_kv_store.cpp", 62 ] 63 64 configs = [ 65 "${services_path}/distributed/:ans_distributed_config", 66 "${core_path}:public_ans_core_config", 67 "${frameworks_module_ans_path}:ans_innerkits_public_config", 68 ] 69 70 deps = [ 71 "${core_path}:ans_core", 72 "//third_party/googletest:gtest_main", 73 ] 74 75 external_deps = [ 76 "ability_base:base", 77 "ability_base:want", 78 "ability_base:zuri", 79 "bundle_framework:appexecfwk_base", 80 "c_utils:utils", 81 "device_manager:devicemanagersdk", 82 "eventhandler:libeventhandler", 83 "ffrt:libffrt", 84 "hilog:libhilog", 85 "hitrace:hitrace_meter", 86 "hitrace:libhitracechain", 87 "image_framework:image_native", 88 "ipc:ipc_core", 89 "kv_store:distributeddata_inner", 90 ] 91 92 subsystem_name = "${subsystem_name}" 93 part_name = "${component_name}" 94} 95 96ohos_unittest("distributed_preferences_database_test") { 97 module_out_path = "${component_name}/unittest" 98 include_dirs = [ 99 "/${services_path}/distributed/include", 100 "${services_path}/distributed/test/unittest/mock", 101 ] 102 103 sources = [ 104 "distributed_preferences_database_test/distributed_preferences_database_test.cpp", 105 "distributed_preferences_database_test/mock_distributed_flow_control.cpp", 106 "distributed_preferences_database_test/mock_distributed_kv_data_manager.cpp", 107 "distributed_preferences_database_test/mock_single_kv_store.cpp", 108 ] 109 110 configs = [ 111 "${services_path}/distributed/:ans_distributed_config", 112 "${core_path}:public_ans_core_config", 113 "${frameworks_module_ans_path}:ans_innerkits_public_config", 114 ] 115 116 deps = [ 117 "${core_path}:ans_core", 118 "${services_path}/distributed:libans_distributed", 119 "//third_party/googletest:gtest_main", 120 ] 121 122 external_deps = [ 123 "ability_base:base", 124 "ability_base:want", 125 "ability_base:zuri", 126 "bundle_framework:appexecfwk_base", 127 "c_utils:utils", 128 "device_manager:devicemanagersdk", 129 "eventhandler:libeventhandler", 130 "hilog:libhilog", 131 "hitrace:hitrace_meter", 132 "hitrace:libhitracechain", 133 "image_framework:image_native", 134 "ipc:ipc_core", 135 "kv_store:distributeddata_inner", 136 ] 137 138 subsystem_name = "${subsystem_name}" 139 part_name = "${component_name}" 140} 141 142ohos_unittest("distributed_screen_status_manager_branch_test") { 143 module_out_path = "${component_name}/unittest" 144 include_dirs = [ 145 "/${services_path}/distributed/include", 146 "${services_path}/distributed/test/unittest/mock", 147 ] 148 149 sources = [ 150 "distributed_database_branch_test/mock_device_manager_impl.cpp", 151 "distributed_screen_status_manager_branch_test/distributed_screen_status_manager_branch_test.cpp", 152 "distributed_screen_status_manager_branch_test/mock_distributed_flow_control.cpp", 153 "distributed_screen_status_manager_branch_test/mock_distributed_kv_data_manager.cpp", 154 "distributed_screen_status_manager_branch_test/mock_single_kv_store.cpp", 155 ] 156 157 configs = [ 158 "${services_path}/distributed/:ans_distributed_config", 159 "${core_path}:public_ans_core_config", 160 "${frameworks_module_ans_path}:ans_innerkits_public_config", 161 ] 162 163 deps = [ 164 "${core_path}:ans_core", 165 "${services_path}/distributed:libans_distributed", 166 "//third_party/googletest:gtest_main", 167 ] 168 169 external_deps = [ 170 "ability_base:base", 171 "ability_base:want", 172 "ability_base:zuri", 173 "bundle_framework:appexecfwk_base", 174 "c_utils:utils", 175 "device_manager:devicemanagersdk", 176 "eventhandler:libeventhandler", 177 "hilog:libhilog", 178 "hitrace:hitrace_meter", 179 "hitrace:libhitracechain", 180 "image_framework:image_native", 181 "ipc:ipc_core", 182 "kv_store:distributeddata_inner", 183 ] 184 185 subsystem_name = "${subsystem_name}" 186 part_name = "${component_name}" 187} 188 189ohos_unittest("distributed_database_branch_test") { 190 module_out_path = "${component_name}/unittest" 191 include_dirs = [ 192 "/${services_path}/distributed/include", 193 "${services_path}/distributed/test/unittest/mock", 194 ] 195 196 sources = [ 197 "distributed_database_branch_test/distributed_database_branch_test.cpp", 198 "distributed_database_branch_test/mock_device_manager_impl.cpp", 199 "distributed_database_branch_test/mock_distributed_flow_control.cpp", 200 "distributed_database_branch_test/mock_distributed_kv_data_manager.cpp", 201 "distributed_database_branch_test/mock_single_kv_store.cpp", 202 ] 203 204 configs = [ 205 "${services_path}/distributed/:ans_distributed_config", 206 "${core_path}:public_ans_core_config", 207 "${frameworks_module_ans_path}:ans_innerkits_public_config", 208 ] 209 210 deps = [ 211 "${core_path}:ans_core", 212 "${services_path}/distributed:libans_distributed", 213 "//third_party/googletest:gtest_main", 214 ] 215 216 external_deps = [ 217 "ability_base:base", 218 "ability_base:want", 219 "ability_base:zuri", 220 "bundle_framework:appexecfwk_base", 221 "c_utils:utils", 222 "device_manager:devicemanagersdk", 223 "eventhandler:libeventhandler", 224 "hilog:libhilog", 225 "hitrace:hitrace_meter", 226 "hitrace:libhitracechain", 227 "image_framework:image_native", 228 "ipc:ipc_core", 229 "kv_store:distributeddata_inner", 230 ] 231 232 subsystem_name = "${subsystem_name}" 233 part_name = "${component_name}" 234} 235 236ohos_unittest("distributed_preferences_branch_test") { 237 module_out_path = "${component_name}/unittest" 238 include_dirs = [ "/${services_path}/distributed/include" ] 239 240 sources = [ 241 "distributed_preferences_branch_test/distributed_preferences_branch_test.cpp", 242 "distributed_preferences_branch_test/mock_distributed_preferences_database.cpp", 243 ] 244 245 configs = [ 246 "${services_path}/distributed/:ans_distributed_config", 247 "${core_path}:public_ans_core_config", 248 "${frameworks_module_ans_path}:ans_innerkits_public_config", 249 ] 250 251 deps = [ 252 "${core_path}:ans_core", 253 "${services_path}/distributed:libans_distributed", 254 "//third_party/googletest:gtest_main", 255 ] 256 257 external_deps = [ 258 "ability_base:base", 259 "ability_base:want", 260 "ability_base:zuri", 261 "bundle_framework:appexecfwk_base", 262 "c_utils:utils", 263 "device_manager:devicemanagersdk", 264 "eventhandler:libeventhandler", 265 "hilog:libhilog", 266 "hitrace:hitrace_meter", 267 "hitrace:libhitracechain", 268 "image_framework:image_native", 269 "ipc:ipc_core", 270 "kv_store:distributeddata_inner", 271 ] 272 273 subsystem_name = "${subsystem_name}" 274 part_name = "${component_name}" 275} 276 277ohos_unittest("distributed_device_callback_test") { 278 module_out_path = "${component_name}/unittest" 279 include_dirs = [ "/${services_path}/distributed/include" ] 280 281 sources = [ "distributed_device_callback_test.cpp" ] 282 283 configs = [ 284 "${services_path}/distributed/:ans_distributed_config", 285 "${core_path}:public_ans_core_config", 286 "${frameworks_module_ans_path}:ans_innerkits_public_config", 287 ] 288 289 deps = [ 290 "${core_path}:ans_core", 291 "${services_path}/distributed:libans_distributed", 292 "//third_party/googletest:gtest_main", 293 ] 294 295 external_deps = [ 296 "ability_base:base", 297 "ability_base:want", 298 "ability_base:zuri", 299 "bundle_framework:appexecfwk_base", 300 "c_utils:utils", 301 "device_manager:devicemanagersdk", 302 "eventhandler:libeventhandler", 303 "hilog:libhilog", 304 "hitrace:hitrace_meter", 305 "hitrace:libhitracechain", 306 "image_framework:image_native", 307 "ipc:ipc_core", 308 "kv_store:distributeddata_inner", 309 ] 310 311 subsystem_name = "${subsystem_name}" 312 part_name = "${component_name}" 313} 314 315ohos_unittest("distributed_database_callback_test") { 316 module_out_path = "${component_name}/unittest" 317 include_dirs = [ "/${services_path}/distributed/include" ] 318 319 sources = [ "distributed_database_callback_test.cpp" ] 320 321 configs = [ 322 "${services_path}/distributed/:ans_distributed_config", 323 "${core_path}:public_ans_core_config", 324 "${frameworks_module_ans_path}:ans_innerkits_public_config", 325 ] 326 327 deps = [ 328 "${core_path}:ans_core", 329 "${services_path}/distributed:libans_distributed", 330 "//third_party/googletest:gtest_main", 331 ] 332 333 external_deps = [ 334 "ability_base:base", 335 "ability_base:want", 336 "ability_base:zuri", 337 "bundle_framework:appexecfwk_base", 338 "c_utils:utils", 339 "eventhandler:libeventhandler", 340 "hilog:libhilog", 341 "hitrace:hitrace_meter", 342 "hitrace:libhitracechain", 343 "image_framework:image_native", 344 "ipc:ipc_core", 345 "kv_store:distributeddata_inner", 346 ] 347 348 subsystem_name = "${subsystem_name}" 349 part_name = "${component_name}" 350} 351 352ohos_unittest("distributed_flow_control_test") { 353 module_out_path = "${component_name}/unittest" 354 include_dirs = [ "/${services_path}/distributed/include" ] 355 356 sources = [ "distributed_flow_control_test.cpp" ] 357 358 configs = [ 359 "${services_path}/distributed/:ans_distributed_config", 360 "${core_path}:public_ans_core_config", 361 "${frameworks_module_ans_path}:ans_innerkits_public_config", 362 ] 363 364 deps = [ 365 "${core_path}:ans_core", 366 "${services_path}/distributed:libans_distributed", 367 "//third_party/googletest:gtest_main", 368 ] 369 370 external_deps = [ 371 "ability_base:base", 372 "ability_base:want", 373 "ability_base:zuri", 374 "bundle_framework:appexecfwk_base", 375 "c_utils:utils", 376 "eventhandler:libeventhandler", 377 "hilog:libhilog", 378 "hitrace:hitrace_meter", 379 "hitrace:libhitracechain", 380 "image_framework:image_native", 381 "ipc:ipc_core", 382 "kv_store:distributeddata_inner", 383 ] 384 385 subsystem_name = "${subsystem_name}" 386 part_name = "${component_name}" 387} 388 389ohos_unittest("distributed_notification_manager_branch_test") { 390 module_out_path = "${component_name}/unittest" 391 include_dirs = [ 392 "/${services_path}/distributed/include", 393 "${ffrt_path}/interfaces/kits", 394 ] 395 396 sources = [ 397 "distributed_notification_manager_branch_test/distributed_notification_manager_branch_test.cpp", 398 "distributed_notification_manager_branch_test/mock_distributed_database.cpp", 399 ] 400 401 configs = [ 402 "${services_path}/distributed/:ans_distributed_config", 403 "${core_path}:public_ans_core_config", 404 "${frameworks_module_ans_path}:ans_innerkits_public_config", 405 ] 406 407 deps = [ 408 "${core_path}:ans_core", 409 "${services_path}/distributed:libans_distributed", 410 "//third_party/googletest:gtest_main", 411 ] 412 413 external_deps = [ 414 "ability_base:base", 415 "ability_base:want", 416 "ability_base:zuri", 417 "bundle_framework:appexecfwk_base", 418 "c_utils:utils", 419 "device_manager:devicemanagersdk", 420 "eventhandler:libeventhandler", 421 "ffrt:libffrt", 422 "hilog:libhilog", 423 "hitrace:hitrace_meter", 424 "hitrace:libhitracechain", 425 "image_framework:image_native", 426 "ipc:ipc_core", 427 "kv_store:distributeddata_inner", 428 ] 429 430 subsystem_name = "${subsystem_name}" 431 part_name = "${component_name}" 432} 433