1# Copyright (c) 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("//build/ohos.gni") 15import("//build/test.gni") 16import("../../../../../os_account.gni") 17 18module_output_path = "os_account/services/ohos_account" 19 20config("accountmgr_data_deal_test_config") { 21 include_dirs = [ 22 "./include", 23 "${app_account_core_path}/include", 24 "${app_account_interfaces_native_path}/include", 25 "${common_path}/log/include", 26 "${innerkits_common}/include", 27 "${os_account_dfx_path}/hisysevent_adapter", 28 "${services_path}/accountmgr/include", 29 "${innerkits_path}/include", 30 ] 31} 32 33ohos_unittest("OhosServiceTest") { 34 branch_protector_ret = "pac_ret" 35 36 sanitize = { 37 cfi = true 38 cfi_cross_dso = true 39 debug = false 40 } 41 42 module_out_path = module_output_path 43 cflags_cc = [] 44 include_dirs = [ 45 "${account_iam_interfaces_native_path}/include", 46 "${os_account_interfaces_native_path}/include", 47 "${os_account_core_path}/include", 48 ] 49 50 sources = [ 51 "${common_path}/log/src/account_log_wrapper.cpp", 52 "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", 53 "${services_path}/accountmgr/src/account_event_provider.cpp", 54 "${services_path}/accountmgr/src/account_mgr_service.cpp", 55 "${services_path}/accountmgr/src/distributed_account_subscribe_death_recipient.cpp", 56 "${services_path}/accountmgr/src/distributed_account_subscribe_manager.cpp", 57 "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", 58 "${services_path}/accountmgr/src/ohos_account_manager.cpp", 59 ] 60 61 sources += [ "ohos_account_manager_test.cpp" ] 62 63 configs = [ 64 ":accountmgr_data_deal_test_config", 65 "${services_path}/accountmgr:accountmgr_config", 66 "${services_path}/accountmgr/test:accountmgr_test_config", 67 ] 68 69 deps = [ 70 "${common_path}:libaccount_common", 71 "${innerkits_native_path}:libaccountkits", 72 "${os_account_innerkits_native_path}:os_account_innerkits", 73 "${services_path}/accountmgr:accountmgr", 74 "//third_party/googletest:gmock_main", 75 "//third_party/googletest:gtest_main", 76 ] 77 78 external_deps = [ 79 "ability_base:base", 80 "ability_base:want", 81 "ability_runtime:app_manager", 82 "access_token:libaccesstoken_sdk", 83 "access_token:libtokenid_sdk", 84 "c_utils:utils", 85 "hilog:libhilog", 86 "ipc:ipc_single", 87 "json:nlohmann_json_static", 88 "kv_store:distributeddata_inner", 89 "mbedtls:mbedtls_shared", 90 "safwk:system_ability_fwk", 91 ] 92 if (has_hiviewdfx_hisysevent_part) { 93 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 94 external_deps += [ "hisysevent:libhisysevent" ] 95 } 96 if (has_ces_part) { 97 cflags_cc += [ "-DHAS_CES_PART" ] 98 external_deps += [ "common_event_service:cesfwk_innerkits" ] 99 } 100 part_name = "os_account" 101} 102 103ohos_unittest("OhosDataDealTest") { 104 branch_protector_ret = "pac_ret" 105 106 sanitize = { 107 cfi = true 108 cfi_cross_dso = true 109 debug = false 110 } 111 112 module_out_path = module_output_path 113 cflags_cc = [] 114 resource_config_file = 115 "${os_account_path}/test/resource/accountmgrservice/ohos_test.xml" 116 include_dirs = [ 117 "${account_iam_interfaces_native_path}/include", 118 "${os_account_interfaces_native_path}/include", 119 "${os_account_core_path}/include", 120 ] 121 122 sources = [ 123 "${common_path}/log/src/account_log_wrapper.cpp", 124 "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", 125 "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", 126 ] 127 128 sources += [ "ohos_account_data_deal_test.cpp" ] 129 130 configs = [ 131 ":accountmgr_data_deal_test_config", 132 "${services_path}/accountmgr/test:accountmgr_test_config", 133 ] 134 135 deps = [ 136 "${common_path}:libaccount_common", 137 "${os_account_innerkits_native_path}:os_account_innerkits", 138 "${services_path}/accountmgr:accountmgr", 139 "//third_party/googletest:gmock_main", 140 "//third_party/googletest:gtest_main", 141 ] 142 143 external_deps = [ 144 "ability_base:want", 145 "ability_runtime:app_manager", 146 "c_utils:utils", 147 "hilog:libhilog", 148 "ipc:ipc_single", 149 "json:nlohmann_json_static", 150 ] 151 if (has_hiviewdfx_hisysevent_part) { 152 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 153 external_deps += [ "hisysevent:libhisysevent" ] 154 } 155 part_name = "os_account" 156} 157 158ohos_unittest("OhosEventManagerMultipleThreadTest") { 159 branch_protector_ret = "pac_ret" 160 161 sanitize = { 162 cfi = true 163 cfi_cross_dso = true 164 debug = false 165 } 166 167 module_out_path = module_output_path 168 cflags_cc = [] 169 include_dirs = [ 170 "${services_path}/accountmgr/include", 171 "${os_account_dfx_path}/hidumper_adapter", 172 ] 173 174 sources = [ 175 "${services_path}/accountmgr/src/distributed_account_subscribe_death_recipient.cpp", 176 "${services_path}/accountmgr/src/distributed_account_subscribe_manager.cpp", 177 "ohos_account_event_manager_multiple_thread_test.cpp", 178 ] 179 180 configs = [ "${services_path}/accountmgr/test:accountmgr_test_config" ] 181 182 deps = [ 183 "${common_path}:libaccount_common", 184 "${innerkits_native_path}:libaccountkits", 185 "//third_party/googletest:gmock_main", 186 "//third_party/googletest:gtest_main", 187 ] 188 189 external_deps = [ 190 "ability_base:base", 191 "ability_base:want", 192 "c_utils:utils", 193 "hilog:libhilog", 194 "ipc:ipc_single", 195 ] 196 197 part_name = "os_account" 198} 199 200group("unittest") { 201 testonly = true 202 203 deps = [ 204 ":OhosDataDealTest", 205 ":OhosEventManagerMultipleThreadTest", 206 ":OhosServiceTest", 207 ] 208} 209