• 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("//foundation/ability/ability_runtime/ability_runtime.gni")
16
17module_output_path = "ability_tools/tools"
18
19config("tools_aa_config_mock") {
20  include_dirs = [
21    "${ability_runtime_path}/tools/test/mock",
22    "//third_party/googletest/googlemock/include",
23  ]
24}
25
26tools_aa_mock_sources =
27    [ "${ability_runtime_path}/tools/test/mock/mock_ability_manager_stub.cpp" ]
28
29ohos_unittest("aa_command_test") {
30  module_out_path = module_output_path
31
32  sources = [ "aa_command_test.cpp" ]
33  sources += tools_aa_mock_sources
34
35  configs = [ ":tools_aa_config_mock" ]
36
37  cflags = []
38  if (target_cpu == "arm") {
39    cflags += [ "-DBINDER_IPC_32BIT" ]
40  }
41
42  deps = [
43    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
44    "//third_party/googletest:gmock_main",
45    "//third_party/googletest:gtest_main",
46  ]
47
48  external_deps = [
49    "ability_base:configuration",
50    "bundle_framework:appexecfwk_base",
51    "hilog:libhilog",
52    "ipc:ipc_core",
53  ]
54}
55
56ohos_unittest("aa_command_start_test") {
57  module_out_path = module_output_path
58
59  sources = [ "aa_command_start_test.cpp" ]
60  sources += tools_aa_mock_sources
61
62  configs = [ ":tools_aa_config_mock" ]
63
64  cflags = []
65  if (target_cpu == "arm") {
66    cflags += [ "-DBINDER_IPC_32BIT" ]
67  }
68
69  deps = [
70    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
71    "//third_party/googletest:gmock_main",
72    "//third_party/googletest:gtest_main",
73  ]
74
75  external_deps = [
76    "ability_base:configuration",
77    "bundle_framework:appexecfwk_base",
78    "hilog:libhilog",
79    "ipc:ipc_core",
80  ]
81}
82
83ohos_unittest("aa_command_stop_service_test") {
84  module_out_path = module_output_path
85
86  sources = [ "aa_command_stop_service_test.cpp" ]
87  sources += tools_aa_mock_sources
88
89  configs = [ ":tools_aa_config_mock" ]
90
91  cflags = []
92  if (target_cpu == "arm") {
93    cflags += [ "-DBINDER_IPC_32BIT" ]
94  }
95
96  deps = [
97    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
98    "//third_party/googletest:gmock_main",
99    "//third_party/googletest:gtest_main",
100  ]
101
102  external_deps = [
103    "ability_base:configuration",
104    "bundle_framework:appexecfwk_base",
105    "hilog:libhilog",
106    "ipc:ipc_core",
107  ]
108}
109
110ohos_unittest("aa_command_dump_test") {
111  module_out_path = module_output_path
112
113  sources = [ "aa_command_dump_test.cpp" ]
114  sources += tools_aa_mock_sources
115
116  configs = [ ":tools_aa_config_mock" ]
117
118  cflags = []
119  if (target_cpu == "arm") {
120    cflags += [ "-DBINDER_IPC_32BIT" ]
121  }
122
123  deps = [
124    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
125    "//third_party/googletest:gmock_main",
126    "//third_party/googletest:gtest_main",
127  ]
128
129  external_deps = [
130    "ability_base:configuration",
131    "bundle_framework:appexecfwk_base",
132    "hilog:libhilog",
133    "ipc:ipc_core",
134  ]
135}
136
137ohos_unittest("aa_command_dumpsys_test") {
138  module_out_path = module_output_path
139
140  sources = [ "aa_command_dumpsys_test.cpp" ]
141  sources += tools_aa_mock_sources
142
143  configs = [ ":tools_aa_config_mock" ]
144
145  cflags = []
146  if (target_cpu == "arm") {
147    cflags += [ "-DBINDER_IPC_32BIT" ]
148  }
149
150  deps = [
151    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
152    "//third_party/googletest:gmock_main",
153    "//third_party/googletest:gtest_main",
154  ]
155
156  external_deps = [
157    "ability_base:configuration",
158    "bundle_framework:appexecfwk_base",
159    "hilog:libhilog",
160    "ipc:ipc_core",
161  ]
162}
163
164ohos_unittest("aa_command_screen_test") {
165  module_out_path = module_output_path
166
167  sources = [ "aa_command_screen_test.cpp" ]
168  sources += tools_aa_mock_sources
169
170  configs = [ ":tools_aa_config_mock" ]
171
172  cflags = []
173  if (target_cpu == "arm") {
174    cflags += [ "-DBINDER_IPC_32BIT" ]
175  }
176
177  deps = [
178    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
179    "//third_party/googletest:gmock_main",
180    "//third_party/googletest:gtest_main",
181  ]
182
183  external_deps = [
184    "ability_base:configuration",
185    "bundle_framework:appexecfwk_base",
186    "hilog:libhilog",
187    "ipc:ipc_core",
188  ]
189}
190
191ohos_unittest("aa_command_force_stop_test") {
192  module_out_path = module_output_path
193
194  sources = [ "aa_command_force_stop_test.cpp" ]
195  sources += tools_aa_mock_sources
196
197  configs = [ ":tools_aa_config_mock" ]
198
199  cflags = []
200  if (target_cpu == "arm") {
201    cflags += [ "-DBINDER_IPC_32BIT" ]
202  }
203
204  deps = [
205    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
206    "//third_party/googletest:gmock_main",
207    "//third_party/googletest:gtest_main",
208  ]
209
210  external_deps = [
211    "ability_base:configuration",
212    "bundle_framework:appexecfwk_base",
213    "hilog:libhilog",
214    "ipc:ipc_core",
215  ]
216}
217
218ohos_unittest("aa_command_force_timeout_test") {
219  module_out_path = module_output_path
220
221  sources = [ "aa_command_force_timeout_test.cpp" ]
222  sources += tools_aa_mock_sources
223
224  configs = [ ":tools_aa_config_mock" ]
225
226  cflags = []
227  if (target_cpu == "arm") {
228    cflags += [ "-DBINDER_IPC_32BIT" ]
229  }
230
231  deps = [
232    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
233    "//third_party/googletest:gmock_main",
234    "//third_party/googletest:gtest_main",
235  ]
236
237  external_deps = [
238    "ability_base:configuration",
239    "bundle_framework:appexecfwk_base",
240    "hilog:libhilog",
241    "ipc:ipc_core",
242  ]
243}
244
245ohos_unittest("aa_command_test_test") {
246  module_out_path = module_output_path
247
248  sources = [ "aa_command_test_test.cpp" ]
249  sources += tools_aa_mock_sources
250
251  configs = [ ":tools_aa_config_mock" ]
252
253  cflags = []
254  if (target_cpu == "arm") {
255    cflags += [ "-DBINDER_IPC_32BIT" ]
256  }
257
258  deps = [
259    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
260    "//third_party/googletest:gmock_main",
261    "//third_party/googletest:gtest_main",
262  ]
263
264  external_deps = [
265    "ability_base:configuration",
266    "bundle_framework:appexecfwk_base",
267    "hilog:libhilog",
268    "ipc:ipc_core",
269  ]
270}
271
272print("accessibility_enable = ", accessibility_enable)
273if (accessibility_enable) {
274  ohos_unittest("accessibility_ability_utils_test") {
275    module_out_path = module_output_path
276
277    include_dirs = [ "//third_party/jsoncpp/include" ]
278
279    sources = [
280      "${ability_runtime_path}/tools/aa/src/accessibility_ability_utils.cpp",
281      "accessibility_ability_utils_test.cpp",
282    ]
283
284    cflags = []
285    if (target_cpu == "arm") {
286      cflags += [ "-DBINDER_IPC_32BIT" ]
287    }
288
289    deps = [
290      "${ability_runtime_path}/tools/aa:tools_aa_source_set",
291      "//third_party/googletest:gmock_main",
292    ]
293
294    external_deps = [
295      "access_token:libaccesstoken_sdk",
296      "access_token:libnativetoken",
297      "access_token:libtoken_setproc",
298      "accessibility:accessibility_common",
299      "accessibility:accessibilityclient",
300      "accessibility:accessibilityconfig",
301      "hilog:libhilog",
302    ]
303  }
304}
305group("unittest") {
306  testonly = true
307
308  deps = [
309    ":aa_command_dump_test",
310    ":aa_command_dumpsys_test",
311    ":aa_command_force_stop_test",
312    ":aa_command_screen_test",
313    ":aa_command_start_test",
314    ":aa_command_stop_service_test",
315    ":aa_command_test",
316    ":aa_command_test_test",
317  ]
318  if (accessibility_enable) {
319    deps += [ ":accessibility_ability_utils_test" ]
320  }
321  if (ability_command_for_test) {
322    deps += [ ":aa_command_force_timeout_test" ]
323  }
324}
325