1# Copyright (c) 2021-2024 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("../../../../services/accountmgr/os_account_service.gni") 16 17module_output_path = "os_account/os_account" 18 19ohos_moduletest("account_command_module_mock_test") { 20 branch_protector_ret = "pac_ret" 21 22 sanitize = { 23 cfi = true 24 cfi_cross_dso = true 25 debug = false 26 } 27 28 module_out_path = module_output_path 29 30 include_dirs = [ 31 "${app_account_innerkits_native_path}/include", 32 "${os_account_dfx_path}/hidumper_adapter", 33 "${services_path}/accountmgr/include/bundle_manager_adapter", 34 "${services_path}/accountmgr/include/ability_manager_adapter", 35 "${services_path}/accountmgr/include", 36 "${os_account_dfx_path}/hitrace_adapter", 37 "${services_path}/accountmgr/include/account_iam", 38 "${services_path}/accountmgr/include/appaccount", 39 "${services_path}/accountmgr/include/domain_account", 40 "${services_path}/accountmgr/include/osaccount", 41 "${os_account_path}/interfaces/innerkits/ohosaccount/native/include/", 42 ] 43 44 sources = [ 45 "${app_account_services_path}/test/mock/common/ability_manager_adapter_mock.cpp", 46 "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", 47 "${common_path}/log/src/account_log_wrapper.cpp", 48 "${innerkits_native_path}/src/account_info_parcel.cpp", 49 "${innerkits_native_path}/src/account_proxy.cpp", 50 "${innerkits_native_path}/src/ohos_account_kits.cpp", 51 "${innerkits_native_path}/src/ohos_account_kits_impl.cpp", 52 "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", 53 "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", 54 "${services_path}/accountmgr/src/account_iam/account_iam_callback.cpp", 55 "${services_path}/accountmgr/src/account_iam/account_iam_mgr_stub.cpp", 56 "${services_path}/accountmgr/src/account_iam/account_iam_service.cpp", 57 "${services_path}/accountmgr/src/account_iam/inner_account_iam_manager.cpp", 58 "${services_path}/accountmgr/src/appaccount/app_account_control_manager.cpp", 59 "${tools_path}/acm/src/account_command.cpp", 60 "account_command_create_module_test.cpp", 61 "account_command_delete_module_test.cpp", 62 "account_command_util.cpp", 63 ] 64 sources += account_service_sources 65 configs = [ "${tools_path}/acm:tools_acm_config" ] 66 67 cflags = [] 68 if (target_cpu == "arm") { 69 cflags += [ "-DBINDER_IPC_32BIT" ] 70 } 71 72 deps = [ 73 "${account_iam_framework_path}:account_iam_innerkits", 74 "${account_test_common}:account_test_common_source_set", 75 "${common_path}:libaccount_common", 76 "${domain_account_framework_path}:domain_account_innerkits", 77 "${innerkits_native_path}:libaccountkits", 78 "${os_account_innerkits_native_path}:os_account_innerkits", 79 ] 80 81 use_exceptions = true 82 83 external_deps = [ 84 "ability_base:want", 85 "ability_runtime:ability_manager", 86 "ability_runtime:app_manager", 87 "ability_runtime:tools_aa_source_set", 88 "ability_runtime:wantagent_innerkits", 89 "access_token:libaccesstoken_sdk", 90 "access_token:libtokenid_sdk", 91 "access_token:libtokensetproc_shared", 92 "bundle_framework:appexecfwk_base", 93 "bundle_framework:appexecfwk_core", 94 "c_utils:utils", 95 "config_policy:configpolicy_util", 96 "googletest:gmock_main", 97 "googletest:gtest_main", 98 "hilog:libhilog", 99 "ipc:ipc_single", 100 "mbedtls:mbedtls_shared", 101 "safwk:system_ability_fwk", 102 "samgr:samgr_proxy", 103 ] 104 cflags_cc = [] 105 if (has_storage_service_part) { 106 external_deps += [ "storage_service:storage_manager_sa_proxy" ] 107 } 108 if (os_account_distributed_feature) { 109 cflags_cc += [ "-DENABLE_FILE_WATCHER" ] 110 sources += 111 [ "${services_path}/accountmgr/src/account_file_watcher_manager.cpp" ] 112 if (has_huks_part) { 113 external_deps += [ "huks:libhukssdk" ] 114 cflags_cc += [ "-DHAS_HUKS_PART" ] 115 } 116 } 117 if (has_user_auth_part) { 118 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 119 external_deps += [ "user_auth_framework:userauth_client" ] 120 } 121 if (has_ces_part) { 122 cflags_cc += [ "-DHAS_CES_PART" ] 123 external_deps += [ "common_event_service:cesfwk_innerkits" ] 124 } 125 if (has_kv_store_part) { 126 external_deps += [ "kv_store:distributeddata_inner" ] 127 } 128 cflags_cc += [ "-DACCOUNT_TEST" ] 129 cflags_cc += [ "-DBUNDLE_ADAPTER_MOCK" ] 130 if (os_account_support_domain_accounts) { 131 cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] 132 } 133} 134 135ohos_moduletest("account_command_module_test") { 136 branch_protector_ret = "pac_ret" 137 138 sanitize = { 139 cfi = true 140 cfi_cross_dso = true 141 debug = false 142 } 143 144 module_out_path = module_output_path 145 146 sources = [ 147 "${tools_path}/acm/src/account_command.cpp", 148 "account_command_create_module_test.cpp", 149 "account_command_delete_module_test.cpp", 150 "account_command_dump_module_test.cpp", 151 "account_command_set_module_test.cpp", 152 "account_command_switch_module_test.cpp", 153 "account_command_util.cpp", 154 ] 155 156 configs = [ "${tools_path}/acm:tools_acm_config" ] 157 158 cflags = [] 159 if (target_cpu == "arm") { 160 cflags += [ "-DBINDER_IPC_32BIT" ] 161 } 162 163 deps = [ 164 "${account_test_common}:account_test_common_source_set", 165 "${common_path}:libaccount_common", 166 "${os_account_innerkits_native_path}:os_account_innerkits", 167 ] 168 169 external_deps = [ 170 "ability_base:base", 171 "ability_runtime:ability_manager", 172 "ability_runtime:tools_aa_source_set", 173 "c_utils:utils", 174 "googletest:gmock_main", 175 "googletest:gtest_main", 176 "hilog:libhilog", 177 "ipc:ipc_single", 178 ] 179 cflags_cc = [ "-DACCOUNT_TEST" ] 180 if (os_account_distributed_feature) { 181 cflags_cc += [ "-DENABLE_FILE_WATCHER" ] 182 } 183} 184 185group("moduletest") { 186 testonly = true 187 deps = [] 188 if (os_account_enable_multiple_os_accounts || use_clang_coverage) { 189 deps += [ 190 ":account_command_module_mock_test", 191 ":account_command_module_test", 192 ] 193 } 194} 195