# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("../../../../os_account.gni") module_output_path = "os_account/frameworks/account_iam" config("account_iam_native_config_unittest") { visibility = [ ":*" ] include_dirs = [ "include" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } defines = [ "ACCOUNT_LOG_TAG = \"AccountIAMUTestFwk\"", "LOG_DOMAIN = 0xD001B00", ] } ohos_unittest("account_iam_client_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "${os_account_path}/cfi_blocklist.txt" } module_out_path = module_output_path sources = [ "src/account_iam_callback_service_test.cpp", "src/account_iam_client_test.cpp", "src/test_common.cpp", ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${common_path}:libaccount_common", "${domain_account_framework_path}:domain_account_innerkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokensetproc_shared", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", ] cflags_cc = [] if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } if (has_user_auth_part) { cflags_cc += [ "-DHAS_USER_AUTH_PART" ] external_deps += [ "user_auth_framework:userauth_client" ] } } ohos_unittest("account_iam_client_proxy_mock_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "${os_account_path}/cfi_blocklist.txt" } module_out_path = module_output_path sources = [ "src/account_iam_callback_service_test.cpp", "src/account_iam_client_test.cpp", "src/test_common.cpp", ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${app_account_services_path}:accountmgr", "${common_path}:libaccount_common", "${domain_account_framework_path}:domain_account_innerkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokensetproc_shared", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", ] cflags_cc = [] if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } if (has_user_auth_part) { cflags_cc += [ "-DHAS_USER_AUTH_PART" ] external_deps += [ "user_auth_framework:userauth_client" ] } cflags_cc += [ "-DPROXY_MOCK" ] } ohos_unittest("account_iam_client_no_permission_proxy_mock_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "src/account_iam_client_no_permission_test.cpp" ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${app_account_services_path}:accountmgr", "${common_path}:libaccount_common", "${domain_account_framework_path}:domain_account_innerkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokensetproc_shared", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", ] cflags_cc = [] if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } if (has_user_auth_part) { cflags_cc += [ "-DHAS_USER_AUTH_PART" ] external_deps += [ "user_auth_framework:userauth_client" ] } cflags_cc += [ "-DPROXY_MOCK" ] } ohos_unittest("account_iam_client_no_permission_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "src/account_iam_client_no_permission_test.cpp" ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${common_path}:libaccount_common", "${domain_account_framework_path}:domain_account_innerkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokensetproc_shared", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", ] cflags_cc = [] if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } if (has_user_auth_part) { cflags_cc += [ "-DHAS_USER_AUTH_PART" ] external_deps += [ "user_auth_framework:userauth_client" ] } } ohos_unittest("account_iam_mgr_proxy_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "src/account_iam_mgr_proxy_test.cpp", "src/test_common.cpp", ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${common_path}:libaccount_common", "${domain_account_framework_path}:domain_account_innerkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "access_token:libaccesstoken_sdk", "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", ] cflags_cc = [] if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } if (has_user_auth_part) { cflags_cc += [ "-DHAS_USER_AUTH_PART" ] external_deps += [ "user_auth_framework:userauth_client" ] } } group("unittest") { testonly = true deps = [ ":account_iam_client_no_permission_proxy_mock_test", ":account_iam_client_no_permission_test", ":account_iam_client_proxy_mock_test", ":account_iam_client_test", ":account_iam_mgr_proxy_test", ] }