• 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("//base/account/os_account/os_account.gni")
15import("//build/test.gni")
16
17module_output_path = "os_account/services/app_account"
18
19config("app_account_service_config_mock") {
20  include_dirs = [
21    "//third_party/googletest/googlemock/include",
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    "//base/security/access_token/interfaces/innerkits/accesstoken/include",
26  ]
27}
28
29config("app_account_service_config_unittest") {
30  visibility = [ ":*" ]
31
32  include_dirs = []
33
34  cflags = []
35  if (target_cpu == "arm") {
36    cflags += [ "-DBINDER_IPC_32BIT" ]
37  }
38
39  defines = [
40    "ACCOUNT_LOG_TAG = \"AppAccountUTest\"",
41    "LOG_DOMAIN = 0xD001B00",
42  ]
43}
44
45ohos_unittest("account_permission_manager_test") {
46  module_out_path = module_output_path
47
48  sources = [
49    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
50    "account_permission_manager_test.cpp",
51  ]
52
53  configs = [
54    ":app_account_service_config_mock",
55    ":app_account_service_config_unittest",
56  ]
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    "eventhandler:libeventhandler",
75    "hiviewdfx_hilog_native:libhilog",
76    "ipc:ipc_core",
77    "kv_store:distributeddata_inner",
78  ]
79}
80
81ohos_unittest("app_account_data_storage_test") {
82  module_out_path = module_output_path
83
84  sources = [
85    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
86    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
87    "app_account_data_storage_test.cpp",
88  ]
89
90  configs = [
91    ":app_account_service_config_mock",
92    ":app_account_service_config_unittest",
93  ]
94
95  deps = [
96    "${app_account_innerkits_native_path}:app_account_innerkits",
97    "${app_account_services_path}:accountmgr",
98    "${app_account_services_path}/src/appaccount:app_account_service_core",
99    "${common_path}:libaccount_common",
100    "//third_party/googletest:gmock_main",
101    "//third_party/googletest:gtest_main",
102  ]
103
104  external_deps = [
105    "ability_base:base",
106    "ability_base:want",
107    "ability_runtime:app_manager",
108    "bundle_framework:appexecfwk_base",
109    "bundle_framework:appexecfwk_core",
110    "eventhandler:libeventhandler",
111    "hiviewdfx_hilog_native:libhilog",
112    "ipc:ipc_core",
113    "kv_store:distributeddata_inner",
114  ]
115}
116
117ohos_unittest("app_account_info_test") {
118  module_out_path = module_output_path
119
120  sources = [ "app_account_info_test.cpp" ]
121
122  configs = [ ":app_account_service_config_unittest" ]
123
124  deps = [
125    "${app_account_innerkits_native_path}:app_account_innerkits",
126    "${app_account_services_path}:accountmgr",
127    "${app_account_services_path}/src/appaccount:app_account_service_core",
128    "${common_path}:libaccount_common",
129    "//third_party/googletest:gmock_main",
130    "//third_party/googletest:gtest_main",
131  ]
132
133  external_deps = [
134    "ability_base:base",
135    "ability_base:want",
136    "ability_runtime:app_manager",
137    "bundle_framework:appexecfwk_base",
138    "bundle_framework:appexecfwk_core",
139    "eventhandler:libeventhandler",
140    "hiviewdfx_hilog_native:libhilog",
141    "ipc:ipc_core",
142    "kv_store:distributeddata_inner",
143  ]
144}
145
146ohos_unittest("app_account_manager_service_test") {
147  module_out_path = module_output_path
148  cflags_cc = []
149  sources = [
150    "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp",
151    "${app_account_services_path}/test/mock/app_account/mock_inner_app_account_manager.cpp",
152    "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp",
153    "app_account_manager_service_test.cpp",
154  ]
155
156  configs = [
157    ":app_account_service_config_mock",
158    ":app_account_service_config_unittest",
159  ]
160
161  deps = [
162    "${app_account_innerkits_native_path}:app_account_innerkits",
163    "${app_account_services_path}:accountmgr",
164    "${app_account_services_path}/src/appaccount:app_account_service_core",
165    "${common_path}:libaccount_common",
166    "//third_party/googletest:gmock_main",
167    "//third_party/googletest:gtest_main",
168  ]
169
170  external_deps = [
171    "ability_base:base",
172    "ability_base:want",
173    "ability_runtime:app_manager",
174    "bundle_framework:appexecfwk_base",
175    "bundle_framework:appexecfwk_core",
176    "c_utils:utils",
177    "eventhandler:libeventhandler",
178    "hiviewdfx_hilog_native:libhilog",
179    "ipc:ipc_core",
180    "kv_store:distributeddata_inner",
181  ]
182
183  if (has_ces_part) {
184    cflags_cc += [ "-DHAS_CES_PART" ]
185    external_deps += [ "common_event_service:cesfwk_innerkits" ]
186  }
187}
188
189ohos_unittest("app_account_subscribe_info_test") {
190  module_out_path = module_output_path
191
192  sources = [ "app_account_subscribe_info_test.cpp" ]
193
194  configs = [ ":app_account_service_config_unittest" ]
195
196  deps = [
197    "${app_account_innerkits_native_path}:app_account_innerkits",
198    "${app_account_services_path}:accountmgr",
199    "${app_account_services_path}/src/appaccount:app_account_service_core",
200    "${common_path}:libaccount_common",
201    "//third_party/googletest:gmock_main",
202    "//third_party/googletest:gtest_main",
203  ]
204
205  external_deps = [
206    "ability_base:base",
207    "ability_base:want",
208    "ability_runtime:app_manager",
209    "bundle_framework:appexecfwk_base",
210    "bundle_framework:appexecfwk_core",
211    "eventhandler:libeventhandler",
212    "hiviewdfx_hilog_native:libhilog",
213    "ipc:ipc_core",
214    "kv_store:distributeddata_inner",
215  ]
216}
217
218ohos_unittest("app_account_test") {
219  module_out_path = module_output_path
220
221  sources = [
222    "${app_account_services_path}/test/mock/app_account/mock_app_account_stub.cpp",
223    "app_account_test.cpp",
224  ]
225
226  configs = [
227    ":app_account_service_config_mock",
228    ":app_account_service_config_unittest",
229  ]
230
231  deps = [
232    "${app_account_innerkits_native_path}:app_account_innerkits",
233    "${app_account_services_path}:accountmgr",
234    "${app_account_services_path}/src/appaccount:app_account_service_core",
235    "${common_path}:libaccount_common",
236    "//third_party/googletest:gmock_main",
237    "//third_party/googletest:gtest_main",
238  ]
239
240  external_deps = [
241    "ability_base:base",
242    "ability_base:want",
243    "ability_runtime:app_manager",
244    "bundle_framework:appexecfwk_base",
245    "bundle_framework:appexecfwk_core",
246    "eventhandler:libeventhandler",
247    "hiviewdfx_hilog_native:libhilog",
248    "ipc:ipc_core",
249    "kv_store:distributeddata_inner",
250  ]
251}
252
253ohos_unittest("inner_app_account_manager_test") {
254  module_out_path = module_output_path
255
256  sources = [
257    "${app_account_services_path}/test/mock/app_account/mock_app_account_control_manager.cpp",
258    "${app_account_services_path}/test/mock/app_account/mock_app_account_subscribe_manager.cpp",
259    "inner_app_account_manager_test.cpp",
260  ]
261
262  configs = [
263    ":app_account_service_config_mock",
264    ":app_account_service_config_unittest",
265  ]
266
267  deps = [
268    "${app_account_innerkits_native_path}:app_account_innerkits",
269    "${app_account_services_path}:accountmgr",
270    "${app_account_services_path}/src/appaccount:app_account_service_core",
271    "${common_path}:libaccount_common",
272    "//third_party/googletest:gmock_main",
273    "//third_party/googletest:gtest_main",
274  ]
275
276  external_deps = [
277    "ability_base:base",
278    "ability_base:want",
279    "ability_runtime:app_manager",
280    "bundle_framework:appexecfwk_base",
281    "bundle_framework:appexecfwk_core",
282    "eventhandler:libeventhandler",
283    "hiviewdfx_hilog_native:libhilog",
284    "ipc:ipc_core",
285    "kv_store:distributeddata_inner",
286  ]
287}
288
289group("unittest") {
290  testonly = true
291
292  deps = [
293    ":account_permission_manager_test",
294    ":app_account_data_storage_test",
295    ":app_account_info_test",
296    ":app_account_manager_service_test",
297    ":app_account_subscribe_info_test",
298    ":app_account_test",
299    ":inner_app_account_manager_test",
300  ]
301}
302