• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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/services/account_iam"
18
19config("account_iam_native_config_unittest") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "include",
24    "${services_path}/accountmgr/include/account_iam",
25  ]
26
27  cflags = []
28  if (target_cpu == "arm") {
29    cflags += [ "-DBINDER_IPC_32BIT" ]
30  }
31
32  defines = [
33    "ACCOUNT_LOG_TAG = \"AccountIAMUTestFwk\"",
34    "LOG_DOMAIN = 0xD001B00",
35  ]
36}
37
38ohos_unittest("account_iam_service_test") {
39  branch_protector_ret = "pac_ret"
40
41  sanitize = {
42    cfi = true
43    cfi_cross_dso = true
44    debug = false
45  }
46
47  module_out_path = module_output_path
48
49  sources = [ "account_iam_service_test.cpp" ]
50
51  configs = [ ":account_iam_native_config_unittest" ]
52
53  deps = [
54    "${account_iam_framework_path}:account_iam_innerkits",
55    "${common_path}:libaccount_common",
56    "${services_path}/accountmgr:accountmgr",
57    "//third_party/googletest:gmock_main",
58    "//third_party/googletest:gtest_main",
59  ]
60
61  external_deps = [
62    "access_token:libaccesstoken_sdk",
63    "access_token:libtokensetproc_shared",
64    "c_utils:utils",
65    "hilog:libhilog",
66    "ipc:ipc_single",
67    "os_account:os_account_innerkits",
68  ]
69
70  cflags_cc = []
71  if (has_pin_auth_part) {
72    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
73    external_deps += [ "pin_auth:pinauth_framework" ]
74  }
75
76  if (has_user_auth_part) {
77    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
78    external_deps += [ "user_auth_framework:userauth_client" ]
79  }
80}
81
82ohos_unittest("account_iam_stub_test") {
83  branch_protector_ret = "pac_ret"
84
85  sanitize = {
86    cfi = true
87    cfi_cross_dso = true
88    debug = false
89  }
90
91  module_out_path = module_output_path
92
93  sources = [
94    "${services_path}/accountmgr/src/account_iam/account_iam_mgr_stub.cpp",
95    "account_iam_stub_test.cpp",
96  ]
97
98  configs = [ ":account_iam_native_config_unittest" ]
99
100  deps = [
101    "${account_iam_framework_path}:account_iam_innerkits",
102    "${account_test_common}:account_test_common_source_set",
103    "${common_path}:libaccount_common",
104    "${services_path}/accountmgr:accountmgr",
105    "//third_party/googletest:gmock_main",
106    "//third_party/googletest:gtest_main",
107  ]
108
109  external_deps = [
110    "access_token:libaccesstoken_sdk",
111    "access_token:libtokensetproc_shared",
112    "c_utils:utils",
113    "hilog:libhilog",
114    "ipc:ipc_single",
115    "os_account:os_account_innerkits",
116  ]
117
118  cflags_cc = []
119  if (has_pin_auth_part) {
120    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
121    external_deps += [ "pin_auth:pinauth_framework" ]
122  }
123
124  if (has_user_auth_part) {
125    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
126    external_deps += [ "user_auth_framework:userauth_client" ]
127  }
128}
129
130ohos_unittest("account_iam_callback_test") {
131  branch_protector_ret = "pac_ret"
132
133  sanitize = {
134    cfi = true
135    cfi_cross_dso = true
136    debug = false
137  }
138
139  module_out_path = module_output_path
140
141  sources = [
142    "${domain_account_framework_path}/test/moduletest/src/mock_domain_plugin.cpp",
143    "account_iam_callback_test.cpp",
144  ]
145
146  configs = [ ":account_iam_native_config_unittest" ]
147
148  deps = [
149    "${account_iam_framework_path}:account_iam_innerkits",
150    "${common_path}:libaccount_common",
151    "${domain_account_framework_path}:domain_account_innerkits",
152    "${os_account_core_path}:os_account_core",
153    "${os_account_innerkits_native_path}:os_account_innerkits",
154    "${services_path}/accountmgr:accountmgr",
155    "//third_party/googletest:gmock_main",
156    "//third_party/googletest:gtest_main",
157  ]
158
159  include_dirs = [
160    "${os_account_path}/frameworks/domain_account/test/moduletest/include/",
161    "${os_account_interfaces_native_path}/include/",
162  ]
163
164  external_deps = [
165    "access_token:libaccesstoken_sdk",
166    "access_token:libtokensetproc_shared",
167    "c_utils:utils",
168    "hilog:libhilog",
169    "ipc:ipc_single",
170  ]
171
172  cflags_cc = []
173  if (has_pin_auth_part) {
174    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
175    external_deps += [ "pin_auth:pinauth_framework" ]
176  }
177
178  if (has_user_auth_part) {
179    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
180    external_deps += [ "user_auth_framework:userauth_client" ]
181  }
182}
183
184ohos_unittest("account_iam_manager_test") {
185  branch_protector_ret = "pac_ret"
186
187  sanitize = {
188    cfi = true
189    cfi_cross_dso = true
190    debug = false
191    blocklist = "${os_account_path}/cfi_blocklist.txt"
192  }
193
194  module_out_path = module_output_path
195
196  sources = [ "account_iam_manager_test.cpp" ]
197
198  configs = [
199    ":account_iam_native_config_unittest",
200    "${services_path}/accountmgr:account_iam_config",
201  ]
202
203  deps = [
204    "${account_iam_framework_path}:account_iam_innerkits",
205    "${account_test_common}:account_test_common_source_set",
206    "${common_path}:libaccount_common",
207    "${services_path}/accountmgr:accountmgr",
208    "//third_party/googletest:gmock_main",
209    "//third_party/googletest:gtest_main",
210  ]
211
212  cflags_cc = []
213  if (has_user_auth_part) {
214    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
215  }
216
217  external_deps = [
218    "access_token:libaccesstoken_sdk",
219    "access_token:libtokensetproc_shared",
220    "c_utils:utils",
221    "hilog:libhilog",
222    "init:libbegetutil",
223    "ipc:ipc_single",
224    "user_auth_framework:userauth_client",
225  ]
226
227  if (has_storage_service_part) {
228    cflags_cc += [ "-DHAS_STORAGE_PART" ]
229    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
230  }
231
232  if (has_pin_auth_part) {
233    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
234    external_deps += [ "pin_auth:pinauth_framework" ]
235  }
236}
237
238group("unittest") {
239  testonly = true
240  deps = []
241  if (!use_libfuzzer) {
242    deps += [
243      ":account_iam_callback_test",
244      ":account_iam_manager_test",
245      ":account_iam_service_test",
246      ":account_iam_stub_test",
247    ]
248  }
249}
250