1# Copyright (c) 2021-2022 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/account/os_account/os_account.gni") 15import("//build/test.gni") 16 17module_output_path = "os_account/services/app_account" 18 19config("app_account_service_config_mock") { 20 include_dirs = [ 21 "//third_party/googletest/googlemock/include", 22 "${app_account_services_path}/test/mock/app_account", 23 "${app_account_services_path}/test/mock/common", 24 "${app_account_innerkits_native_path}/include", 25 "//base/security/access_token/interfaces/innerkits/accesstoken/include", 26 ] 27} 28 29config("app_account_service_config_unittest") { 30 visibility = [ ":*" ] 31 32 include_dirs = [] 33 34 cflags = [] 35 if (target_cpu == "arm") { 36 cflags += [ "-DBINDER_IPC_32BIT" ] 37 } 38 39 defines = [ 40 "ACCOUNT_LOG_TAG = \"AppAccountMTest\"", 41 "LOG_DOMAIN = 0xD001B00", 42 ] 43} 44 45ohos_moduletest("app_account_check_labels_module_test") { 46 module_out_path = module_output_path 47 sources = [ "app_account_check_labels_module_test.cpp" ] 48 49 configs = [ ":app_account_service_config_unittest" ] 50 51 deps = [ 52 "${app_account_innerkits_native_path}:app_account_innerkits", 53 "${app_account_services_path}:accountmgr", 54 "${app_account_services_path}/src/appaccount:app_account_service_core", 55 "//third_party/googletest:gmock_main", 56 "//third_party/googletest:gtest_main", 57 ] 58 59 external_deps = [ 60 "ability_base:base", 61 "ability_base:want", 62 "ability_runtime:app_manager", 63 "bundle_framework:appexecfwk_base", 64 "bundle_framework:appexecfwk_core", 65 "c_utils:utils", 66 "hiviewdfx_hilog_native:libhilog", 67 "ipc:ipc_core", 68 "kv_store:distributeddata_inner", 69 "samgr:samgr_proxy", 70 ] 71} 72 73ohos_moduletest("account_permission_manager_module_test") { 74 module_out_path = module_output_path 75 76 sources = [ "account_permission_manager_module_test.cpp" ] 77 78 deps = [ 79 "${app_account_innerkits_native_path}:app_account_innerkits", 80 "${app_account_services_path}:accountmgr", 81 "${common_path}:libaccount_common", 82 "//third_party/googletest:gmock_main", 83 "//third_party/googletest:gtest_main", 84 ] 85 86 external_deps = [ 87 "ability_base:base", 88 "ability_runtime:app_manager", 89 "bundle_framework:appexecfwk_base", 90 "bundle_framework:appexecfwk_core", 91 "eventhandler:libeventhandler", 92 "hiviewdfx_hilog_native:libhilog", 93 "ipc:ipc_core", 94 "kv_store:distributeddata_inner", 95 "safwk:system_ability_fwk", 96 "samgr:samgr_proxy", 97 ] 98} 99 100ohos_moduletest("app_account_authenticator_callback_test") { 101 module_out_path = module_output_path 102 cflags_cc = [] 103 sources = [ "app_account_authenticator_callback_test.cpp" ] 104 105 configs = [ ":app_account_service_config_unittest" ] 106 107 deps = [ 108 "${app_account_innerkits_native_path}:app_account_innerkits", 109 "${app_account_services_path}:accountmgr", 110 "${app_account_services_path}/src/appaccount:app_account_service_core", 111 "${common_path}:libaccount_common", 112 "${innerkits_native_path}:libaccountkits", 113 ] 114 115 external_deps = [ 116 "ability_base:base", 117 "ability_base:want", 118 "ability_runtime:app_manager", 119 "bundle_framework:appexecfwk_base", 120 "bundle_framework:appexecfwk_core", 121 "eventhandler:libeventhandler", 122 "hiviewdfx_hilog_native:libhilog", 123 "ipc:ipc_core", 124 "kv_store:distributeddata_inner", 125 "safwk:system_ability_fwk", 126 "samgr:samgr_proxy", 127 ] 128 129 if (has_ces_part) { 130 cflags_cc += [ "-DHAS_CES_PART" ] 131 external_deps += [ "common_event_service:cesfwk_innerkits" ] 132 } 133} 134 135ohos_moduletest("app_account_event_module_test") { 136 module_out_path = module_output_path 137 cflags_cc = [] 138 sources = [ "app_account_event_module_test.cpp" ] 139 140 configs = [ ":app_account_service_config_unittest" ] 141 142 deps = [ 143 "${app_account_innerkits_native_path}:app_account_innerkits", 144 "${app_account_services_path}:accountmgr", 145 "${app_account_services_path}/src/appaccount:app_account_service_core", 146 "${common_path}:libaccount_common", 147 "${innerkits_native_path}:libaccountkits", 148 "//third_party/googletest:gtest_main", 149 ] 150 151 external_deps = [ 152 "ability_base:base", 153 "ability_base:want", 154 "bundle_framework:appexecfwk_base", 155 "c_utils:utils", 156 "eventhandler:libeventhandler", 157 "hiviewdfx_hilog_native:libhilog", 158 "ipc:ipc_core", 159 "kv_store:distributeddata_inner", 160 "samgr:samgr_proxy", 161 ] 162 163 if (has_ces_part) { 164 cflags_cc += [ "-DHAS_CES_PART" ] 165 external_deps += [ "common_event_service:cesfwk_innerkits" ] 166 } 167} 168 169ohos_moduletest("app_account_authenticate_test") { 170 module_out_path = module_output_path 171 cflags_cc = [] 172 sources = [ 173 "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", 174 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 175 "app_account_authenticate_test.cpp", 176 ] 177 178 configs = [ 179 ":app_account_service_config_mock", 180 ":app_account_service_config_unittest", 181 ] 182 183 deps = [ 184 "${app_account_innerkits_native_path}:app_account_innerkits", 185 "${app_account_services_path}:accountmgr", 186 "${app_account_services_path}/src/appaccount:app_account_service_core", 187 "${common_path}:libaccount_common", 188 "${innerkits_native_path}:libaccountkits", 189 "//third_party/googletest:gmock_main", 190 "//third_party/googletest:gtest_main", 191 ] 192 193 external_deps = [ 194 "ability_base:base", 195 "ability_base:want", 196 "ability_runtime:app_manager", 197 "bundle_framework:appexecfwk_base", 198 "bundle_framework:appexecfwk_core", 199 "eventhandler:libeventhandler", 200 "hiviewdfx_hilog_native:libhilog", 201 "ipc:ipc_core", 202 "kv_store:distributeddata_inner", 203 "safwk:system_ability_fwk", 204 "samgr:samgr_proxy", 205 ] 206 207 if (has_ces_part) { 208 cflags_cc += [ "-DHAS_CES_PART" ] 209 external_deps += [ "common_event_service:cesfwk_innerkits" ] 210 } 211} 212 213ohos_moduletest("app_account_control_manager_module_test") { 214 module_out_path = module_output_path 215 216 sources = [ "app_account_control_manager_module_test.cpp" ] 217 218 configs = [ ":app_account_service_config_unittest" ] 219 220 deps = [ 221 "${app_account_innerkits_native_path}:app_account_innerkits", 222 "${app_account_services_path}:accountmgr", 223 "${app_account_services_path}/src/appaccount:app_account_service_core", 224 "${common_path}:libaccount_common", 225 "//third_party/googletest:gmock_main", 226 "//third_party/googletest:gtest_main", 227 ] 228 229 external_deps = [ 230 "ability_base:base", 231 "ability_base:want", 232 "ability_runtime:app_manager", 233 "bundle_framework:appexecfwk_base", 234 "bundle_framework:appexecfwk_core", 235 "eventhandler:libeventhandler", 236 "hiviewdfx_hilog_native:libhilog", 237 "ipc:ipc_core", 238 "kv_store:distributeddata_inner", 239 "safwk:system_ability_fwk", 240 "samgr:samgr_proxy", 241 ] 242} 243 244ohos_moduletest("app_account_authenticator_session_module_test") { 245 module_out_path = module_output_path 246 include_dirs = [ "${app_account_services_path}/test/mock/app_account" ] 247 sources = [ 248 "${app_account_services_path}/test/mock/app_account/app_account_authenticator_manager.cpp", 249 "${app_account_services_path}/test/mock/app_account/mock_app_account_authenticator_stub.cpp", 250 "${app_account_services_path}/test/mock/common/ability_manager_adapter.cpp", 251 "app_account_authenticator_session_module_test.cpp", 252 ] 253 254 configs = [ ":app_account_service_config_unittest" ] 255 256 deps = [ 257 "${app_account_innerkits_native_path}:app_account_innerkits", 258 "${app_account_services_path}:accountmgr", 259 "${app_account_services_path}/src/appaccount:app_account_service_core", 260 "${common_path}:libaccount_common", 261 "//third_party/googletest:gmock_main", 262 "//third_party/googletest:gtest_main", 263 ] 264 265 external_deps = [ 266 "ability_base:base", 267 "ability_base:want", 268 "ability_runtime:app_manager", 269 "bundle_framework:appexecfwk_base", 270 "bundle_framework:appexecfwk_core", 271 "c_utils:utils", 272 "hiviewdfx_hilog_native:libhilog", 273 "ipc:ipc_core", 274 "kv_store:distributeddata_inner", 275 "samgr:samgr_proxy", 276 ] 277} 278 279ohos_moduletest("app_account_manager_service_module_test") { 280 module_out_path = module_output_path 281 cflags_cc = [] 282 cflags = [] 283 sources = [ 284 "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", 285 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 286 "app_account_manager_service_module_test.cpp", 287 ] 288 289 configs = [ 290 ":app_account_service_config_mock", 291 ":app_account_service_config_unittest", 292 ] 293 294 deps = [ 295 "${app_account_innerkits_native_path}:app_account_innerkits", 296 "${app_account_services_path}:accountmgr", 297 "${app_account_services_path}/src/appaccount:app_account_service_core", 298 "${common_path}:libaccount_common", 299 "${innerkits_native_path}:libaccountkits", 300 "//third_party/googletest:gmock_main", 301 "//third_party/googletest:gtest_main", 302 ] 303 304 external_deps = [ 305 "ability_base:base", 306 "ability_base:want", 307 "ability_runtime:app_manager", 308 "bundle_framework:appexecfwk_base", 309 "bundle_framework:appexecfwk_core", 310 "eventhandler:libeventhandler", 311 "hiviewdfx_hilog_native:libhilog", 312 "ipc:ipc_core", 313 "kv_store:distributeddata_inner", 314 "safwk:system_ability_fwk", 315 "samgr:samgr_proxy", 316 ] 317 318 if (has_ces_part) { 319 cflags_cc += [ "-DHAS_CES_PART" ] 320 external_deps += [ "common_event_service:cesfwk_innerkits" ] 321 } 322 323 if (os_account_distributed_feature) { 324 cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] 325 } 326} 327 328ohos_moduletest("at_not_mock_app_account_manager_service_module_test") { 329 module_out_path = module_output_path 330 sources = [ 331 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 332 "at_not_mock_app_account_manager_service_module_test.cpp", 333 ] 334 335 configs = [ ":app_account_service_config_unittest" ] 336 337 deps = [ 338 "${app_account_innerkits_native_path}:app_account_innerkits", 339 "${app_account_services_path}:accountmgr", 340 "${app_account_services_path}/src/appaccount:app_account_service_core", 341 "${common_path}:libaccount_common", 342 "${innerkits_native_path}:libaccountkits", 343 "//third_party/googletest:gtest_main", 344 ] 345 346 external_deps = [ 347 "ability_base:base", 348 "ability_base:want", 349 "ability_runtime:app_manager", 350 "hiviewdfx_hilog_native:libhilog", 351 "ipc:ipc_core", 352 "kv_store:distributeddata_inner", 353 ] 354} 355 356ohos_moduletest("app_account_manager_service_subscribe_module_test") { 357 module_out_path = module_output_path 358 cflags_cc = [] 359 sources = [ 360 "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", 361 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 362 "app_account_manager_service_subscribe_module_test.cpp", 363 ] 364 365 configs = [ 366 ":app_account_service_config_mock", 367 ":app_account_service_config_unittest", 368 ] 369 370 deps = [ 371 "${app_account_innerkits_native_path}:app_account_innerkits", 372 "${app_account_services_path}:accountmgr", 373 "${app_account_services_path}/src/appaccount:app_account_service_core", 374 "${common_path}:libaccount_common", 375 "${innerkits_native_path}:libaccountkits", 376 "//third_party/googletest:gmock_main", 377 "//third_party/googletest:gtest_main", 378 ] 379 380 external_deps = [ 381 "ability_base:base", 382 "ability_base:want", 383 "ability_runtime:app_manager", 384 "bundle_framework:appexecfwk_base", 385 "bundle_framework:appexecfwk_core", 386 "eventhandler:libeventhandler", 387 "hiviewdfx_hilog_native:libhilog", 388 "ipc:ipc_core", 389 "kv_store:distributeddata_inner", 390 "safwk:system_ability_fwk", 391 "samgr:samgr_proxy", 392 ] 393 394 if (has_ces_part) { 395 cflags_cc += [ "-DHAS_CES_PART" ] 396 external_deps += [ "common_event_service:cesfwk_innerkits" ] 397 } 398} 399 400ohos_moduletest("app_account_manager_service_sync_module_test") { 401 module_out_path = module_output_path 402 cflags_cc = [] 403 cflags = [] 404 sources = [ 405 "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", 406 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 407 "app_account_manager_service_sync_module_test.cpp", 408 ] 409 410 configs = [ 411 ":app_account_service_config_mock", 412 ":app_account_service_config_unittest", 413 ] 414 415 deps = [ 416 "${app_account_innerkits_native_path}:app_account_innerkits", 417 "${app_account_services_path}:accountmgr", 418 "${app_account_services_path}/src/appaccount:app_account_service_core", 419 "${common_path}:libaccount_common", 420 "${innerkits_native_path}:libaccountkits", 421 "//third_party/googletest:gmock_main", 422 "//third_party/googletest:gtest_main", 423 ] 424 425 external_deps = [ 426 "ability_base:base", 427 "ability_base:want", 428 "ability_runtime:app_manager", 429 "bundle_framework:appexecfwk_base", 430 "bundle_framework:appexecfwk_core", 431 "eventhandler:libeventhandler", 432 "hiviewdfx_hilog_native:libhilog", 433 "ipc:ipc_core", 434 "kv_store:distributeddata_inner", 435 "safwk:system_ability_fwk", 436 "samgr:samgr_proxy", 437 ] 438 439 if (has_ces_part) { 440 cflags_cc += [ "-DHAS_CES_PART" ] 441 external_deps += [ "common_event_service:cesfwk_innerkits" ] 442 } 443 if (os_account_distributed_feature) { 444 cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] 445 } 446} 447 448ohos_moduletest("bundle_manager_adapter_module_test") { 449 module_out_path = module_output_path 450 include_dirs = [ "//base/account/os_account/services/accountmgr/include/bundle_manager_adapter" ] 451 sources = [ 452 "//base/account/os_account/services/accountmgr/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp", 453 "bundle_manager_adapter_module_test.cpp", 454 ] 455 456 configs = [ ":app_account_service_config_unittest" ] 457 458 deps = [ 459 "${app_account_services_path}:accountmgr", 460 "${common_path}:libaccount_common", 461 "${innerkits_native_path}:libaccountkits", 462 "//third_party/googletest:gtest_main", 463 ] 464 465 external_deps = [ 466 "ability_base:want", 467 "ability_runtime:app_manager", 468 "ability_runtime:wantagent_innerkits", 469 "bundle_framework:appexecfwk_base", 470 "c_utils:utils", 471 "hiviewdfx_hilog_native:libhilog", 472 "ipc:ipc_core", 473 "samgr:samgr_proxy", 474 ] 475} 476 477ohos_moduletest("app_account_authenticator_session_manager_module_test") { 478 module_out_path = module_output_path 479 include_dirs = [ "${app_account_services_path}/test/mock/app_account" ] 480 sources = [ 481 "${app_account_services_path}/test/mock/app_account/app_account_authenticator_manager.cpp", 482 "${app_account_services_path}/test/mock/app_account/mock_app_account_authenticator_stub.cpp", 483 "${app_account_services_path}/test/mock/common/ability_manager_adapter.cpp", 484 "app_account_authenticator_session_manager_module_test.cpp", 485 ] 486 487 configs = [ ":app_account_service_config_unittest" ] 488 489 deps = [ 490 "${app_account_innerkits_native_path}:app_account_innerkits", 491 "${app_account_services_path}:accountmgr", 492 "${app_account_services_path}/src/appaccount:app_account_service_core", 493 "//third_party/googletest:gmock_main", 494 "//third_party/googletest:gtest_main", 495 ] 496 497 external_deps = [ 498 "ability_base:want", 499 "ability_runtime:app_manager", 500 "bundle_framework:appexecfwk_base", 501 "c_utils:utils", 502 "hiviewdfx_hilog_native:libhilog", 503 "ipc:ipc_core", 504 "kv_store:distributeddata_inner", 505 "samgr:samgr_proxy", 506 ] 507} 508 509ohos_moduletest("app_account_manager_service_thread_module_test") { 510 module_out_path = module_output_path 511 cflags_cc = [] 512 sources = [ 513 "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", 514 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 515 "app_account_manager_service_thread_module_test.cpp", 516 ] 517 518 configs = [ 519 ":app_account_service_config_mock", 520 ":app_account_service_config_unittest", 521 ] 522 523 deps = [ 524 "${app_account_innerkits_native_path}:app_account_innerkits", 525 "${app_account_services_path}:accountmgr", 526 "${app_account_services_path}/src/appaccount:app_account_service_core", 527 "${common_path}:libaccount_common", 528 "${innerkits_native_path}:libaccountkits", 529 "//third_party/googletest:gmock_main", 530 "//third_party/googletest:gtest_main", 531 ] 532 533 external_deps = [ 534 "ability_base:base", 535 "ability_base:want", 536 "ability_runtime:app_manager", 537 "bundle_framework:appexecfwk_base", 538 "bundle_framework:appexecfwk_core", 539 "eventhandler:libeventhandler", 540 "hiviewdfx_hilog_native:libhilog", 541 "ipc:ipc_core", 542 "kv_store:distributeddata_inner", 543 "safwk:system_ability_fwk", 544 "samgr:samgr_proxy", 545 ] 546 547 if (has_ces_part) { 548 cflags_cc += [ "-DHAS_CES_PART" ] 549 external_deps += [ "common_event_service:cesfwk_innerkits" ] 550 } 551} 552 553ohos_moduletest("app_account_subscribe_manager_test") { 554 module_out_path = module_output_path 555 cflags_cc = [] 556 sources = [ 557 "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", 558 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 559 "app_account_subscribe_manager_test.cpp", 560 ] 561 562 configs = [ 563 ":app_account_service_config_mock", 564 ":app_account_service_config_unittest", 565 ] 566 567 deps = [ 568 "${app_account_innerkits_native_path}:app_account_innerkits", 569 "${app_account_services_path}:accountmgr", 570 "${app_account_services_path}/src/appaccount:app_account_service_core", 571 "${common_path}:libaccount_common", 572 "${innerkits_native_path}:libaccountkits", 573 "//third_party/googletest:gmock_main", 574 "//third_party/googletest:gtest_main", 575 ] 576 577 external_deps = [ 578 "ability_base:base", 579 "ability_base:want", 580 "ability_runtime:app_manager", 581 "bundle_framework:appexecfwk_base", 582 "bundle_framework:appexecfwk_core", 583 "eventhandler:libeventhandler", 584 "hiviewdfx_hilog_native:libhilog", 585 "ipc:ipc_core", 586 "kv_store:distributeddata_inner", 587 "safwk:system_ability_fwk", 588 "samgr:samgr_proxy", 589 ] 590 591 if (has_ces_part) { 592 cflags_cc += [ "-DHAS_CES_PART" ] 593 external_deps += [ "common_event_service:cesfwk_innerkits" ] 594 } 595} 596 597group("moduletest") { 598 testonly = true 599 600 deps = [ 601 ":account_permission_manager_module_test", 602 ":app_account_authenticate_test", 603 ":app_account_authenticator_callback_test", 604 ":app_account_authenticator_session_manager_module_test", 605 ":app_account_authenticator_session_module_test", 606 ":app_account_check_labels_module_test", 607 ":app_account_control_manager_module_test", 608 ":app_account_event_module_test", 609 ":app_account_manager_service_module_test", 610 ":app_account_manager_service_subscribe_module_test", 611 ":app_account_manager_service_sync_module_test", 612 ":app_account_manager_service_thread_module_test", 613 ":app_account_subscribe_manager_test", 614 ":at_not_mock_app_account_manager_service_module_test", 615 ":bundle_manager_adapter_module_test", 616 ] 617}