1# Copyright (c) 2021-2023 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")
16import("../../../os_account_service.gni")
17
18module_output_path = "os_account/services/app_account"
19
20config("app_account_service_config_mock") {
21  include_dirs = [
22    "${app_account_services_path}/test/mock/app_account",
23    "${app_account_services_path}/test/mock/common",
24    "${app_account_innerkits_native_path}/include",
25  ]
26}
27
28config("app_account_service_config_unittest") {
29  visibility = [ ":*" ]
30
31  include_dirs = []
32
33  cflags = []
34  if (target_cpu == "arm") {
35    cflags += [ "-DBINDER_IPC_32BIT" ]
36  }
37
38  defines = [
39    "ACCOUNT_LOG_TAG = \"AppAccountMTest\"",
40    "LOG_DOMAIN = 0xD001B00",
41  ]
42}
43
44ohos_moduletest("app_account_check_labels_module_test") {
45  branch_protector_ret = "pac_ret"
46
47  sanitize = {
48    cfi = true
49    cfi_cross_dso = true
50    debug = false
51  }
52
53  module_out_path = module_output_path
54  sources = [ "app_account_check_labels_module_test.cpp" ]
55
56  configs = [ ":app_account_service_config_unittest" ]
57
58  deps = [
59    "${app_account_innerkits_native_path}:app_account_innerkits",
60    "${app_account_services_path}:accountmgr",
61    "${app_account_services_path}/src/appaccount:app_account_service_core",
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:base",
69    "ability_base:want",
70    "ability_runtime:app_manager",
71    "bundle_framework:appexecfwk_base",
72    "bundle_framework:appexecfwk_core",
73    "c_utils:utils",
74    "hilog:libhilog",
75    "ipc:ipc_single",
76    "kv_store:distributeddata_inner",
77    "samgr:samgr_proxy",
78  ]
79}
80
81ohos_moduletest("app_account_authorization_extension_ability_test") {
82  branch_protector_ret = "pac_ret"
83
84  sanitize = {
85    cfi = true
86    cfi_cross_dso = true
87    debug = false
88  }
89
90  module_out_path = module_output_path
91  include_dirs = [
92    "${app_account_extension_path}/include",
93    "${os_account_path}/interfaces/innerkits/appaccount/native/include",
94    "${account_napi_common_path}/include",
95    "${app_account_innerkits_native_path}/include",
96    "${app_account_services_path}/include",
97  ]
98  sources = [
99    "${app_account_services_path}/src/appaccount/app_account_authorization_extension_proxy.cpp",
100    "app_account_authorization_extension_ability_test.cpp",
101  ]
102
103  configs = [ ":app_account_service_config_unittest" ]
104
105  deps = [
106    "${account_napi_common_path}:account_napi_common",
107    "${app_account_innerkits_native_path}:app_account_innerkits",
108    "${app_account_services_path}:accountmgr",
109    "${common_path}:libaccount_common",
110    "//third_party/googletest:gmock_main",
111    "//third_party/googletest:gtest_main",
112  ]
113
114  external_deps = [
115    "ability_base:want",
116    "ability_runtime:ability_context_native",
117    "ability_runtime:ability_manager",
118    "ability_runtime:abilitykit_native",
119    "ability_runtime:app_context",
120    "ability_runtime:runtime",
121    "c_utils:utils",
122    "hilog:libhilog",
123    "ipc:ipc_single",
124    "napi:ace_napi",
125    "samgr:samgr_proxy",
126  ]
127}
128
129ohos_moduletest("account_permission_manager_module_test") {
130  branch_protector_ret = "pac_ret"
131
132  sanitize = {
133    cfi = true
134    cfi_cross_dso = true
135    debug = false
136  }
137
138  module_out_path = module_output_path
139
140  sources = [ "account_permission_manager_module_test.cpp" ]
141
142  deps = [
143    "${common_path}:libaccount_common",
144    "//third_party/googletest:gmock_main",
145    "//third_party/googletest:gtest_main",
146  ]
147
148  external_deps = [
149    "access_token:libaccesstoken_sdk",
150    "access_token:libtokensetproc_shared",
151    "c_utils:utils",
152    "hilog:libhilog",
153    "ipc:ipc_single",
154  ]
155
156  defines = [
157    "ACCOUNT_LOG_TAG = \"AppAccountMTest\"",
158    "LOG_DOMAIN = 0xD001B00",
159  ]
160}
161
162ohos_moduletest("app_account_manager_service_associated_data_test") {
163  branch_protector_ret = "pac_ret"
164
165  sanitize = {
166    cfi = true
167    cfi_cross_dso = true
168    debug = false
169  }
170
171  module_out_path = module_output_path
172  cflags_cc = []
173  cflags = []
174  sources = [
175    "${app_account_services_path}/src/account_data_storage.cpp",
176    "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp",
177    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
178    "${app_account_services_path}/src/appaccount/app_account_stub.cpp",
179    "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp",
180    "${app_account_services_path}/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
181    "${app_account_services_path}/src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp",
182    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
183    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
184    "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp",
185    "${innerkits_native_path}/src/account_info_parcel.cpp",
186    "app_account_associated_data_test.cpp",
187  ]
188
189  sources += ability_base_sources
190  sources += app_account_sources_mock
191
192  use_exceptions = true
193
194  configs = [
195    ":app_account_service_config_unittest",
196    "${app_account_services_path}/test/mock:mock_accountmgr_config",
197    "${app_account_services_path}/test/mock:accountmgr_config",
198    "${app_account_services_path}/test/mock:ability_manager_config",
199  ]
200  include_dirs = [
201    "${app_account_services_path}/test/mock/common",
202    "${app_account_innerkits_native_path}/include",
203  ]
204
205  deps = [
206    "${app_account_innerkits_native_path}:app_account_innerkits",
207    "${common_path}:libaccount_common",
208    "${os_account_innerkits_native_path}:os_account_innerkits",
209    "//third_party/googletest:gmock_main",
210    "//third_party/googletest:gtest_main",
211  ]
212
213  external_deps = [
214    "ability_base:base",
215    "ability_base:want",
216    "ability_runtime:app_manager",
217    "bundle_framework:appexecfwk_base",
218    "bundle_framework:appexecfwk_core",
219    "c_utils:utils",
220    "hilog:libhilog",
221    "ipc:ipc_single",
222    "kv_store:distributeddata_inner",
223    "mbedtls:mbedtls_shared",
224    "safwk:system_ability_fwk",
225    "samgr:samgr_proxy",
226  ]
227
228  external_deps += [
229    "ability_runtime:wantagent_innerkits",
230    "access_token:libtokenid_sdk",
231  ]
232  if (has_huks_part) {
233    external_deps += [ "huks:libhukssdk" ]
234  }
235
236  if (has_storage_service_part) {
237    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
238  }
239
240  if (build_selinux) {
241    external_deps += [ "selinux_adapter:librestorecon" ]
242  }
243
244  if (has_ces_part) {
245    external_deps += [ "common_event_service:cesfwk_innerkits" ]
246  }
247
248  if (has_hiviewdfx_hisysevent_part) {
249    external_deps += [ "hisysevent:libhisysevent" ]
250  }
251
252  if (hicollie_enable == true) {
253    external_deps += [ "hicollie:libhicollie" ]
254  }
255
256  if (security_guard_enabled) {
257    external_deps += [
258      "security_guard:libsg_collect_sdk",
259      "time_service:time_client",
260    ]
261  }
262
263  if (has_hiviewdfx_hitrace_part) {
264    external_deps += [ "hitrace:hitrace_meter" ]
265  }
266  if (has_user_auth_part) {
267    external_deps += [
268      "access_token:libtokensetproc_shared",
269      "user_auth_framework:userauth_client",
270    ]
271  }
272
273  if (has_kv_store_part) {
274    external_deps += [ "kv_store:distributeddata_inner" ]
275  }
276
277  if (has_ces_part) {
278    cflags_cc += [ "-DHAS_CES_PART" ]
279    external_deps += [ "common_event_service:cesfwk_innerkits" ]
280  }
281
282  if (os_account_distributed_feature) {
283    cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ]
284  }
285}
286
287ohos_moduletest("app_account_authenticator_callback_test") {
288  branch_protector_ret = "pac_ret"
289
290  sanitize = {
291    cfi = true
292    cfi_cross_dso = true
293    debug = false
294  }
295
296  module_out_path = module_output_path
297  cflags_cc = []
298  sources = [ "app_account_authenticator_callback_test.cpp" ]
299
300  configs = [ ":app_account_service_config_unittest" ]
301
302  deps = [
303    "${app_account_innerkits_native_path}:app_account_innerkits",
304    "${app_account_services_path}:accountmgr",
305    "${app_account_services_path}/src/appaccount:app_account_service_core",
306    "${common_path}:libaccount_common",
307    "${innerkits_native_path}:libaccountkits",
308  ]
309
310  external_deps = [
311    "ability_base:want",
312    "c_utils:utils",
313    "hilog:libhilog",
314    "ipc:ipc_single",
315    "samgr:samgr_proxy",
316  ]
317
318  if (has_ces_part) {
319    cflags_cc += [ "-DHAS_CES_PART" ]
320    external_deps += [ "common_event_service:cesfwk_innerkits" ]
321  }
322}
323
324ohos_moduletest("app_account_event_module_test") {
325  branch_protector_ret = "pac_ret"
326
327  sanitize = {
328    cfi = true
329    cfi_cross_dso = true
330    debug = false
331  }
332
333  module_out_path = module_output_path
334  cflags_cc = []
335  sources = [ "app_account_event_module_test.cpp" ]
336
337  configs = [ ":app_account_service_config_unittest" ]
338
339  deps = [
340    "${app_account_innerkits_native_path}:app_account_innerkits",
341    "${app_account_services_path}:accountmgr",
342    "${app_account_services_path}/src/appaccount:app_account_service_core",
343    "${common_path}:libaccount_common",
344    "${innerkits_native_path}:libaccountkits",
345    "//third_party/googletest:gtest_main",
346  ]
347
348  external_deps = [
349    "ability_base:base",
350    "ability_base:want",
351    "bundle_framework:appexecfwk_base",
352    "c_utils:utils",
353    "hilog:libhilog",
354    "ipc:ipc_single",
355    "kv_store:distributeddata_inner",
356    "samgr:samgr_proxy",
357  ]
358
359  if (has_ces_part) {
360    cflags_cc += [ "-DHAS_CES_PART" ]
361    external_deps += [ "common_event_service:cesfwk_innerkits" ]
362  }
363}
364
365ohos_moduletest("app_account_authenticate_test") {
366  branch_protector_ret = "pac_ret"
367
368  sanitize = {
369    cfi = true
370    cfi_cross_dso = true
371    debug = false
372  }
373
374  module_out_path = module_output_path
375  cflags_cc = []
376  sources = [
377    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
378    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
379    "app_account_authenticate_test.cpp",
380  ]
381
382  configs = [
383    ":app_account_service_config_mock",
384    ":app_account_service_config_unittest",
385  ]
386
387  deps = [
388    "${app_account_innerkits_native_path}:app_account_innerkits",
389    "${app_account_services_path}:accountmgr",
390    "${app_account_services_path}/src/appaccount:app_account_service_core",
391    "${common_path}:libaccount_common",
392    "${innerkits_native_path}:libaccountkits",
393    "//third_party/googletest:gmock_main",
394    "//third_party/googletest:gtest_main",
395  ]
396
397  external_deps = [
398    "ability_base:base",
399    "ability_base:want",
400    "access_token:libaccesstoken_sdk",
401    "access_token:libtokensetproc_shared",
402    "bundle_framework:appexecfwk_base",
403    "bundle_framework:appexecfwk_core",
404    "c_utils:utils",
405    "hilog:libhilog",
406    "ipc:ipc_single",
407  ]
408
409  if (has_ces_part) {
410    cflags_cc += [ "-DHAS_CES_PART" ]
411    external_deps += [ "common_event_service:cesfwk_innerkits" ]
412  }
413}
414
415ohos_moduletest("app_account_control_manager_module_test") {
416  branch_protector_ret = "pac_ret"
417
418  sanitize = {
419    cfi = true
420    cfi_cross_dso = true
421    debug = false
422  }
423
424  module_out_path = module_output_path
425  cflags_cc = []
426  cflags = []
427  sources = [
428    "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp",
429    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
430    "${app_account_services_path}/src/appaccount/app_account_stub.cpp",
431    "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp",
432    "${app_account_services_path}/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
433    "${app_account_services_path}/src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp",
434    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
435    "${app_account_services_path}/test/mock/app_account/account_data_storage.cpp",
436    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
437    "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp",
438    "${innerkits_native_path}/src/account_info_parcel.cpp",
439    "app_account_control_manager_module_test.cpp",
440  ]
441
442  sources += ability_base_sources
443  sources += app_account_sources_mock
444
445  use_exceptions = true
446
447  configs = [
448    ":app_account_service_config_unittest",
449    "${app_account_services_path}/test/mock:mock_accountmgr_config",
450    "${app_account_services_path}/test/mock:accountmgr_config",
451    "${app_account_services_path}/test/mock:ability_manager_config",
452  ]
453  include_dirs = [
454    "${app_account_services_path}/test/mock/common",
455    "${app_account_innerkits_native_path}/include",
456  ]
457
458  deps = [
459    "${app_account_innerkits_native_path}:app_account_innerkits",
460    "${common_path}:libaccount_common",
461    "${os_account_innerkits_native_path}:os_account_innerkits",
462    "//third_party/googletest:gmock_main",
463    "//third_party/googletest:gtest_main",
464  ]
465
466  external_deps = [
467    "ability_base:base",
468    "ability_base:want",
469    "ability_runtime:app_manager",
470    "bundle_framework:appexecfwk_base",
471    "bundle_framework:appexecfwk_core",
472    "c_utils:utils",
473    "hilog:libhilog",
474    "ipc:ipc_single",
475    "kv_store:distributeddata_inner",
476    "mbedtls:mbedtls_shared",
477    "safwk:system_ability_fwk",
478    "samgr:samgr_proxy",
479  ]
480
481  external_deps += [
482    "ability_runtime:wantagent_innerkits",
483    "access_token:libtokenid_sdk",
484  ]
485  if (has_huks_part) {
486    external_deps += [ "huks:libhukssdk" ]
487  }
488
489  if (has_storage_service_part) {
490    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
491  }
492
493  if (build_selinux) {
494    external_deps += [ "selinux_adapter:librestorecon" ]
495  }
496
497  if (has_ces_part) {
498    external_deps += [ "common_event_service:cesfwk_innerkits" ]
499  }
500
501  if (has_hiviewdfx_hisysevent_part) {
502    external_deps += [ "hisysevent:libhisysevent" ]
503  }
504
505  if (hicollie_enable == true) {
506    external_deps += [ "hicollie:libhicollie" ]
507  }
508
509  if (security_guard_enabled) {
510    external_deps += [
511      "security_guard:libsg_collect_sdk",
512      "time_service:time_client",
513    ]
514  }
515
516  if (has_hiviewdfx_hitrace_part) {
517    external_deps += [ "hitrace:hitrace_meter" ]
518  }
519  if (has_user_auth_part) {
520    external_deps += [
521      "access_token:libtoken_setproc",
522      "user_auth_framework:userauth_client",
523    ]
524  }
525
526  if (has_kv_store_part) {
527    external_deps += [ "kv_store:distributeddata_inner" ]
528  }
529
530  if (has_ces_part) {
531    cflags_cc += [ "-DHAS_CES_PART" ]
532    external_deps += [ "common_event_service:cesfwk_innerkits" ]
533  }
534
535  if (os_account_distributed_feature) {
536    cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ]
537  }
538}
539
540ohos_moduletest("app_account_authenticator_session_module_test") {
541  branch_protector_ret = "pac_ret"
542
543  sanitize = {
544    cfi = true
545    cfi_cross_dso = true
546    debug = false
547    blocklist = "${os_account_path}/cfi_blocklist.txt"
548  }
549
550  module_out_path = module_output_path
551  include_dirs = [
552    "${app_account_services_path}/test/mock/app_account",
553    "${innerkits_native_path}/include",
554  ]
555  sources = [
556    "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp",
557    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
558    "${app_account_services_path}/src/appaccount/app_account_stub.cpp",
559    "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp",
560    "${app_account_services_path}/test/mock/app_account/app_account_authenticator_manager.cpp",
561    "${app_account_services_path}/test/mock/app_account/mock_app_account_authenticator_stub.cpp",
562    "${app_account_services_path}/test/mock/common/ability_manager_adapter.cpp",
563    "app_account_authenticator_session_module_test.cpp",
564  ]
565
566  sources += [
567    "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp",
568    "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp",
569    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_proxy.cpp",
570    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_service.cpp",
571    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_stub.cpp",
572    "${app_account_innerkits_native_path}/src/app_account_common.cpp",
573    "${app_account_innerkits_native_path}/src/app_account_info.cpp",
574    "${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp",
575    "${app_account_services_path}/src/appaccount/app_account_app_state_observer.cpp",
576    "${app_account_services_path}/src/appaccount/app_account_authenticator_callback.cpp",
577    "${app_account_services_path}/src/appaccount/app_account_authenticator_proxy.cpp",
578    "${app_account_services_path}/src/appaccount/app_account_authenticator_session.cpp",
579    "${app_account_services_path}/src/appaccount/app_account_authenticator_session_manager.cpp",
580    "${app_account_services_path}/src/appaccount/app_account_authorization_extension_proxy.cpp",
581    "${app_account_services_path}/src/appaccount/app_account_check_labels_callback.cpp",
582    "${app_account_services_path}/src/appaccount/app_account_check_labels_session.cpp",
583    "${app_account_services_path}/src/appaccount/app_account_common_event_observer.cpp",
584    "${app_account_services_path}/src/appaccount/app_account_common_event_subscriber.cpp",
585    "${app_account_services_path}/src/appaccount/app_account_data_storage.cpp",
586    "${app_account_services_path}/src/appaccount/app_account_event_proxy.cpp",
587    "${app_account_services_path}/src/appaccount/app_account_subscribe_death_recipient.cpp",
588    "${app_account_services_path}/src/appaccount/app_account_subscribe_manager.cpp",
589  ]
590
591  sources += [
592    "${app_account_services_path}/src/account_data_storage.cpp",
593    "${app_account_services_path}/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
594    "${app_account_services_path}/src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp",
595    "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp",
596    "${innerkits_native_path}/src/account_info_parcel.cpp",
597    "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp",
598  ]
599
600  use_exceptions = true
601
602  version_script = "${services_path}/accountmgr/libaccountmgr.map"
603
604  configs = [ ":app_account_service_config_unittest" ]
605
606  configs += [
607    "${app_account_services_path}/test/mock:mock_accountmgr_config",
608    "${app_account_services_path}/test/mock:accountmgr_config",
609    "${app_account_services_path}/test/mock:ability_manager_config",
610  ]
611
612  deps = [
613    "${app_account_innerkits_native_path}:app_account_innerkits",
614    "${app_account_services_path}/src/appaccount:app_account_service_core",
615    "${common_path}:libaccount_common",
616    "//third_party/googletest:gmock_main",
617    "//third_party/googletest:gtest_main",
618  ]
619
620  external_deps = [
621    "ability_base:base",
622    "ability_base:want",
623    "ability_runtime:ability_context_native",
624    "ability_runtime:ability_manager",
625    "ability_runtime:abilitykit_native",
626    "ability_runtime:app_context",
627    "ability_runtime:app_manager",
628    "ability_runtime:runtime",
629    "bundle_framework:appexecfwk_base",
630    "bundle_framework:appexecfwk_core",
631    "c_utils:utils",
632    "hilog:libhilog",
633    "ipc:ipc_single",
634    "kv_store:distributeddata_inner",
635    "napi:ace_napi",
636    "samgr:samgr_proxy",
637  ]
638
639  external_deps += [
640    "ability_runtime:wantagent_innerkits",
641    "access_token:libaccesstoken_sdk",
642    "access_token:libtokenid_sdk",
643    "access_token:libtokensetproc_shared",
644    "common_event_service:cesfwk_innerkits",
645    "hicollie:libhicollie",
646    "hisysevent:libhisysevent",
647    "hitrace:hitrace_meter",
648    "selinux_adapter:librestorecon",
649    "storage_service:storage_manager_sa_proxy",
650    "user_auth_framework:userauth_client",
651  ]
652  if (has_huks_part) {
653    external_deps += [ "huks:libhukssdk" ]
654  }
655
656  if (security_guard_enabled) {
657    external_deps += [
658      "security_guard:libsg_collect_sdk",
659      "time_service:time_client",
660    ]
661  }
662}
663
664ohos_moduletest("app_account_manager_service_module_test") {
665  branch_protector_ret = "pac_ret"
666
667  sanitize = {
668    cfi = true
669    cfi_cross_dso = true
670    debug = false
671    blocklist = "${os_account_path}/cfi_blocklist.txt"
672  }
673
674  module_out_path = module_output_path
675  cflags_cc = []
676  cflags = []
677  sources = [
678    "${app_account_services_path}/src/appaccount/app_account_common_event_observer.cpp",
679    "${app_account_services_path}/src/appaccount/app_account_common_event_subscriber.cpp",
680    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
681    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
682    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
683    "${common_path}/utils/src/account_permission_manager.cpp",
684    "app_account_manager_service_module_test.cpp",
685  ]
686
687  configs = [
688    ":app_account_service_config_mock",
689    ":app_account_service_config_unittest",
690  ]
691
692  deps = [
693    "${app_account_innerkits_native_path}:app_account_innerkits",
694    "${app_account_services_path}:accountmgr",
695    "${app_account_services_path}/src/appaccount:app_account_service_core",
696    "${common_path}:libaccount_common",
697    "${innerkits_native_path}:libaccountkits",
698    "//third_party/googletest:gmock_main",
699    "//third_party/googletest:gtest_main",
700  ]
701
702  external_deps = [
703    "ability_base:base",
704    "ability_base:want",
705    "ability_runtime:app_manager",
706    "access_token:libaccesstoken_sdk",
707    "access_token:libtokensetproc_shared",
708    "bundle_framework:appexecfwk_base",
709    "bundle_framework:appexecfwk_core",
710    "c_utils:utils",
711    "hilog:libhilog",
712    "ipc:ipc_single",
713    "kv_store:distributeddata_inner",
714    "safwk:system_ability_fwk",
715    "samgr:samgr_proxy",
716  ]
717
718  if (has_ces_part) {
719    cflags_cc += [ "-DHAS_CES_PART" ]
720    external_deps += [ "common_event_service:cesfwk_innerkits" ]
721  }
722
723  if (os_account_distributed_feature) {
724    cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ]
725  }
726}
727
728ohos_moduletest("app_account_manager_service_not_mock_module_test") {
729  branch_protector_ret = "pac_ret"
730
731  sanitize = {
732    cfi = true
733    cfi_cross_dso = true
734    debug = false
735  }
736
737  module_out_path = module_output_path
738  cflags_cc = []
739  cflags = []
740  sources = [
741    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
742    "app_account_manager_service_module_not_mock_test.cpp",
743  ]
744
745  configs = [
746    ":app_account_service_config_mock",
747    ":app_account_service_config_unittest",
748  ]
749
750  deps = [
751    "${app_account_innerkits_native_path}:app_account_innerkits",
752    "${app_account_services_path}:accountmgr",
753    "${app_account_services_path}/src/appaccount:app_account_service_core",
754    "${common_path}:libaccount_common",
755    "${innerkits_native_path}:libaccountkits",
756    "//third_party/googletest:gmock_main",
757    "//third_party/googletest:gtest_main",
758  ]
759
760  external_deps = [
761    "ability_base:base",
762    "ability_base:want",
763    "ability_runtime:app_manager",
764    "access_token:libaccesstoken_sdk",
765    "access_token:libtokensetproc_shared",
766    "bundle_framework:appexecfwk_base",
767    "bundle_framework:appexecfwk_core",
768    "c_utils:utils",
769    "hilog:libhilog",
770    "ipc:ipc_single",
771    "kv_store:distributeddata_inner",
772    "safwk:system_ability_fwk",
773    "samgr:samgr_proxy",
774  ]
775
776  if (has_ces_part) {
777    cflags_cc += [ "-DHAS_CES_PART" ]
778    external_deps += [ "common_event_service:cesfwk_innerkits" ]
779  }
780}
781
782ohos_moduletest("at_not_mock_app_account_manager_service_module_test") {
783  branch_protector_ret = "pac_ret"
784
785  sanitize = {
786    cfi = true
787    cfi_cross_dso = true
788    debug = false
789  }
790
791  module_out_path = module_output_path
792  sources = [
793    "${app_account_services_path}/src/account_data_storage.cpp",
794    "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp",
795    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
796    "${app_account_services_path}/src/appaccount/app_account_stub.cpp",
797    "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp",
798    "${app_account_services_path}/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
799    "${app_account_services_path}/src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp",
800    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
801    "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp",
802    "${innerkits_native_path}/src/account_info_parcel.cpp",
803    "at_not_mock_app_account_manager_service_module_test.cpp",
804  ]
805
806  sources += ability_base_sources
807  sources += app_account_sources_mock
808
809  use_exceptions = true
810
811  configs = [ ":app_account_service_config_unittest" ]
812  configs += [
813    "${app_account_services_path}/test/mock:mock_accountmgr_config",
814    "${app_account_services_path}/test/mock:accountmgr_config",
815    "${app_account_services_path}/test/mock:ability_manager_config",
816  ]
817
818  deps = [
819    "${app_account_innerkits_native_path}:app_account_innerkits",
820    "${app_account_services_path}/src/appaccount:app_account_service_core",
821    "${common_path}:libaccount_common",
822    "${innerkits_native_path}:libaccountkits",
823    "${os_account_innerkits_native_path}:os_account_innerkits",
824    "//third_party/googletest:gmock_main",
825    "//third_party/googletest:gtest_main",
826  ]
827
828  external_deps = [
829    "ability_base:base",
830    "ability_base:want",
831    "ability_runtime:ability_context_native",
832    "ability_runtime:ability_manager",
833    "ability_runtime:abilitykit_native",
834    "ability_runtime:app_manager",
835    "access_token:libaccesstoken_sdk",
836    "access_token:libtokensetproc_shared",
837    "bundle_framework:appexecfwk_base",
838    "bundle_framework:appexecfwk_core",
839    "c_utils:utils",
840    "hilog:libhilog",
841    "ipc:ipc_single",
842    "kv_store:distributeddata_inner",
843    "mbedtls:mbedtls_shared",
844    "napi:ace_napi",
845    "safwk:system_ability_fwk",
846    "samgr:samgr_proxy",
847  ]
848
849  external_deps += [
850    "ability_runtime:wantagent_innerkits",
851    "access_token:libtokenid_sdk",
852  ]
853  if (has_huks_part) {
854    external_deps += [ "huks:libhukssdk" ]
855  }
856
857  if (has_storage_service_part) {
858    external_deps += [ "storage_service:storage_manager_sa_proxy" ]
859  }
860
861  if (build_selinux) {
862    external_deps += [ "selinux_adapter:librestorecon" ]
863  }
864
865  if (has_ces_part) {
866    external_deps += [ "common_event_service:cesfwk_innerkits" ]
867  }
868
869  if (has_hiviewdfx_hisysevent_part) {
870    external_deps += [ "hisysevent:libhisysevent" ]
871  }
872
873  if (hicollie_enable == true) {
874    external_deps += [ "hicollie:libhicollie" ]
875  }
876
877  if (security_guard_enabled) {
878    external_deps += [
879      "security_guard:libsg_collect_sdk",
880      "time_service:time_client",
881    ]
882  }
883
884  if (has_hiviewdfx_hitrace_part) {
885    external_deps += [ "hitrace:hitrace_meter" ]
886  }
887  if (has_user_auth_part) {
888    external_deps += [ "user_auth_framework:userauth_client" ]
889  }
890
891  if (has_kv_store_part) {
892    external_deps += [ "kv_store:distributeddata_inner" ]
893  }
894}
895
896ohos_moduletest("app_account_manager_service_subscribe_module_test") {
897  branch_protector_ret = "pac_ret"
898
899  sanitize = {
900    cfi = true
901    cfi_cross_dso = true
902    debug = false
903  }
904
905  module_out_path = module_output_path
906  cflags_cc = []
907  sources = [
908    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
909    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
910    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
911    "app_account_manager_service_subscribe_module_test.cpp",
912  ]
913
914  configs = [
915    ":app_account_service_config_mock",
916    ":app_account_service_config_unittest",
917  ]
918
919  deps = [
920    "${app_account_innerkits_native_path}:app_account_innerkits",
921    "${app_account_services_path}:accountmgr",
922    "${app_account_services_path}/src/appaccount:app_account_service_core",
923    "${common_path}:libaccount_common",
924    "${innerkits_native_path}:libaccountkits",
925    "//third_party/googletest:gmock_main",
926    "//third_party/googletest:gtest_main",
927  ]
928
929  external_deps = [
930    "ability_base:base",
931    "ability_base:want",
932    "ability_runtime:app_manager",
933    "access_token:libaccesstoken_sdk",
934    "access_token:libtokensetproc_shared",
935    "bundle_framework:appexecfwk_base",
936    "bundle_framework:appexecfwk_core",
937    "c_utils:utils",
938    "hilog:libhilog",
939    "ipc:ipc_single",
940    "kv_store:distributeddata_inner",
941    "safwk:system_ability_fwk",
942    "samgr:samgr_proxy",
943  ]
944
945  if (has_ces_part) {
946    cflags_cc += [ "-DHAS_CES_PART" ]
947    external_deps += [ "common_event_service:cesfwk_innerkits" ]
948  }
949}
950
951ohos_moduletest("app_account_manager_service_sync_module_test") {
952  branch_protector_ret = "pac_ret"
953
954  sanitize = {
955    cfi = true
956    cfi_cross_dso = true
957    debug = false
958  }
959
960  module_out_path = module_output_path
961  cflags_cc = []
962  cflags = []
963  sources = [
964    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
965    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
966    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
967    "${common_path}/utils/src/account_permission_manager.cpp",
968    "app_account_manager_service_sync_module_test.cpp",
969  ]
970
971  configs = [
972    ":app_account_service_config_mock",
973    ":app_account_service_config_unittest",
974  ]
975
976  deps = [
977    "${app_account_innerkits_native_path}:app_account_innerkits",
978    "${app_account_services_path}:accountmgr",
979    "${app_account_services_path}/src/appaccount:app_account_service_core",
980    "${common_path}:libaccount_common",
981    "${innerkits_native_path}:libaccountkits",
982    "//third_party/googletest:gmock_main",
983    "//third_party/googletest:gtest_main",
984  ]
985
986  external_deps = [
987    "ability_base:base",
988    "ability_base:want",
989    "ability_runtime:app_manager",
990    "access_token:libaccesstoken_sdk",
991    "access_token:libtokensetproc_shared",
992    "bundle_framework:appexecfwk_base",
993    "bundle_framework:appexecfwk_core",
994    "c_utils:utils",
995    "hilog:libhilog",
996    "ipc:ipc_single",
997    "kv_store:distributeddata_inner",
998    "safwk:system_ability_fwk",
999    "samgr:samgr_proxy",
1000  ]
1001
1002  if (has_ces_part) {
1003    cflags_cc += [ "-DHAS_CES_PART" ]
1004    external_deps += [ "common_event_service:cesfwk_innerkits" ]
1005  }
1006  if (os_account_distributed_feature) {
1007    cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ]
1008  }
1009}
1010
1011ohos_moduletest("bundle_manager_adapter_module_test") {
1012  branch_protector_ret = "pac_ret"
1013
1014  sanitize = {
1015    cfi = true
1016    cfi_cross_dso = true
1017    debug = false
1018  }
1019
1020  module_out_path = module_output_path
1021  include_dirs =
1022      [ "${services_path}/accountmgr/include/bundle_manager_adapter" ]
1023  sources = [
1024    "${services_path}/accountmgr/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
1025    "bundle_manager_adapter_module_test.cpp",
1026  ]
1027
1028  configs = [ ":app_account_service_config_unittest" ]
1029
1030  deps = [
1031    "${app_account_services_path}:accountmgr",
1032    "${common_path}:libaccount_common",
1033    "${innerkits_native_path}:libaccountkits",
1034    "//third_party/googletest:gtest_main",
1035  ]
1036
1037  external_deps = [
1038    "ability_base:want",
1039    "ability_runtime:app_manager",
1040    "ability_runtime:wantagent_innerkits",
1041    "bundle_framework:appexecfwk_base",
1042    "bundle_framework:appexecfwk_core",
1043    "c_utils:utils",
1044    "hilog:libhilog",
1045    "ipc:ipc_single",
1046    "samgr:samgr_proxy",
1047  ]
1048}
1049
1050ohos_moduletest("app_account_authenticator_session_manager_module_test") {
1051  module_out_path = module_output_path
1052  include_dirs = [
1053    "${app_account_services_path}/test/mock/app_account",
1054    "${innerkits_native_path}/include",
1055  ]
1056
1057  sources = [
1058    "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp",
1059    "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp",
1060    "${app_account_services_path}/src/appaccount/app_account_stub.cpp",
1061    "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp",
1062    "${app_account_services_path}/test/mock/app_account/app_account_authenticator_manager.cpp",
1063    "${app_account_services_path}/test/mock/app_account/mock_app_account_authenticator_stub.cpp",
1064    "${app_account_services_path}/test/mock/common/ability_manager_adapter.cpp",
1065    "app_account_authenticator_session_manager_module_test.cpp",
1066  ]
1067
1068  sources += [
1069    "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp",
1070    "${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp",
1071    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_proxy.cpp",
1072    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_service.cpp",
1073    "${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_stub.cpp",
1074    "${app_account_innerkits_native_path}/src/app_account_common.cpp",
1075    "${app_account_innerkits_native_path}/src/app_account_info.cpp",
1076    "${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp",
1077    "${app_account_services_path}/src/appaccount/app_account_app_state_observer.cpp",
1078    "${app_account_services_path}/src/appaccount/app_account_authenticator_callback.cpp",
1079    "${app_account_services_path}/src/appaccount/app_account_authenticator_proxy.cpp",
1080    "${app_account_services_path}/src/appaccount/app_account_authenticator_session.cpp",
1081    "${app_account_services_path}/src/appaccount/app_account_authenticator_session_manager.cpp",
1082    "${app_account_services_path}/src/appaccount/app_account_authorization_extension_proxy.cpp",
1083    "${app_account_services_path}/src/appaccount/app_account_check_labels_callback.cpp",
1084    "${app_account_services_path}/src/appaccount/app_account_check_labels_session.cpp",
1085    "${app_account_services_path}/src/appaccount/app_account_common_event_observer.cpp",
1086    "${app_account_services_path}/src/appaccount/app_account_common_event_subscriber.cpp",
1087    "${app_account_services_path}/src/appaccount/app_account_data_storage.cpp",
1088    "${app_account_services_path}/src/appaccount/app_account_event_proxy.cpp",
1089    "${app_account_services_path}/src/appaccount/app_account_subscribe_death_recipient.cpp",
1090    "${app_account_services_path}/src/appaccount/app_account_subscribe_manager.cpp",
1091  ]
1092
1093  sources += [
1094    "${app_account_services_path}/src/account_data_storage.cpp",
1095    "${app_account_services_path}/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
1096    "${app_account_services_path}/src/bundle_manager_adapter/bundle_user_manager_adapter_proxy.cpp",
1097    "${bundle_framework_path}/common/log/src/app_log_wrapper.cpp",
1098    "${innerkits_native_path}/src/account_info_parcel.cpp",
1099    "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp",
1100  ]
1101
1102  use_exceptions = true
1103
1104  version_script = "${services_path}/accountmgr/libaccountmgr.map"
1105
1106  configs = [ ":app_account_service_config_unittest" ]
1107  configs += [
1108    "${app_account_services_path}/test/mock:mock_accountmgr_config",
1109    "${app_account_services_path}/test/mock:accountmgr_config",
1110    "${app_account_services_path}/test/mock:ability_manager_config",
1111  ]
1112
1113  deps = [
1114    "${app_account_innerkits_native_path}:app_account_innerkits",
1115    "${app_account_services_path}/src/appaccount:app_account_service_core",
1116    "${common_path}:libaccount_common",
1117    "//third_party/googletest:gmock_main",
1118    "//third_party/googletest:gtest_main",
1119  ]
1120
1121  external_deps = [
1122    "ability_base:want",
1123    "ability_runtime:ability_context_native",
1124    "ability_runtime:ability_manager",
1125    "ability_runtime:abilitykit_native",
1126    "ability_runtime:app_context",
1127    "ability_runtime:app_manager",
1128    "ability_runtime:runtime",
1129    "bundle_framework:appexecfwk_base",
1130    "bundle_framework:appexecfwk_core",
1131    "c_utils:utils",
1132    "hilog:libhilog",
1133    "ipc:ipc_single",
1134    "kv_store:distributeddata_inner",
1135    "napi:ace_napi",
1136    "samgr:samgr_proxy",
1137  ]
1138
1139  external_deps += [
1140    "ability_runtime:wantagent_innerkits",
1141    "access_token:libaccesstoken_sdk",
1142    "access_token:libtokenid_sdk",
1143    "access_token:libtokensetproc_shared",
1144    "common_event_service:cesfwk_innerkits",
1145    "hicollie:libhicollie",
1146    "hisysevent:libhisysevent",
1147    "hitrace:hitrace_meter",
1148    "selinux_adapter:librestorecon",
1149    "storage_service:storage_manager_sa_proxy",
1150    "user_auth_framework:userauth_client",
1151  ]
1152  if (has_huks_part) {
1153    external_deps += [ "huks:libhukssdk" ]
1154  }
1155
1156  if (security_guard_enabled) {
1157    external_deps += [
1158      "security_guard:libsg_collect_sdk",
1159      "time_service:time_client",
1160    ]
1161  }
1162}
1163
1164ohos_moduletest("app_account_manager_service_thread_module_test") {
1165  branch_protector_ret = "pac_ret"
1166
1167  sanitize = {
1168    cfi = true
1169    cfi_cross_dso = true
1170    debug = false
1171  }
1172
1173  module_out_path = module_output_path
1174  cflags_cc = []
1175  sources = [
1176    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
1177    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
1178    "app_account_manager_service_thread_module_test.cpp",
1179  ]
1180
1181  configs = [
1182    ":app_account_service_config_mock",
1183    ":app_account_service_config_unittest",
1184  ]
1185
1186  deps = [
1187    "${app_account_innerkits_native_path}:app_account_innerkits",
1188    "${app_account_services_path}:accountmgr",
1189    "${app_account_services_path}/src/appaccount:app_account_service_core",
1190    "${common_path}:libaccount_common",
1191    "${innerkits_native_path}:libaccountkits",
1192    "//third_party/googletest:gmock_main",
1193    "//third_party/googletest:gtest_main",
1194  ]
1195
1196  external_deps = [
1197    "ability_base:base",
1198    "ability_base:want",
1199    "ability_runtime:app_manager",
1200    "access_token:libaccesstoken_sdk",
1201    "access_token:libtokensetproc_shared",
1202    "bundle_framework:appexecfwk_base",
1203    "bundle_framework:appexecfwk_core",
1204    "c_utils:utils",
1205    "hilog:libhilog",
1206    "ipc:ipc_single",
1207    "kv_store:distributeddata_inner",
1208    "safwk:system_ability_fwk",
1209    "samgr:samgr_proxy",
1210  ]
1211
1212  if (has_ces_part) {
1213    cflags_cc += [ "-DHAS_CES_PART" ]
1214    external_deps += [ "common_event_service:cesfwk_innerkits" ]
1215  }
1216}
1217
1218ohos_moduletest("app_account_subscribe_manager_test") {
1219  branch_protector_ret = "pac_ret"
1220
1221  sanitize = {
1222    cfi = true
1223    cfi_cross_dso = true
1224    debug = false
1225  }
1226
1227  module_out_path = module_output_path
1228  cflags_cc = []
1229  include_dirs = [ "${app_account_services_path}/include/appaccount" ]
1230  sources = [
1231    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
1232    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
1233    "${services_path}/accountmgr/src/appaccount/app_account_subscribe_death_recipient.cpp",
1234    "${services_path}/accountmgr/src/appaccount/app_account_subscribe_manager.cpp",
1235    "app_account_subscribe_manager_test.cpp",
1236  ]
1237
1238  configs = [
1239    ":app_account_service_config_mock",
1240    ":app_account_service_config_unittest",
1241  ]
1242
1243  deps = [
1244    "${app_account_innerkits_native_path}:app_account_innerkits",
1245    "${app_account_services_path}:accountmgr",
1246    "${app_account_services_path}/src/appaccount:app_account_service_core",
1247    "${common_path}:libaccount_common",
1248    "${innerkits_native_path}:libaccountkits",
1249    "//third_party/googletest:gmock_main",
1250    "//third_party/googletest:gtest_main",
1251  ]
1252
1253  external_deps = [
1254    "ability_base:base",
1255    "ability_base:want",
1256    "ability_runtime:app_manager",
1257    "access_token:libaccesstoken_sdk",
1258    "access_token:libtokensetproc_shared",
1259    "bundle_framework:appexecfwk_base",
1260    "bundle_framework:appexecfwk_core",
1261    "c_utils:utils",
1262    "hilog:libhilog",
1263    "ipc:ipc_single",
1264    "kv_store:distributeddata_inner",
1265    "safwk:system_ability_fwk",
1266    "samgr:samgr_proxy",
1267  ]
1268
1269  if (has_ces_part) {
1270    cflags_cc += [ "-DHAS_CES_PART" ]
1271    external_deps += [ "common_event_service:cesfwk_innerkits" ]
1272  }
1273}
1274
1275group("moduletest") {
1276  testonly = true
1277
1278  deps = [
1279    ":app_account_authenticate_test",
1280    ":app_account_authenticator_callback_test",
1281    ":app_account_authenticator_session_manager_module_test",
1282    ":app_account_authenticator_session_module_test",
1283    ":app_account_authorization_extension_ability_test",
1284    ":app_account_check_labels_module_test",
1285    ":app_account_control_manager_module_test",
1286    ":app_account_event_module_test",
1287    ":app_account_manager_service_associated_data_test",
1288    ":app_account_manager_service_module_test",
1289    ":app_account_manager_service_not_mock_module_test",
1290    ":app_account_manager_service_subscribe_module_test",
1291    ":app_account_manager_service_sync_module_test",
1292    ":app_account_subscribe_manager_test",
1293    ":at_not_mock_app_account_manager_service_module_test",
1294  ]
1295}
1296