# 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/services/account_iam" config("account_iam_native_config_unittest") { visibility = [ ":*" ] include_dirs = [ "include", "${services_path}/accountmgr/include/account_iam", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } defines = [ "ACCOUNT_LOG_TAG = \"AccountIAMUTestFwk\"", "LOG_DOMAIN = 0xD001B00", ] } ohos_unittest("account_iam_service_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "account_iam_service_test.cpp" ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${common_path}:libaccount_common", "${services_path}/accountmgr:accountmgr", "//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", "os_account:os_account_innerkits", ] 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_stub_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "${services_path}/accountmgr/src/account_iam/account_iam_mgr_stub.cpp", "account_iam_stub_test.cpp", ] configs = [ ":account_iam_native_config_unittest" ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${common_path}:libaccount_common", "${services_path}/accountmgr:accountmgr", "//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", "os_account:os_account_innerkits", ] 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_callback_test") { branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } module_out_path = module_output_path sources = [ "${domain_account_framework_path}/test/moduletest/src/mock_domain_plugin.cpp", "account_iam_callback_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", "${os_account_core_path}:os_account_core", "${os_account_innerkits_native_path}:os_account_innerkits", "${services_path}/accountmgr:accountmgr", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] include_dirs = [ "${os_account_path}/frameworks/domain_account/test/moduletest/include/", "${os_account_interfaces_native_path}/include/", ] 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_manager_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 = [ "account_iam_manager_test.cpp" ] configs = [ ":account_iam_native_config_unittest", "${services_path}/accountmgr:account_iam_config", ] deps = [ "${account_iam_framework_path}:account_iam_innerkits", "${common_path}:libaccount_common", "${services_path}/accountmgr:accountmgr", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] cflags_cc = [] if (has_user_auth_part) { cflags_cc += [ "-DHAS_USER_AUTH_PART" ] } external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokensetproc_shared", "c_utils:utils", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", "user_auth_framework:userauth_client", ] if (has_storage_service_part) { cflags_cc += [ "-DHAS_STORAGE_PART" ] external_deps += [ "storage_service:storage_manager_sa_proxy" ] } if (has_pin_auth_part) { cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] external_deps += [ "pin_auth:pinauth_framework" ] } } group("unittest") { testonly = true deps = [] if (!use_libfuzzer) { deps += [ ":account_iam_callback_test", ":account_iam_manager_test", ":account_iam_service_test", ":account_iam_stub_test", ] } }