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/domain_account" 19 20config("domain_account_service_config_unittest") { 21 visibility = [ ":*" ] 22 23 include_dirs = [] 24 25 cflags = [] 26 if (target_cpu == "arm") { 27 cflags += [ "-DBINDER_IPC_32BIT" ] 28 } 29 30 defines = [ 31 "ACCOUNT_LOG_TAG = \"DomainAccountFwk\"", 32 "LOG_DOMAIN = 0xD001B00", 33 ] 34} 35 36config("domain_account_amgr_mock_config") { 37 include_dirs = [ 38 "${domain_account_framework_path}/include", 39 "${domain_account_interfaces_native_path}/include", 40 "${os_account_dfx_path}/hitrace_adapter", 41 "${services_path}/accountmgr/include", 42 "${services_path}/accountmgr/include/account_iam", 43 "${services_path}/accountmgr/include/domain_account", 44 "${services_path}/accountmgr/include/ability_manager_adapter", 45 "${services_path}/accountmgr/test/unittest/domain_account/mock", 46 "${common_path}/log/include", 47 "${domain_account_framework_path}/test/moduletest/include", 48 "${common_path}/perf_stat/include", 49 "${innerkits_common}/include", 50 "${innerkits_path}/include", 51 ] 52} 53 54ohos_unittest("DomainAccountInnerServiceCovTest") { 55 branch_protector_ret = "pac_ret" 56 57 sanitize = { 58 cfi = true 59 cfi_cross_dso = true 60 debug = false 61 blocklist = "${os_account_path}/cfi_blocklist.txt" 62 } 63 64 cflags_cc = [] 65 module_out_path = module_output_path 66 67 sources = [ 68 "${domain_account_framework_path}/test/moduletest/src/mock_domain_plugin.cpp", 69 "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", 70 "${services_path}/accountmgr/src/account_event_provider.cpp", 71 "${services_path}/accountmgr/src/domain_account/domain_account_plugin_death_recipient.cpp", 72 "${services_path}/accountmgr/src/domain_account/domain_has_domain_info_callback.cpp", 73 "${services_path}/accountmgr/src/domain_account/inner_domain_account_manager.cpp", 74 "${services_path}/accountmgr/src/domain_account/status_listener_death_recipient.cpp", 75 "${services_path}/accountmgr/src/domain_account/status_listener_manager.cpp", 76 "${services_path}/accountmgr/test/unittest/domain_account/mock/mock_domain_account_callback_stub.cpp", 77 "${services_path}/accountmgr/test/unittest/domain_account/mock/mock_inner_os_account_manager.cpp", 78 "${services_path}/accountmgr/test/unittest/domain_account/mock/mock_musl.cpp", 79 "domain_account_manager_inner_service_test.cpp", 80 ] 81 configs = [ 82 ":domain_account_amgr_mock_config", 83 "${services_path}/accountmgr/test:accountmgr_test_config", 84 "${services_path}/accountmgr/:ability_manager_config", 85 ] 86 87 deps = [ 88 "${account_iam_framework_path}:account_iam_innerkits", 89 "${common_path}:libaccount_common", 90 "${domain_account_framework_path}:domain_account_innerkits", 91 "${os_account_innerkits_native_path}:os_account_innerkits", 92 "${services_path}/accountmgr:accountmgr", 93 "//third_party/googletest:gmock_main", 94 "//third_party/googletest:gtest_main", 95 ] 96 97 external_deps = [ 98 "ability_base:base", 99 "ability_base:want", 100 "ability_runtime:wantagent_innerkits", 101 "access_token:libaccesstoken_sdk", 102 "c_utils:utils", 103 "hilog:libhilog", 104 "init:libbegetutil", 105 "ipc:ipc_single", 106 "json:nlohmann_json_static", 107 "kv_store:distributeddata_inner", 108 "samgr:samgr_proxy", 109 ] 110 if (has_ces_part) { 111 cflags_cc += [ "-DHAS_CES_PART" ] 112 external_deps += [ "common_event_service:cesfwk_innerkits" ] 113 } 114 if (has_hiviewdfx_hisysevent_part) { 115 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 116 external_deps += [ "hisysevent:libhisysevent" ] 117 } 118 if (has_user_auth_part) { 119 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 120 external_deps += [ "user_auth_framework:userauth_client" ] 121 } 122 if (has_hiviewdfx_hitrace_part) { 123 external_deps += [ "hitrace:hitrace_meter" ] 124 cflags_cc += [ "-DHAS_HITRACE_PART" ] 125 } 126 127 part_name = "os_account" 128} 129 130ohos_unittest("domain_account_plugin_proxy_test") { 131 branch_protector_ret = "pac_ret" 132 133 sanitize = { 134 cfi = true 135 cfi_cross_dso = true 136 debug = false 137 } 138 139 module_out_path = module_output_path 140 141 include_dirs = [ "${domain_account_interfaces_native_path}/include" ] 142 sources = [ 143 "${services_path}/accountmgr/src/domain_account/domain_account_plugin_proxy.cpp", 144 "${services_path}/accountmgr/src/domain_account/domain_has_domain_info_callback.cpp", 145 "domain_account_plugin_proxy_test.cpp", 146 ] 147 configs = [ ":domain_account_service_config_unittest" ] 148 149 deps = [ 150 "${common_path}:libaccount_common", 151 "${domain_account_framework_path}:domain_account_innerkits", 152 "${os_account_innerkits_native_path}:os_account_innerkits", 153 "${services_path}/accountmgr:accountmgr", 154 "//third_party/googletest:gmock_main", 155 "//third_party/googletest:gtest_main", 156 ] 157 158 external_deps = [ 159 "ability_base:want", 160 "c_utils:utils", 161 "hilog:libhilog", 162 "ipc:ipc_single", 163 ] 164} 165 166group("unittest") { 167 testonly = true 168 169 deps = [ 170 ":DomainAccountInnerServiceCovTest", 171 ":domain_account_plugin_proxy_test", 172 ] 173} 174