1# Copyright (c) 2021 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("//foundation/distributedhardware/devicemanager/devicemanager.gni") 16module_out_path = "device_manager_base/component_loader_test" 17 18group("unittest") { 19 testonly = true 20 21 deps = [ 22 ":UTTest_auth_message_processor", 23 ":UTTest_auth_request_state", 24 ":UTTest_auth_response_state", 25 ":UTTest_device_manager_service", 26 ":UTTest_device_manager_service_listener", 27 ":UTTest_dm_auth_manager", 28 ":UTTest_dm_device_info_manager", 29 ":UTTest_dm_device_state_manager", 30 ":UTTest_dm_discovery_manager", 31 ":UTTest_ipc_client_manager", 32 ":UTTest_ipc_client_proxy", 33 ":UTTest_ipc_client_stub", 34 ":UTTest_ipc_server_client_proxy", 35 ":UTTest_ipc_server_listener", 36 ":UTTest_ipc_server_stub", 37 ":UTTest_softbus_connector", 38 ":UTTest_softbus_session", 39 ] 40} 41 42## UnitTest device_manager_impl_test {{{ 43ohos_unittest("device_manager_impl_test") { 44 module_out_path = module_out_path 45 46 sources = [ "device_manager_impl_test.cpp" ] 47 48 deps = [ ":device_manager_test_common" ] 49} 50 51## UnitTest device_manager_impl_test }}} 52 53## UnitTest UTTest_device_manager_service {{{ 54ohos_unittest("UTTest_device_manager_service") { 55 module_out_path = module_out_path 56 57 sources = [ "UTTest_device_manager_service.cpp" ] 58 59 deps = [ ":device_manager_test_common" ] 60} 61 62## UnitTest UTTest_device_manager_service }}} 63 64## UnitTest UTTest_hichain_connector {{{ 65ohos_unittest("UTTest_hichain_connector") { 66 module_out_path = module_out_path 67 68 sources = [ "UTTest_hichain_connector.cpp" ] 69 70 deps = [ ":device_manager_test_common" ] 71} 72 73## UnitTest UTTest_hichain_connector }}} 74 75## UnitTest UTTest_dm_device_info_manager {{{ 76ohos_unittest("UTTest_dm_device_info_manager") { 77 module_out_path = module_out_path 78 79 sources = [ "UTTest_dm_device_info_manager.cpp" ] 80 81 deps = [ ":device_manager_test_common" ] 82} 83 84## UnitTest UTTest_dm_device_info_manager }}} 85 86## UnitTest UTTest_softbus_connector {{{ 87ohos_unittest("UTTest_softbus_connector") { 88 module_out_path = module_out_path 89 90 sources = [ "UTTest_softbus_connector.cpp" ] 91 92 deps = [ ":device_manager_test_common" ] 93} 94 95## UnitTest UTTest_softbus_connector }}} 96 97## UnitTest UTTest_softbus_session {{{ 98ohos_unittest("UTTest_softbus_session") { 99 module_out_path = module_out_path 100 101 sources = [ "UTTest_softbus_session.cpp" ] 102 103 deps = [ ":device_manager_test_common" ] 104} 105 106## UnitTest UTTest_softbus_session }}} 107 108## UnitTest UTTest_ipc_client_manager {{{ 109ohos_unittest("UTTest_ipc_client_manager") { 110 module_out_path = module_out_path 111 112 sources = [ "UTTest_ipc_client_manager.cpp" ] 113 114 deps = [ ":device_manager_test_common" ] 115} 116 117## UnitTest UTTest_ipc_client_manager }}} 118 119## UnitTest UTTest_ipc_client_proxy {{{ 120ohos_unittest("UTTest_ipc_client_proxy") { 121 module_out_path = module_out_path 122 123 sources = [ "UTTest_ipc_client_proxy.cpp" ] 124 125 deps = [ ":device_manager_test_common" ] 126} 127 128## UnitTest UTTest_ipc_client_proxy }}} 129 130## UnitTest UTTest_ipc_client_stub {{{ 131ohos_unittest("UTTest_ipc_client_stub") { 132 module_out_path = module_out_path 133 134 sources = [ "UTTest_ipc_client_stub.cpp" ] 135 136 deps = [ ":device_manager_test_common" ] 137} 138 139## UnitTest UTTest_ipc_client_stub }}} 140 141## UnitTest UTTest_ipc_server_client_proxy {{{ 142ohos_unittest("UTTest_ipc_server_client_proxy") { 143 module_out_path = module_out_path 144 145 sources = [ "UTTest_ipc_server_client_proxy.cpp" ] 146 147 deps = [ ":device_manager_test_common" ] 148} 149 150## UnitTest UTTest_ipc_server_client_proxy }}} 151 152## UnitTest UTTest_ipc_server_listener {{{ 153ohos_unittest("UTTest_ipc_server_listener") { 154 module_out_path = module_out_path 155 156 sources = [ "UTTest_ipc_server_listener.cpp" ] 157 158 deps = [ ":device_manager_test_common" ] 159} 160 161## UnitTest UTTest_ipc_server_listener }}} 162 163## UnitTest UTTest_ipc_server_stub {{{ 164ohos_unittest("UTTest_ipc_server_stub") { 165 module_out_path = module_out_path 166 167 sources = [ "UTTest_ipc_server_stub.cpp" ] 168 169 deps = [ ":device_manager_test_common" ] 170} 171 172## UnitTest UTTest_ipc_server_stub }}} 173 174## UnitTest UTTest_device_manager_impl {{{ 175ohos_unittest("UTTest_device_manager_impl") { 176 module_out_path = module_out_path 177 178 sources = [ "UTTest_device_manager_impl.cpp" ] 179 180 deps = [ ":device_manager_test_common" ] 181} 182 183## UnitTest UTTest_device_manager_impl }}} 184 185## UnitTest UTTest_profile_connector {{{ 186ohos_unittest("UTTest_profile_connector") { 187 module_out_path = module_out_path 188 189 sources = [ "UTTest_profile_connector.cpp" ] 190 191 deps = [ ":device_manager_test_common" ] 192} 193 194## UnitTest UTTest_profile_connector }}} 195 196## UnitTest UTTest_device_manager_notify {{{ 197ohos_unittest("UTTest_device_manager_notify") { 198 module_out_path = module_out_path 199 200 sources = [ "UTTest_device_manager_notify.cpp" ] 201 202 deps = [ ":device_manager_test_common" ] 203} 204 205## UnitTest UTTest_device_manager_notify }}} 206 207## UnitTest UTTest_ipc_client_server_proxy {{{ 208ohos_unittest("UTTest_ipc_client_server_proxy") { 209 module_out_path = module_out_path 210 211 sources = [ "UTTest_ipc_client_server_proxy.cpp" ] 212 213 deps = [ ":device_manager_test_common" ] 214} 215 216## UnitTest UTTest_ipc_client_server_proxy }}} 217 218## UnitTest UTTest_dm_device_state_manager {{{ 219ohos_unittest("UTTest_dm_device_state_manager") { 220 module_out_path = module_out_path 221 222 sources = [ 223 "${services_path}/src/adapter/standard/dm_adapter_manager.cpp", 224 "${services_path}/src/config/dm_config_manager.cpp", 225 "${services_path}/src/dependency/hichain/hichain_connector.cpp", 226 "${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp", 227 "${services_path}/src/dependency/softbus/softbus_connector.cpp", 228 "${services_path}/src/dependency/softbus/softbus_session.cpp", 229 "${services_path}/src/dependency/timer/dm_timer.cpp", 230 "${services_path}/src/device_manager_service_listener.cpp", 231 "${services_path}/src/devicestate/dm_device_state_manager.cpp", 232 "${services_path}/src/discovery/dm_discovery_manager.cpp", 233 "//foundation/distributedhardware/devicemanager/test/unittest/mock/ipc_server_listener.cpp", 234 "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", 235 "UTTest_dm_device_state_manager.cpp", 236 ] 237 238 deps = [ ":device_manager_test" ] 239} 240 241## UnitTest UTTest_dm_device_state_manager }}} 242 243## UnitTest UTTest_device_manager_service_listener {{{ 244ohos_unittest("UTTest_device_manager_service_listener") { 245 module_out_path = module_out_path 246 247 sources = [ 248 "${services_path}/src/device_manager_service_listener.cpp", 249 "//foundation/distributedhardware/devicemanager/test/unittest/mock/ipc_server_listener.cpp", 250 "UTTest_device_manager_service_listener.cpp", 251 ] 252 253 deps = [ ":device_manager_test" ] 254} 255 256## UnitTest UTTest_device_manager_service_listener }}} 257 258## UnitTest UTTest_auth_message_processor {{{ 259ohos_unittest("UTTest_auth_message_processor") { 260 module_out_path = module_out_path 261 262 sources = [ "UTTest_auth_message_processor.cpp" ] 263 264 deps = [ ":device_manager_test_common" ] 265} 266 267## UTTest_auth_message_processor }}} 268 269## UnitTest UTTest_auth_response_state {{{ 270ohos_unittest("UTTest_auth_response_state") { 271 module_out_path = module_out_path 272 273 sources = [ "UTTest_auth_response_state.cpp" ] 274 275 deps = [ ":device_manager_test_common" ] 276} 277 278## UTTest_auth_response_state }}} 279 280## UnitTest UTTest_auth_request_state {{{ 281ohos_unittest("UTTest_auth_request_state") { 282 module_out_path = module_out_path 283 284 sources = [ "UTTest_auth_request_state.cpp" ] 285 286 deps = [ ":device_manager_test_common" ] 287} 288 289## UTTest_auth_request_state }}} 290 291## UnitTest ipc_client_manager_test {{{ 292ohos_unittest("ipc_client_manager_test") { 293 module_out_path = module_out_path 294 295 sources = [ "ipc_client_manager_test.cpp" ] 296 297 deps = [ ":device_manager_test_common" ] 298} 299 300## UnitTest ipc_client_manager_test }}} 301 302## UnitTest UTTest_dm_auth_manager {{{ 303ohos_unittest("UTTest_dm_auth_manager") { 304 module_out_path = module_out_path 305 306 sources = [ "UTTest_dm_auth_manager.cpp" ] 307 308 deps = [ ":device_manager_test_common" ] 309} 310 311## UTTest_dm_auth_manager }}} 312## UnitTest UTTest_dm_discovery_manager {{{ 313ohos_unittest("UTTest_dm_discovery_manager") { 314 module_out_path = module_out_path 315 316 sources = [ 317 "${services_path}/src/dependency/softbus/softbus_connector.cpp", 318 "${services_path}/src/dependency/softbus/softbus_session.cpp", 319 "${services_path}/src/dependency/timer/dm_timer.cpp", 320 "${services_path}/src/device_manager_service_listener.cpp", 321 "${services_path}/src/discovery/dm_discovery_manager.cpp", 322 "//foundation/distributedhardware/devicemanager/test/unittest/mock/ipc_server_listener.cpp", 323 "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", 324 "UTTest_dm_discovery_manager.cpp", 325 ] 326 327 deps = [ ":device_manager_test" ] 328} 329 330## UnitTest UTTest_dm_discovery_manager }}} 331 332## Build device_manager_test_common.a {{{ 333config("device_manager_test_common_public_config") { 334 include_dirs = [ 335 "//utils/native/base/include", 336 "//utils/system/safwk/native/include", 337 "${innerkits_path}/native_cpp/include", 338 "${innerkits_path}/native_cpp/include/ipc/standard", 339 "${innerkits_path}/native_cpp/include/ipc", 340 "${innerkits_path}/native_cpp/include/notify", 341 "//third_party/json/include", 342 "${common_path}/include", 343 "${common_path}/include/ipc", 344 "${common_path}/include/ipc/model", 345 "${utils_path}/include", 346 "${utils_path}/include/ipc/standard", 347 "${services_path}/include", 348 "${services_path}/include/dependency/timer", 349 "${services_path}/include/discovery", 350 "${services_path}/include/dependency/softbus", 351 "${services_path}/include/dependency/softbus", 352 "${services_path}/include/authentication", 353 "${services_path}/include/adapter", 354 "${services_path}/include", 355 "${services_path}/include/ipc/standard", 356 "${services_path}/include/discovery", 357 "${services_path}/include/dependency/hichain", 358 "${services_path}/include/deviceinfo/", 359 "${services_path}/include/devicestate", 360 "//foundation/communication/dsoftbus/interfaces/kits/bus_center", 361 "//foundation/communication/softbus_lite/interfaces/kits/transport", 362 "//foundation/communication/ipc_lite/interfaces/kits", 363 "//foundation/communication/dsoftbus/interfaces/kits/common", 364 "//foundation/communication/dsoftbus/interfaces/kits/discovery", 365 "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", 366 "//foundation/distributedhardware/devicemanager/test/unittest/mock", 367 "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk", 368 "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include", 369 "//foundation/distributedhardware/devicemanager/ext/mini/services/devicemanagerservice/include/dispatch", 370 "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/bundlemgr", 371 "//foundation/distributedhardware/devicemanager/ext/profile/include", 372 "//foundation/deviceprofile/device_profile_core/interfaces/innerkits/core/include", 373 "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include", 374 "//foundation/distributedhardware/devicemanager/ext/mini/common/include", 375 "//base/security/deviceauth/interfaces/innerkits", 376 "${services_path}/include/ability", 377 "${services_path}/include/config", 378 ] 379 380 cflags = [ 381 "-Wall", 382 "-Werror", 383 "-g3", 384 "-Dprivate=public", 385 "-Dprotected=public", 386 ] 387 388 defines = [ 389 "HI_LOG_ENABLE", 390 "DH_LOG_TAG=\"device_manager_UTtest\"", 391 "LOG_DOMAIN=0xD004190", 392 ] 393} 394 395ohos_static_library("device_manager_test_common") { 396 testonly = true 397 398 visibility = [ ":*" ] 399 400 public_configs = [ ":device_manager_test_common_public_config" ] 401 402 public_deps = [ 403 "${innerkits_path}/native_cpp:devicemanagersdk", 404 "${services_path}:devicemanagerservice", 405 "${utils_path}:devicemanagerutils", 406 "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", 407 "//foundation/distributedhardware/devicemanager/interfaces/kits/js:devicemanager", 408 "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", 409 "//third_party/googletest:gmock", 410 "//third_party/googletest:gtest", 411 "//utils/native/base:utils", 412 ] 413} 414 415## Build device_manager_test_common.a }}} 416 417## Build device_manager_test_common.a {{{ 418config("device_manager_test_common_public") { 419 include_dirs = [ 420 "//utils/native/base/include", 421 "//utils/system/safwk/native/include", 422 "${innerkits_path}/native_cpp/include", 423 "${innerkits_path}/native_cpp/include/ipc", 424 "${innerkits_path}/native_cpp/include/notify", 425 "//third_party/json/include", 426 "${common_path}/include", 427 "${common_path}/include/ipc", 428 "${common_path}/include/ipc/model", 429 "${utils_path}/include", 430 "${utils_path}/include/ipc/standard", 431 "${services_path}/include", 432 "${services_path}/include/dependency/timer", 433 "${services_path}/include/discovery", 434 "${services_path}/include/dependency/softbus", 435 "${services_path}/include/dependency/hichain", 436 "${services_path}/include/dependency/multipleuser", 437 "${services_path}/include/dependency/softbus", 438 "${services_path}/include/authentication", 439 "${services_path}/include/adapter", 440 "${services_path}/include", 441 "${services_path}/include/discovery", 442 "${services_path}/include/deviceinfo/", 443 "${services_path}/include/devicestate", 444 "//foundation/distributedhardware/devicemanager/test/unittest/mock/", 445 "${services_path}/include/ability", 446 "${services_path}/include/config", 447 "//foundation/communication/dsoftbus/interfaces/kits/bus_center", 448 "//foundation/communication/ipc_lite/interfaces/kits", 449 "//foundation/communication/dsoftbus/interfaces/kits/common", 450 "//foundation/communication/dsoftbus/interfaces/kits/discovery", 451 "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", 452 "//base/security/deviceauth/interfaces/innerkits", 453 "//base/account/os_account/interfaces/innerkits/osaccount/native/include", 454 "//base/account/os_account/frameworks/common/database/include", 455 "//base/account/os_account/frameworks/common/account_error/include", 456 "//foundation/distributedschedule/safwk/services/safwk", 457 ] 458 459 cflags = [ 460 "-Wall", 461 "-Werror", 462 "-g3", 463 "-Dprivate=public", 464 "-Dprotected=public", 465 ] 466 467 defines = [ 468 "HI_LOG_ENABLE", 469 "DH_LOG_TAG=\"device_manager_UTtest\"", 470 "LOG_DOMAIN=0xD004190", 471 ] 472} 473 474ohos_static_library("device_manager_test") { 475 testonly = true 476 477 visibility = [ ":*" ] 478 479 public_configs = [ ":device_manager_test_common_public" ] 480 481 public_deps = [ 482 "${innerkits_path}/native_cpp:devicemanagersdk", 483 "${utils_path}:devicemanagerutils", 484 "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", 485 "//foundation/distributedhardware/devicemanager/interfaces/kits/js:devicemanager", 486 "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", 487 "//third_party/googletest:gmock", 488 "//third_party/googletest:gtest", 489 "//utils/native/base:utils", 490 ] 491 492 deps = [ 493 "${innerkits_path}/native_cpp:devicemanagersdk", 494 "${utils_path}:devicemanagerutils", 495 "//base/account/os_account/frameworks/osaccount/native:os_account_innerkits", 496 "//base/security/deviceauth/services:deviceauth_sdk", 497 "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager", 498 "//foundation/aafwk/standard/interfaces/innerkits/want:want", 499 "//foundation/aafwk/standard/services/abilitymgr:abilityms", 500 ] 501 502 external_deps = [ 503 "bundle_framework:appexecfwk_base", 504 "bundle_framework:appexecfwk_core", 505 "ces_standard:cesfwk_core", 506 "ces_standard:cesfwk_innerkits", 507 "dsoftbus_standard:softbus_client", 508 "eventhandler:libeventhandler", 509 "hiviewdfx_hilog_native:libhilog", 510 "ipc:ipc_core", 511 "safwk:system_ability_fwk", 512 "samgr_standard:samgr_proxy", 513 ] 514} 515## Build device_manager_test.a }}} 516