• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("../../../../services/accountmgr/os_account_service.gni")
16
17module_output_path = "os_account/tools"
18
19ohos_moduletest("account_command_module_mock_test") {
20  branch_protector_ret = "pac_ret"
21
22  sanitize = {
23    cfi = true
24    cfi_cross_dso = true
25    debug = false
26  }
27
28  module_out_path = module_output_path
29
30  include_dirs = [
31    "${ability_runtime_path}/tools/test/systemtest/aa",
32    "${app_account_innerkits_native_path}/include",
33    "${os_account_dfx_path}/hidumper_adapter",
34    "${services_path}/accountmgr/include/bundle_manager_adapter",
35    "${services_path}/accountmgr/include/ability_manager_adapter",
36    "${services_path}/accountmgr/include",
37    "${os_account_dfx_path}/hitrace_adapter",
38    "${services_path}/accountmgr/include/account_iam",
39    "${services_path}/accountmgr/include/appaccount",
40    "${services_path}/accountmgr/include/domain_account",
41    "${services_path}/accountmgr/include/osaccount",
42    "${bundle_framework_path}/interfaces/inner_api/appexecfwk_core/include",
43    "${os_account_path}/interfaces/innerkits/ohosaccount/native/include/",
44  ]
45
46  sources = [
47    "${ability_runtime_path}/tools/test/systemtest/aa/tool_system_test.cpp",
48    "${app_account_services_path}/test/mock/common/ability_manager_adapter_mock.cpp",
49    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
50    "${common_path}/log/src/account_log_wrapper.cpp",
51    "${innerkits_native_path}/src/account_info_parcel.cpp",
52    "${innerkits_native_path}/src/account_proxy.cpp",
53    "${innerkits_native_path}/src/ohos_account_kits.cpp",
54    "${innerkits_native_path}/src/ohos_account_kits_impl.cpp",
55    "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp",
56    "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp",
57    "${services_path}/accountmgr/src/account_iam/account_iam_callback.cpp",
58    "${services_path}/accountmgr/src/account_iam/account_iam_mgr_stub.cpp",
59    "${services_path}/accountmgr/src/account_iam/account_iam_service.cpp",
60    "${services_path}/accountmgr/src/account_iam/inner_account_iam_manager.cpp",
61    "${services_path}/accountmgr/src/appaccount/app_account_control_manager.cpp",
62    "${tools_path}/acm/src/account_command.cpp",
63    "account_command_create_module_test.cpp",
64    "account_command_delete_module_test.cpp",
65    "account_command_util.cpp",
66  ]
67  sources += account_service_sources
68  configs = [
69    "${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager_public_config",
70    "${tools_path}/acm:tools_acm_config",
71  ]
72
73  cflags = []
74  if (target_cpu == "arm") {
75    cflags += [ "-DBINDER_IPC_32BIT" ]
76  }
77
78  deps = [
79    "${account_iam_framework_path}:account_iam_innerkits",
80    "${account_test_common}:account_test_common_source_set",
81    "${common_path}:libaccount_common",
82    "${domain_account_framework_path}:domain_account_innerkits",
83    "${innerkits_native_path}:libaccountkits",
84    "${os_account_innerkits_native_path}:os_account_innerkits",
85    "//third_party/googletest:gmock_main",
86    "//third_party/googletest:gtest_main",
87  ]
88
89  use_exceptions = true
90
91  external_deps = [
92    "ability_base:want",
93    "ability_runtime:ability_manager",
94    "ability_runtime:app_manager",
95    "ability_runtime:tools_aa_source_set",
96    "ability_runtime:wantagent_innerkits",
97    "access_token:libaccesstoken_sdk",
98    "access_token:libtokenid_sdk",
99    "access_token:libtokensetproc_shared",
100    "bundle_framework:appexecfwk_base",
101    "bundle_framework:appexecfwk_core",
102    "c_utils:utils",
103    "config_policy:configpolicy_util",
104    "hilog:libhilog",
105    "ipc:ipc_single",
106    "mbedtls:mbedtls_shared",
107    "safwk:system_ability_fwk",
108    "samgr:samgr_proxy",
109  ]
110  if (has_huks_part) {
111    external_deps += [ "huks:libhukssdk" ]
112  }
113  cflags_cc = []
114  if (has_user_auth_part) {
115    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
116    external_deps += [ "user_auth_framework:userauth_client" ]
117  }
118  if (has_ces_part) {
119    cflags_cc += [ "-DHAS_CES_PART" ]
120    external_deps += [ "common_event_service:cesfwk_innerkits" ]
121  }
122  if (has_kv_store_part) {
123    external_deps += [ "kv_store:distributeddata_inner" ]
124  }
125  cflags_cc += [ "-DACCOUNT_TEST" ]
126  cflags_cc += [ "-DBUNDLE_ADAPTER_MOCK" ]
127}
128
129ohos_moduletest("account_command_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  include_dirs = [ "${ability_runtime_path}/tools/test/systemtest/aa" ]
141
142  sources = [
143    "${ability_runtime_path}/tools/test/systemtest/aa/tool_system_test.cpp",
144    "${tools_path}/acm/src/account_command.cpp",
145    "account_command_create_module_test.cpp",
146    "account_command_delete_module_test.cpp",
147    "account_command_dump_module_test.cpp",
148    "account_command_set_module_test.cpp",
149    "account_command_switch_module_test.cpp",
150    "account_command_util.cpp",
151  ]
152
153  configs = [
154    "${ability_runtime_path}/interfaces/inner_api/ability_manager:ability_manager_public_config",
155    "${tools_path}/acm:tools_acm_config",
156  ]
157
158  cflags = []
159  if (target_cpu == "arm") {
160    cflags += [ "-DBINDER_IPC_32BIT" ]
161  }
162
163  deps = [
164    "${account_test_common}:account_test_common_source_set",
165    "${common_path}:libaccount_common",
166    "${os_account_innerkits_native_path}:os_account_innerkits",
167    "//third_party/googletest:gtest_main",
168  ]
169
170  external_deps = [
171    "ability_base:base",
172    "ability_runtime:tools_aa_source_set",
173    "c_utils:utils",
174    "hilog:libhilog",
175    "ipc:ipc_single",
176    "os_account:os_account_innerkits",
177  ]
178  cflags_cc = [ "-DACCOUNT_TEST" ]
179}
180
181group("moduletest") {
182  testonly = true
183  deps = []
184  if (os_account_enable_multiple_os_accounts || use_clang_coverage) {
185    deps += [
186      ":account_command_module_mock_test",
187      ":account_command_module_test",
188    ]
189  }
190}
191