1# Copyright (c) 2021-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/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 "//third_party/googletest:gmock_main", 64 "//third_party/googletest:gtest_main", 65 ] 66 67 external_deps = [ 68 "ability_base:want", 69 "c_utils:utils", 70 "hilog:libhilog", 71 "ipc:ipc_single", 72 ] 73} 74 75ohos_unittest("app_account_manager_proxy_mock_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 = [ 87 "${app_account_innerkits_native_path}/src/app_account_proxy.cpp", 88 "app_account_manager_test.cpp", 89 ] 90 sources += app_account_mock_sources 91 92 configs = [ 93 ":app_account_interfaces_native_config_mock", 94 ":app_account_native_config_unittest", 95 ] 96 97 deps = [ 98 "${app_account_innerkits_native_path}:app_account_innerkits", 99 "${app_account_services_path}:accountmgr", 100 "${common_path}:libaccount_common", 101 "//third_party/googletest:gmock_main", 102 "//third_party/googletest:gtest_main", 103 ] 104 105 external_deps = [ 106 "ability_base:want", 107 "ability_runtime:ability_manager", 108 "ability_runtime:app_manager", 109 "c_utils:utils", 110 "hilog:libhilog", 111 "ipc:ipc_single", 112 "kv_store:distributeddata_inner", 113 ] 114 cflags_cc = [ "-DPROXY_MOCK" ] 115} 116 117ohos_unittest("app_account_manager_subscribe_test") { 118 branch_protector_ret = "pac_ret" 119 120 sanitize = { 121 cfi = true 122 cfi_cross_dso = true 123 debug = false 124 } 125 126 module_out_path = module_output_path 127 128 sources = [ "app_account_manager_subscribe_test.cpp" ] 129 sources += app_account_mock_sources 130 131 configs = [ 132 ":app_account_interfaces_native_config_mock", 133 ":app_account_native_config_unittest", 134 ] 135 136 deps = [ 137 "${app_account_innerkits_native_path}:app_account_innerkits", 138 "${app_account_services_path}:accountmgr", 139 "${app_account_services_path}/src/appaccount:app_account_service_core", 140 "${common_path}:libaccount_common", 141 "//third_party/googletest:gmock_main", 142 "//third_party/googletest:gtest_main", 143 ] 144 145 external_deps = [ 146 "ability_base:want", 147 "bundle_framework:appexecfwk_base", 148 "c_utils:utils", 149 "hilog:libhilog", 150 "ipc:ipc_single", 151 "samgr:samgr_proxy", 152 ] 153} 154 155ohos_unittest("app_account_common_test") { 156 branch_protector_ret = "pac_ret" 157 158 sanitize = { 159 cfi = true 160 cfi_cross_dso = true 161 debug = false 162 } 163 164 module_out_path = module_output_path 165 166 sources = [ "app_account_common_test.cpp" ] 167 sources += app_account_mock_sources 168 169 configs = [ 170 ":app_account_interfaces_native_config_mock", 171 ":app_account_native_config_unittest", 172 ] 173 174 deps = [ 175 "${app_account_innerkits_native_path}:app_account_innerkits", 176 "${common_path}:libaccount_common", 177 "//third_party/googletest:gmock_main", 178 "//third_party/googletest:gtest_main", 179 ] 180 181 external_deps = [ 182 "ability_base:want", 183 "c_utils:utils", 184 "hilog:libhilog", 185 "ipc:ipc_single", 186 ] 187} 188 189group("unittest") { 190 testonly = true 191 192 deps = [ 193 ":app_account_common_test", 194 ":app_account_manager_subscribe_test", 195 ":app_account_manager_test", 196 ] 197} 198