• 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/frameworks/account_iam"
18
19config("account_iam_native_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_iam_client_test") {
36  branch_protector_ret = "pac_ret"
37
38  sanitize = {
39    cfi = true
40    cfi_cross_dso = true
41    debug = false
42    blocklist = "${os_account_path}/cfi_blocklist.txt"
43  }
44
45  module_out_path = module_output_path
46
47  sources = [
48    "src/account_iam_callback_service_test.cpp",
49    "src/account_iam_client_test.cpp",
50    "src/test_common.cpp",
51  ]
52
53  configs = [ ":account_iam_native_config_unittest" ]
54
55  deps = [
56    "${account_iam_framework_path}:account_iam_innerkits",
57    "${account_test_common}:account_test_common_source_set",
58    "${common_path}:libaccount_common",
59    "${domain_account_framework_path}:domain_account_innerkits",
60    "//third_party/googletest:gmock_main",
61    "//third_party/googletest:gtest_main",
62  ]
63
64  external_deps = [
65    "access_token:libaccesstoken_sdk",
66    "access_token:libtokensetproc_shared",
67    "c_utils:utils",
68    "hilog:libhilog",
69    "ipc:ipc_single",
70  ]
71
72  cflags_cc = []
73  if (has_pin_auth_part) {
74    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
75    external_deps += [ "pin_auth:pinauth_framework" ]
76  }
77
78  if (has_user_auth_part) {
79    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
80    external_deps += [ "user_auth_framework:userauth_client" ]
81  }
82}
83
84ohos_unittest("account_iam_client_proxy_mock_test") {
85  branch_protector_ret = "pac_ret"
86
87  sanitize = {
88    cfi = true
89    cfi_cross_dso = true
90    debug = false
91    blocklist = "${os_account_path}/cfi_blocklist.txt"
92  }
93
94  module_out_path = module_output_path
95
96  sources = [
97    "src/account_iam_callback_service_test.cpp",
98    "src/account_iam_client_test.cpp",
99    "src/test_common.cpp",
100  ]
101
102  configs = [ ":account_iam_native_config_unittest" ]
103
104  deps = [
105    "${account_iam_framework_path}:account_iam_innerkits",
106    "${account_test_common}:account_test_common_source_set",
107    "${app_account_services_path}:accountmgr",
108    "${common_path}:libaccount_common",
109    "${domain_account_framework_path}:domain_account_innerkits",
110    "//third_party/googletest:gmock_main",
111    "//third_party/googletest:gtest_main",
112  ]
113
114  external_deps = [
115    "access_token:libaccesstoken_sdk",
116    "access_token:libtokensetproc_shared",
117    "c_utils:utils",
118    "hilog:libhilog",
119    "ipc:ipc_single",
120  ]
121
122  cflags_cc = []
123  if (has_pin_auth_part) {
124    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
125    external_deps += [ "pin_auth:pinauth_framework" ]
126  }
127
128  if (has_user_auth_part) {
129    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
130    external_deps += [ "user_auth_framework:userauth_client" ]
131  }
132  cflags_cc += [ "-DPROXY_MOCK" ]
133}
134
135ohos_unittest("account_iam_client_no_permission_proxy_mock_test") {
136  branch_protector_ret = "pac_ret"
137
138  sanitize = {
139    cfi = true
140    cfi_cross_dso = true
141    debug = false
142  }
143
144  module_out_path = module_output_path
145
146  sources = [ "src/account_iam_client_no_permission_test.cpp" ]
147
148  configs = [ ":account_iam_native_config_unittest" ]
149
150  deps = [
151    "${account_iam_framework_path}:account_iam_innerkits",
152    "${app_account_services_path}:accountmgr",
153    "${common_path}:libaccount_common",
154    "${domain_account_framework_path}:domain_account_innerkits",
155    "//third_party/googletest:gmock_main",
156    "//third_party/googletest:gtest_main",
157  ]
158
159  external_deps = [
160    "access_token:libaccesstoken_sdk",
161    "access_token:libtokensetproc_shared",
162    "c_utils:utils",
163    "hilog:libhilog",
164    "ipc:ipc_single",
165  ]
166
167  cflags_cc = []
168  if (has_pin_auth_part) {
169    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
170    external_deps += [ "pin_auth:pinauth_framework" ]
171  }
172
173  if (has_user_auth_part) {
174    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
175    external_deps += [ "user_auth_framework:userauth_client" ]
176  }
177  cflags_cc += [ "-DPROXY_MOCK" ]
178}
179
180ohos_unittest("account_iam_client_no_permission_test") {
181  branch_protector_ret = "pac_ret"
182
183  sanitize = {
184    cfi = true
185    cfi_cross_dso = true
186    debug = false
187  }
188
189  module_out_path = module_output_path
190
191  sources = [ "src/account_iam_client_no_permission_test.cpp" ]
192
193  configs = [ ":account_iam_native_config_unittest" ]
194
195  deps = [
196    "${account_iam_framework_path}:account_iam_innerkits",
197    "${common_path}:libaccount_common",
198    "${domain_account_framework_path}:domain_account_innerkits",
199    "//third_party/googletest:gmock_main",
200    "//third_party/googletest:gtest_main",
201  ]
202
203  external_deps = [
204    "access_token:libaccesstoken_sdk",
205    "access_token:libtokensetproc_shared",
206    "c_utils:utils",
207    "hilog:libhilog",
208    "ipc:ipc_single",
209  ]
210
211  cflags_cc = []
212  if (has_pin_auth_part) {
213    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
214    external_deps += [ "pin_auth:pinauth_framework" ]
215  }
216
217  if (has_user_auth_part) {
218    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
219    external_deps += [ "user_auth_framework:userauth_client" ]
220  }
221}
222
223ohos_unittest("account_iam_mgr_proxy_test") {
224  branch_protector_ret = "pac_ret"
225
226  sanitize = {
227    cfi = true
228    cfi_cross_dso = true
229    debug = false
230  }
231
232  module_out_path = module_output_path
233
234  sources = [
235    "src/account_iam_mgr_proxy_test.cpp",
236    "src/test_common.cpp",
237  ]
238
239  configs = [ ":account_iam_native_config_unittest" ]
240
241  deps = [
242    "${account_iam_framework_path}:account_iam_innerkits",
243    "${common_path}:libaccount_common",
244    "${domain_account_framework_path}:domain_account_innerkits",
245    "//third_party/googletest:gmock_main",
246    "//third_party/googletest:gtest_main",
247  ]
248
249  external_deps = [
250    "access_token:libaccesstoken_sdk",
251    "c_utils:utils",
252    "hilog:libhilog",
253    "ipc:ipc_single",
254  ]
255
256  cflags_cc = []
257  if (has_pin_auth_part) {
258    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
259    external_deps += [ "pin_auth:pinauth_framework" ]
260  }
261
262  if (has_user_auth_part) {
263    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
264    external_deps += [ "user_auth_framework:userauth_client" ]
265  }
266}
267
268group("unittest") {
269  testonly = true
270
271  deps = [
272    ":account_iam_client_no_permission_proxy_mock_test",
273    ":account_iam_client_no_permission_test",
274    ":account_iam_client_proxy_mock_test",
275    ":account_iam_client_test",
276    ":account_iam_mgr_proxy_test",
277  ]
278}
279