1# Copyright (c) 2021-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/app_account" 18 19config("app_account_interfaces_native_config_mock") { 20 include_dirs = [ "${app_account_innerkits_native_path}/test/mock" ] 21} 22 23app_account_mock_sources = [] 24 25config("app_account_native_config_unittest") { 26 visibility = [ ":*" ] 27 28 include_dirs = [ "include" ] 29 30 cflags = [] 31 if (target_cpu == "arm") { 32 cflags += [ "-DBINDER_IPC_32BIT" ] 33 } 34 35 defines = [ 36 "ACCOUNT_LOG_TAG = \"AppAccountUTestFwk\"", 37 "LOG_DOMAIN = 0xD001B00", 38 ] 39} 40 41ohos_unittest("app_account_manager_test") { 42 branch_protector_ret = "pac_ret" 43 44 sanitize = { 45 cfi = true 46 cfi_cross_dso = true 47 debug = false 48 } 49 50 module_out_path = module_output_path 51 52 sources = [ "app_account_manager_test.cpp" ] 53 sources += app_account_mock_sources 54 55 configs = [ 56 ":app_account_interfaces_native_config_mock", 57 ":app_account_native_config_unittest", 58 ] 59 60 deps = [ 61 "${app_account_innerkits_native_path}:app_account_innerkits", 62 "${common_path}:libaccount_common", 63 ] 64 65 external_deps = [ 66 "ability_base:want", 67 "c_utils:utils", 68 "googletest:gmock_main", 69 "googletest:gtest_main", 70 "hilog:libhilog", 71 "ipc:ipc_single", 72 ] 73} 74 75ohos_unittest("app_account_manager_subscribe_test") { 76 branch_protector_ret = "pac_ret" 77 78 sanitize = { 79 cfi = true 80 cfi_cross_dso = true 81 debug = false 82 } 83 84 module_out_path = module_output_path 85 86 sources = [ "app_account_manager_subscribe_test.cpp" ] 87 sources += app_account_mock_sources 88 89 configs = [ 90 ":app_account_interfaces_native_config_mock", 91 ":app_account_native_config_unittest", 92 ] 93 94 deps = [ 95 "${app_account_innerkits_native_path}:app_account_innerkits", 96 "${app_account_services_path}:accountmgr", 97 "${app_account_services_path}/src/appaccount:app_account_service_core", 98 "${common_path}:libaccount_common", 99 ] 100 101 external_deps = [ 102 "ability_base:want", 103 "bundle_framework:appexecfwk_base", 104 "c_utils:utils", 105 "googletest:gmock_main", 106 "googletest:gtest_main", 107 "hilog:libhilog", 108 "ipc:ipc_single", 109 "samgr:samgr_proxy", 110 ] 111} 112 113ohos_unittest("app_account_common_test") { 114 branch_protector_ret = "pac_ret" 115 116 sanitize = { 117 cfi = true 118 cfi_cross_dso = true 119 debug = false 120 } 121 122 module_out_path = module_output_path 123 124 sources = [ "app_account_common_test.cpp" ] 125 sources += app_account_mock_sources 126 sources += [ "${app_account_innerkits_native_path}/src/app_account_common.cpp" ] 127 128 configs = [ 129 ":app_account_interfaces_native_config_mock", 130 ":app_account_native_config_unittest", 131 ] 132 133 deps = [ 134 "${app_account_innerkits_native_path}:app_account_innerkits", 135 "${common_path}:libaccount_common", 136 ] 137 138 external_deps = [ 139 "ability_base:base", 140 "ability_base:want", 141 "c_utils:utils", 142 "googletest:gmock_main", 143 "googletest:gtest_main", 144 "hilog:libhilog", 145 "ipc:ipc_single", 146 ] 147} 148 149group("unittest") { 150 testonly = true 151 152 deps = [ 153 ":app_account_common_test", 154 ":app_account_manager_subscribe_test", 155 ":app_account_manager_test", 156 ] 157} 158