1# Copyright (c) 2022-2025 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/os_account" 18 19config("account_proxy_mock_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_proxy_mock_test") { 36 branch_protector_ret = "pac_ret" 37 38 sanitize = { 39 cfi = true 40 cfi_cross_dso = true 41 debug = false 42 } 43 44 module_out_path = module_output_path 45 46 sources = [ 47 "${account_iam_framework_path}/src/account_iam_client.cpp", 48 "${app_account_innerkits_native_path}/src/app_account.cpp", 49 "${app_account_innerkits_native_path}/src/app_account_death_recipient.cpp", 50 "${app_account_innerkits_native_path}/src/app_account_event_listener.cpp", 51 "${app_account_innerkits_native_path}/src/app_account_manager.cpp", 52 "${app_account_innerkits_native_path}/src/app_account_subscriber.cpp", 53 "${innerkits_native_path}/src/ohos_account_kits.cpp", 54 "${innerkits_native_path}/src/ohos_account_kits_impl.cpp", 55 "${os_account_core_path}/src/os_account_constraint_subscriber_manager.cpp", 56 "${os_account_core_path}/src/os_account.cpp", 57 "${os_account_core_path}/src/os_account_death_recipient.cpp", 58 "${os_account_core_path}/src/os_account_event_listener.cpp", 59 "${os_account_core_path}/src/os_account_state_parcel.cpp", 60 "${os_account_innerkits_native_path}/src/os_account_constraint_subscribe_info.cpp", 61 "${os_account_innerkits_native_path}/src/os_account_constraint_subscriber.cpp", 62 "${os_account_innerkits_native_path}/src/os_account_manager.cpp", 63 "${os_account_innerkits_native_path}/src/os_account_subscriber.cpp", 64 "${os_account_core_path}/src/os_account_state_reply_callback.cpp", 65 "account_iam_proxy_mock_test.cpp", 66 "account_ohosaccount_proxy_mock_test.cpp", 67 "mock/iservice_registry.cpp", 68 ] 69 70 cflags_cc = [] 71 72 if (use_libfuzzer) { 73 cflags_cc += [ "-DFUZZ_TEST" ] 74 } 75 76 if (os_account_support_lock_os_account) { 77 cflags_cc += [ "-DSUPPORT_LOCK_OS_ACCOUNT" ] 78 } 79 80 configs = [ ":account_proxy_mock_config_unittest" ] 81 82 deps = [ 83 "${account_iam_framework_path}:account_iam_innerkits", 84 "${app_account_innerkits_native_path}:app_account_innerkits", 85 "${common_path}:libaccount_common", 86 "${domain_account_framework_path}:domain_account_innerkits", 87 "${innerkits_native_path}:libaccountkits", 88 "${os_account_innerkits_native_path}:os_account_event_stub", 89 "${os_account_innerkits_native_path}:os_account_innerkits", 90 "${os_account_innerkits_native_path}:os_account_constraint_event_stub", 91 ] 92 93 external_deps = [ 94 "ability_base:want", 95 "access_token:libaccesstoken_sdk", 96 "cJSON:cjson", 97 "c_utils:utils", 98 "googletest:gmock_main", 99 "googletest:gtest_main", 100 "hilog:libhilog", 101 "ipc:ipc_single", 102 "ipc:libdbinder", 103 "samgr:samgr_proxy", 104 ] 105 106 cflags_cc = [] 107 if (has_pin_auth_part) { 108 cflags_cc += [ "-DHAS_PIN_AUTH_PART" ] 109 external_deps += [ "pin_auth:pinauth_framework" ] 110 } 111 112 if (has_user_auth_part) { 113 cflags_cc += [ "-DHAS_USER_AUTH_PART" ] 114 external_deps += [ "user_auth_framework:userauth_client" ] 115 } 116} 117 118group("unittest") { 119 testonly = true 120 121 deps = [ ":account_proxy_mock_test" ] 122} 123