• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2024 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")
16module_output_path = "ability_runtime/ability_runtime/ability_delegator"
17
18ability_delegator_mock_sources = [
19  "${ability_runtime_path}/tools/aa/src/shell_command_config_loader.cpp",
20  "${ability_runtime_path}/tools/aa/src/shell_command_executor.cpp",
21  "${ability_runtime_path}/tools/aa/src/test_observer.cpp",
22  "${ability_runtime_path}/tools/aa/src/test_observer_stub.cpp",
23  "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/ability_delegator/mock_ability_delegator_stub.cpp",
24  "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/ability_delegator/mock_iability_monitor.cpp",
25  "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/ability_delegator/mock_test_observer_stub.cpp",
26]
27
28###############################################################################
29config("moduletest_include_dir") {
30  visibility = [ ":*" ]
31  include_dirs = [
32    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_delegator/",
33    "${ability_runtime_path}/tools/aa/include",
34    "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/ability_delegator",
35    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_delegator/runner_runtime/",
36    "${ability_runtime_innerkits_path}/ability_manager/include",
37    "${ability_runtime_services_path}/abilitymgr/include/utils",
38    "${ability_runtime_services_path}/abilitymgr/include",
39    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context/",
40    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app/",
41  ]
42  cflags = []
43  if (target_cpu == "arm") {
44    cflags += [ "-DBINDER_IPC_32BIT" ]
45  }
46}
47
48ohos_moduletest("shell_cmd_result_moduletest") {
49  module_out_path = module_output_path
50  sources = [ "shell_cmd_result_module_test.cpp" ]
51
52  configs = [ ":moduletest_include_dir" ]
53  configs += [ "${ability_runtime_services_path}/common:common_config" ]
54
55  deps = [ "${ability_runtime_native_path}/appkit:appkit_delegator" ]
56
57  external_deps = [
58    "c_utils:utils",
59    "googletest:gmock",
60    "googletest:gmock_main",
61    "googletest:gtest_main",
62    "hilog:libhilog",
63  ]
64}
65
66ohos_moduletest("ability_delegator_args_moduletest") {
67  module_out_path = module_output_path
68  sources = [ "ability_delegator_args_module_test.cpp" ]
69
70  configs = [ ":moduletest_include_dir" ]
71  configs += [ "${ability_runtime_services_path}/common:common_config" ]
72
73  deps = [ "${ability_runtime_native_path}/appkit:appkit_delegator" ]
74
75  external_deps = [
76    "ability_base:want",
77    "c_utils:utils",
78    "googletest:gmock",
79    "googletest:gmock_main",
80    "googletest:gtest_main",
81    "hilog:libhilog",
82    "ipc:ipc_core",
83  ]
84}
85
86ohos_moduletest("delegator_thread_moduletest") {
87  module_out_path = module_output_path
88
89  sources = [ "delegator_thread_module_test.cpp" ]
90
91  configs = [ ":moduletest_include_dir" ]
92  configs += [ "${ability_runtime_services_path}/common:common_config" ]
93
94  deps = [ "${ability_runtime_native_path}/appkit:appkit_delegator" ]
95
96  external_deps = [
97    "eventhandler:libeventhandler",
98    "googletest:gmock",
99    "googletest:gmock_main",
100    "googletest:gtest_main",
101    "hilog:libhilog",
102    "ipc:ipc_core",
103  ]
104}
105
106ohos_moduletest("ability_delegator_registry_moduletest") {
107  module_out_path = module_output_path
108
109  sources = [ "ability_delegator_registry_module_test.cpp" ]
110  sources += ability_delegator_mock_sources
111
112  configs = [ ":moduletest_include_dir" ]
113  configs += [ "${ability_runtime_services_path}/common:common_config" ]
114
115  deps = [
116    "${ability_runtime_innerkits_path}/app_manager:app_manager",
117    "${ability_runtime_native_path}/ability/native:abilitykit_native",
118    "${ability_runtime_native_path}/appkit:app_context",
119    "${ability_runtime_native_path}/appkit:appkit_delegator",
120    "${ability_runtime_native_path}/appkit:appkit_native",
121    "${ability_runtime_services_path}/abilitymgr:abilityms",
122  ]
123
124  external_deps = [
125    "ability_base:want",
126    "ability_runtime:ability_manager",
127    "ability_runtime:runtime",
128    "c_utils:utils",
129    "common_event_service:cesfwk_innerkits",
130    "eventhandler:libeventhandler",
131    "googletest:gmock",
132    "googletest:gmock_main",
133    "googletest:gtest_main",
134    "hilog:libhilog",
135    "init:libbegetutil",
136    "ipc:ipc_core",
137    "napi:ace_napi",
138  ]
139}
140
141ohos_moduletest("iability_monitor_moduletest") {
142  module_out_path = module_output_path
143
144  sources = [ "iability_monitor_module_test.cpp" ]
145  sources += ability_delegator_mock_sources
146
147  configs = [ ":moduletest_include_dir" ]
148  configs += [ "${ability_runtime_services_path}/common:common_config" ]
149
150  deps = [
151    "${ability_runtime_native_path}/ability/native:abilitykit_native",
152    "${ability_runtime_native_path}/appkit:appkit_delegator",
153    "${ability_runtime_services_path}/abilitymgr:abilityms",
154  ]
155
156  external_deps = [
157    "ability_base:session_info",
158    "ability_base:want",
159    "ability_runtime:ability_manager",
160    "c_utils:utils",
161    "eventhandler:libeventhandler",
162    "googletest:gmock",
163    "googletest:gmock_main",
164    "googletest:gtest_main",
165    "hilog:libhilog",
166    "ipc:ipc_core",
167    "napi:ace_napi",
168  ]
169}
170
171ohos_moduletest("ability_delegator_moduletest") {
172  module_out_path = module_output_path
173
174  sources = [ "ability_delegator_module_test.cpp" ]
175  sources += ability_delegator_mock_sources
176
177  configs = [ ":moduletest_include_dir" ]
178  configs += [ "${ability_runtime_services_path}/common:common_config" ]
179
180  deps = [
181    "${ability_runtime_innerkits_path}/app_manager:app_manager",
182    "${ability_runtime_innerkits_path}/runtime:runtime",
183    "${ability_runtime_native_path}/appkit:app_context",
184    "${ability_runtime_native_path}/appkit:appkit_delegator",
185    "${ability_runtime_native_path}/appkit:appkit_native",
186    "${ability_runtime_services_path}/abilitymgr:abilityms",
187  ]
188
189  external_deps = [
190    "ability_base:want",
191    "ability_runtime:ability_manager",
192    "c_utils:utils",
193    "common_event_service:cesfwk_innerkits",
194    "eventhandler:libeventhandler",
195    "googletest:gmock",
196    "googletest:gmock_main",
197    "googletest:gtest_main",
198    "hilog:libhilog",
199    "init:libbegetutil",
200    "ipc:ipc_core",
201  ]
202
203  if (ability_runtime_graphics) {
204    external_deps += [
205      "window_manager:libwsutils",
206      "window_manager:scene_session",
207    ]
208  }
209}
210
211ohos_moduletest("js_test_runner_moduletest") {
212  module_out_path = module_output_path
213
214  sources = [ "js_test_runner_module_test.cpp" ]
215  sources += ability_delegator_mock_sources
216
217  configs = [ ":moduletest_include_dir" ]
218  configs += [ "${ability_runtime_services_path}/common:common_config" ]
219
220  deps = [
221    "${ability_runtime_innerkits_path}/app_manager:app_manager",
222    "${ability_runtime_native_path}/ability/native:abilitykit_native",
223    "${ability_runtime_native_path}/appkit:app_context",
224    "${ability_runtime_native_path}/appkit:appkit_delegator",
225    "${ability_runtime_native_path}/appkit:appkit_native",
226    "${ability_runtime_services_path}/abilitymgr:abilityms",
227  ]
228
229  external_deps = [
230    "ability_base:configuration",
231    "ability_base:extractortool",
232    "ability_base:want",
233    "ability_runtime:ability_manager",
234    "ability_runtime:runtime",
235    "bundle_framework:appexecfwk_base",
236    "c_utils:utils",
237    "common_event_service:cesfwk_innerkits",
238    "ets_runtime:libark_jsruntime",
239    "eventhandler:libeventhandler",
240    "googletest:gmock",
241    "googletest:gmock_main",
242    "googletest:gtest_main",
243    "hilog:libhilog",
244    "init:libbegetutil",
245    "ipc:ipc_core",
246    "napi:ace_napi",
247  ]
248}
249
250###############################################################################
251
252group("moduletest") {
253  testonly = true
254  deps = []
255
256  deps += [
257    ":ability_delegator_args_moduletest",
258    ":ability_delegator_moduletest",
259    ":ability_delegator_registry_moduletest",
260    ":delegator_thread_moduletest",
261    ":iability_monitor_moduletest",
262    ":js_test_runner_moduletest",
263    ":shell_cmd_result_moduletest",
264  ]
265}
266###############################################################################
267