1# Copyright (c) 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("//build/test.gni") 15import("../../../../os_account.gni") 16 17module_output_path = "os_account/frameworks/account_iam" 18 19config("account_iam_native_config_unittest") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ "include" ] 23 24 cflags = [] 25 if (target_cpu == "arm") { 26 cflags += [ "-DBINDER_IPC_32BIT" ] 27 } 28 29 defines = [ 30 "ACCOUNT_LOG_TAG = \"AccountIAMUTestFwk\"", 31 "LOG_DOMAIN = 0xD001B00", 32 ] 33} 34 35ohos_unittest("account_iam_client_test") { 36 branch_protector_ret = "pac_ret" 37 38 sanitize = { 39 cfi = true 40 cfi_cross_dso = true 41 debug = false 42 blocklist = "${os_account_path}/cfi_blocklist.txt" 43 } 44 45 module_out_path = module_output_path 46 47 sources = [ 48 "src/account_iam_callback_service_test.cpp", 49 "src/account_iam_client_test.cpp", 50 "src/test_common.cpp", 51 ] 52 53 configs = [ 54 ":account_iam_native_config_unittest", 55 "${account_coverage_config_path}:coverage_flags", 56 ] 57 58 deps = [ 59 "${account_iam_framework_path}:account_iam_innerkits", 60 "${common_path}:libaccount_common", 61 "${domain_account_framework_path}:domain_account_innerkits", 62 "//third_party/googletest:gmock_main", 63 "//third_party/googletest:gtest_main", 64 ] 65 66 external_deps = [ 67 "access_token:libaccesstoken_sdk", 68 "access_token:libtoken_setproc", 69 "c_utils:utils", 70 "hilog:libhilog", 71 "ipc:ipc_single", 72 ] 73 74 cflags_cc = [] 75 if (has_pin_auth_part) { 76 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 77 external_deps += [ "pin_auth:pinauth_framework" ] 78 } 79 80 if (has_user_auth_part) { 81 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 82 external_deps += [ "user_auth_framework:userauth_client" ] 83 } 84} 85 86ohos_unittest("account_iam_client_proxy_mock_test") { 87 branch_protector_ret = "pac_ret" 88 89 sanitize = { 90 cfi = true 91 cfi_cross_dso = true 92 debug = false 93 blocklist = "${os_account_path}/cfi_blocklist.txt" 94 } 95 96 module_out_path = module_output_path 97 98 sources = [ 99 "src/account_iam_callback_service_test.cpp", 100 "src/account_iam_client_test.cpp", 101 "src/test_common.cpp", 102 ] 103 104 configs = [ 105 ":account_iam_native_config_unittest", 106 "${account_coverage_config_path}:coverage_flags", 107 ] 108 109 deps = [ 110 "${account_iam_framework_path}:account_iam_innerkits", 111 "${app_account_services_path}:accountmgr", 112 "${common_path}:libaccount_common", 113 "${domain_account_framework_path}:domain_account_innerkits", 114 "//third_party/googletest:gmock_main", 115 "//third_party/googletest:gtest_main", 116 ] 117 118 external_deps = [ 119 "access_token:libaccesstoken_sdk", 120 "access_token:libtoken_setproc", 121 "c_utils:utils", 122 "hilog:libhilog", 123 "ipc:ipc_single", 124 ] 125 126 cflags_cc = [] 127 if (has_pin_auth_part) { 128 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 129 external_deps += [ "pin_auth:pinauth_framework" ] 130 } 131 132 if (has_user_auth_part) { 133 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 134 external_deps += [ "user_auth_framework:userauth_client" ] 135 } 136 cflags_cc += [ "-DPROXY_MOCK" ] 137} 138 139ohos_unittest("account_iam_client_no_permission_proxy_mock_test") { 140 branch_protector_ret = "pac_ret" 141 142 sanitize = { 143 cfi = true 144 cfi_cross_dso = true 145 debug = false 146 } 147 148 module_out_path = module_output_path 149 150 sources = [ "src/account_iam_client_no_permission_test.cpp" ] 151 152 configs = [ 153 ":account_iam_native_config_unittest", 154 "${account_coverage_config_path}:coverage_flags", 155 ] 156 157 deps = [ 158 "${account_iam_framework_path}:account_iam_innerkits", 159 "${app_account_services_path}:accountmgr", 160 "${common_path}:libaccount_common", 161 "${domain_account_framework_path}:domain_account_innerkits", 162 "//third_party/googletest:gmock_main", 163 "//third_party/googletest:gtest_main", 164 ] 165 166 external_deps = [ 167 "access_token:libaccesstoken_sdk", 168 "access_token:libtoken_setproc", 169 "c_utils:utils", 170 "hilog:libhilog", 171 "ipc:ipc_single", 172 ] 173 174 cflags_cc = [] 175 if (has_pin_auth_part) { 176 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 177 external_deps += [ "pin_auth:pinauth_framework" ] 178 } 179 180 if (has_user_auth_part) { 181 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 182 external_deps += [ "user_auth_framework:userauth_client" ] 183 } 184 cflags_cc += [ "-DPROXY_MOCK" ] 185} 186 187ohos_unittest("account_iam_client_no_permission_test") { 188 branch_protector_ret = "pac_ret" 189 190 sanitize = { 191 cfi = true 192 cfi_cross_dso = true 193 debug = false 194 } 195 196 module_out_path = module_output_path 197 198 sources = [ "src/account_iam_client_no_permission_test.cpp" ] 199 200 configs = [ 201 ":account_iam_native_config_unittest", 202 "${account_coverage_config_path}:coverage_flags", 203 ] 204 205 deps = [ 206 "${account_iam_framework_path}:account_iam_innerkits", 207 "${common_path}:libaccount_common", 208 "${domain_account_framework_path}:domain_account_innerkits", 209 "//third_party/googletest:gmock_main", 210 "//third_party/googletest:gtest_main", 211 ] 212 213 external_deps = [ 214 "access_token:libaccesstoken_sdk", 215 "access_token:libtoken_setproc", 216 "c_utils:utils", 217 "hilog:libhilog", 218 "ipc:ipc_single", 219 ] 220 221 cflags_cc = [] 222 if (has_pin_auth_part) { 223 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 224 external_deps += [ "pin_auth:pinauth_framework" ] 225 } 226 227 if (has_user_auth_part) { 228 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 229 external_deps += [ "user_auth_framework:userauth_client" ] 230 } 231} 232 233ohos_unittest("account_iam_mgr_proxy_test") { 234 branch_protector_ret = "pac_ret" 235 236 sanitize = { 237 cfi = true 238 cfi_cross_dso = true 239 debug = false 240 } 241 242 module_out_path = module_output_path 243 244 sources = [ 245 "src/account_iam_mgr_proxy_test.cpp", 246 "src/test_common.cpp", 247 ] 248 249 configs = [ 250 ":account_iam_native_config_unittest", 251 "${account_coverage_config_path}:coverage_flags", 252 ] 253 254 deps = [ 255 "${account_iam_framework_path}:account_iam_innerkits", 256 "${common_path}:libaccount_common", 257 "${domain_account_framework_path}:domain_account_innerkits", 258 "//third_party/googletest:gmock_main", 259 "//third_party/googletest:gtest_main", 260 ] 261 262 external_deps = [ 263 "access_token:libaccesstoken_sdk", 264 "c_utils:utils", 265 "hilog:libhilog", 266 "ipc:ipc_single", 267 ] 268 269 cflags_cc = [] 270 if (has_pin_auth_part) { 271 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 272 external_deps += [ "pin_auth:pinauth_framework" ] 273 } 274 275 if (has_user_auth_part) { 276 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 277 external_deps += [ "user_auth_framework:userauth_client" ] 278 } 279} 280 281group("unittest") { 282 testonly = true 283 284 deps = [ 285 ":account_iam_client_no_permission_proxy_mock_test", 286 ":account_iam_client_no_permission_test", 287 ":account_iam_client_proxy_mock_test", 288 ":account_iam_client_test", 289 ":account_iam_mgr_proxy_test", 290 ] 291} 292