# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//build/test.gni") import("../../../../../os_account.gni") module_output_path = "os_account/services/ohos_account" config("accountmgr_data_deal_test_config") { include_dirs = [ "./include", "${app_account_core_path}/include", "${app_account_interfaces_native_path}/include", "${common_path}/log/include", "${innerkits_common}/include", "${os_account_dfx_path}/hisysevent_adapter", "${services_path}/accountmgr/include", "${innerkits_path}/include", ] } ohos_unittest("OhosServiceTest") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags_cc = [] include_dirs = [ "${account_iam_interfaces_native_path}/include", "${os_account_interfaces_native_path}/include", "${os_account_core_path}/include", ] sources = [ "${common_path}/log/src/account_log_wrapper.cpp", "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", "${services_path}/accountmgr/src/account_event_provider.cpp", "${services_path}/accountmgr/src/account_mgr_service.cpp", "${services_path}/accountmgr/src/distributed_account_subscribe_death_recipient.cpp", "${services_path}/accountmgr/src/distributed_account_subscribe_manager.cpp", "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", "${services_path}/accountmgr/src/ohos_account_manager.cpp", ] sources += [ "ohos_account_manager_test.cpp" ] configs = [ ":accountmgr_data_deal_test_config", "${services_path}/accountmgr:accountmgr_config", "${services_path}/accountmgr/test:accountmgr_test_config", ] deps = [ "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "${os_account_innerkits_native_path}:os_account_innerkits", "${services_path}/accountmgr:accountmgr", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", "json:nlohmann_json_static", "kv_store:distributeddata_inner", "mbedtls:mbedtls_shared", "safwk:system_ability_fwk", ] if (has_hiviewdfx_hisysevent_part) { cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] external_deps += [ "hisysevent:libhisysevent" ] } if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } part_name = "os_account" } ohos_unittest("OhosDataDealTest") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags_cc = [] resource_config_file = "${os_account_path}/test/resource/accountmgrservice/ohos_test.xml" include_dirs = [ "${account_iam_interfaces_native_path}/include", "${os_account_interfaces_native_path}/include", "${os_account_core_path}/include", ] sources = [ "${common_path}/log/src/account_log_wrapper.cpp", "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", ] sources += [ "ohos_account_data_deal_test.cpp" ] configs = [ ":accountmgr_data_deal_test_config", "${services_path}/accountmgr/test:accountmgr_test_config", ] deps = [ "${common_path}:libaccount_common", "${os_account_innerkits_native_path}:os_account_innerkits", "${services_path}/accountmgr:accountmgr", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", "json:nlohmann_json_static", ] if (has_hiviewdfx_hisysevent_part) { cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] external_deps += [ "hisysevent:libhisysevent" ] } part_name = "os_account" } ohos_unittest("OhosEventManagerMultipleThreadTest") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path cflags_cc = [] include_dirs = [ "${services_path}/accountmgr/include", "${os_account_dfx_path}/hidumper_adapter", ] sources = [ "${services_path}/accountmgr/src/distributed_account_subscribe_death_recipient.cpp", "${services_path}/accountmgr/src/distributed_account_subscribe_manager.cpp", "ohos_account_event_manager_multiple_thread_test.cpp", ] configs = [ "${services_path}/accountmgr/test:accountmgr_test_config" ] deps = [ "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", ] part_name = "os_account" } group("unittest") { testonly = true deps = [ ":OhosDataDealTest", ":OhosEventManagerMultipleThreadTest", ":OhosServiceTest", ] }