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 = [ ":account_iam_native_config_unittest" ] 54 55 deps = [ 56 "${account_iam_framework_path}:account_iam_innerkits", 57 "${common_path}:libaccount_common", 58 "${domain_account_framework_path}:domain_account_innerkits", 59 "//third_party/googletest:gmock_main", 60 "//third_party/googletest:gtest_main", 61 ] 62 63 external_deps = [ 64 "access_token:libaccesstoken_sdk", 65 "access_token:libtokensetproc_shared", 66 "c_utils:utils", 67 "hilog:libhilog", 68 "ipc:ipc_single", 69 ] 70 71 cflags_cc = [] 72 if (has_pin_auth_part) { 73 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 74 external_deps += [ "pin_auth:pinauth_framework" ] 75 } 76 77 if (has_user_auth_part) { 78 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 79 external_deps += [ "user_auth_framework:userauth_client" ] 80 } 81} 82 83ohos_unittest("account_iam_client_proxy_mock_test") { 84 branch_protector_ret = "pac_ret" 85 86 sanitize = { 87 cfi = true 88 cfi_cross_dso = true 89 debug = false 90 blocklist = "${os_account_path}/cfi_blocklist.txt" 91 } 92 93 module_out_path = module_output_path 94 95 sources = [ 96 "src/account_iam_callback_service_test.cpp", 97 "src/account_iam_client_test.cpp", 98 "src/test_common.cpp", 99 ] 100 101 configs = [ ":account_iam_native_config_unittest" ] 102 103 deps = [ 104 "${account_iam_framework_path}:account_iam_innerkits", 105 "${app_account_services_path}:accountmgr", 106 "${common_path}:libaccount_common", 107 "${domain_account_framework_path}:domain_account_innerkits", 108 "//third_party/googletest:gmock_main", 109 "//third_party/googletest:gtest_main", 110 ] 111 112 external_deps = [ 113 "access_token:libaccesstoken_sdk", 114 "access_token:libtokensetproc_shared", 115 "c_utils:utils", 116 "hilog:libhilog", 117 "ipc:ipc_single", 118 ] 119 120 cflags_cc = [] 121 if (has_pin_auth_part) { 122 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 123 external_deps += [ "pin_auth:pinauth_framework" ] 124 } 125 126 if (has_user_auth_part) { 127 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 128 external_deps += [ "user_auth_framework:userauth_client" ] 129 } 130 cflags_cc += [ "-DPROXY_MOCK" ] 131} 132 133ohos_unittest("account_iam_client_no_permission_proxy_mock_test") { 134 branch_protector_ret = "pac_ret" 135 136 sanitize = { 137 cfi = true 138 cfi_cross_dso = true 139 debug = false 140 } 141 142 module_out_path = module_output_path 143 144 sources = [ "src/account_iam_client_no_permission_test.cpp" ] 145 146 configs = [ ":account_iam_native_config_unittest" ] 147 148 deps = [ 149 "${account_iam_framework_path}:account_iam_innerkits", 150 "${app_account_services_path}:accountmgr", 151 "${common_path}:libaccount_common", 152 "${domain_account_framework_path}:domain_account_innerkits", 153 "//third_party/googletest:gmock_main", 154 "//third_party/googletest:gtest_main", 155 ] 156 157 external_deps = [ 158 "access_token:libaccesstoken_sdk", 159 "access_token:libtokensetproc_shared", 160 "c_utils:utils", 161 "hilog:libhilog", 162 "ipc:ipc_single", 163 ] 164 165 cflags_cc = [] 166 if (has_pin_auth_part) { 167 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 168 external_deps += [ "pin_auth:pinauth_framework" ] 169 } 170 171 if (has_user_auth_part) { 172 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 173 external_deps += [ "user_auth_framework:userauth_client" ] 174 } 175 cflags_cc += [ "-DPROXY_MOCK" ] 176} 177 178ohos_unittest("account_iam_client_no_permission_test") { 179 branch_protector_ret = "pac_ret" 180 181 sanitize = { 182 cfi = true 183 cfi_cross_dso = true 184 debug = false 185 } 186 187 module_out_path = module_output_path 188 189 sources = [ "src/account_iam_client_no_permission_test.cpp" ] 190 191 configs = [ ":account_iam_native_config_unittest" ] 192 193 deps = [ 194 "${account_iam_framework_path}:account_iam_innerkits", 195 "${common_path}:libaccount_common", 196 "${domain_account_framework_path}:domain_account_innerkits", 197 "//third_party/googletest:gmock_main", 198 "//third_party/googletest:gtest_main", 199 ] 200 201 external_deps = [ 202 "access_token:libaccesstoken_sdk", 203 "access_token:libtokensetproc_shared", 204 "c_utils:utils", 205 "hilog:libhilog", 206 "ipc:ipc_single", 207 ] 208 209 cflags_cc = [] 210 if (has_pin_auth_part) { 211 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 212 external_deps += [ "pin_auth:pinauth_framework" ] 213 } 214 215 if (has_user_auth_part) { 216 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 217 external_deps += [ "user_auth_framework:userauth_client" ] 218 } 219} 220 221ohos_unittest("account_iam_mgr_proxy_test") { 222 branch_protector_ret = "pac_ret" 223 224 sanitize = { 225 cfi = true 226 cfi_cross_dso = true 227 debug = false 228 } 229 230 module_out_path = module_output_path 231 232 sources = [ 233 "src/account_iam_mgr_proxy_test.cpp", 234 "src/test_common.cpp", 235 ] 236 237 configs = [ ":account_iam_native_config_unittest" ] 238 239 deps = [ 240 "${account_iam_framework_path}:account_iam_innerkits", 241 "${common_path}:libaccount_common", 242 "${domain_account_framework_path}:domain_account_innerkits", 243 "//third_party/googletest:gmock_main", 244 "//third_party/googletest:gtest_main", 245 ] 246 247 external_deps = [ 248 "access_token:libaccesstoken_sdk", 249 "c_utils:utils", 250 "hilog:libhilog", 251 "ipc:ipc_single", 252 ] 253 254 cflags_cc = [] 255 if (has_pin_auth_part) { 256 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 257 external_deps += [ "pin_auth:pinauth_framework" ] 258 } 259 260 if (has_user_auth_part) { 261 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 262 external_deps += [ "user_auth_framework:userauth_client" ] 263 } 264} 265 266group("unittest") { 267 testonly = true 268 269 deps = [ 270 ":account_iam_client_no_permission_proxy_mock_test", 271 ":account_iam_client_no_permission_test", 272 ":account_iam_client_proxy_mock_test", 273 ":account_iam_client_test", 274 ":account_iam_mgr_proxy_test", 275 ] 276} 277