• 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    "runtime_core:ani",
138    "napi:ace_napi",
139  ]
140}
141
142ohos_moduletest("iability_monitor_moduletest") {
143  module_out_path = module_output_path
144
145  sources = [ "iability_monitor_module_test.cpp" ]
146  sources += ability_delegator_mock_sources
147
148  configs = [ ":moduletest_include_dir" ]
149  configs += [ "${ability_runtime_services_path}/common:common_config" ]
150
151  deps = [
152    "${ability_runtime_native_path}/ability/native:abilitykit_native",
153    "${ability_runtime_native_path}/appkit:appkit_delegator",
154    "${ability_runtime_services_path}/abilitymgr:abilityms",
155  ]
156
157  external_deps = [
158    "ability_base:session_info",
159    "ability_base:want",
160    "ability_runtime:ability_manager",
161    "c_utils:utils",
162    "eventhandler:libeventhandler",
163    "googletest:gmock",
164    "googletest:gmock_main",
165    "googletest:gtest_main",
166    "hilog:libhilog",
167    "ipc:ipc_core",
168    "runtime_core:ani",
169    "napi:ace_napi",
170  ]
171}
172
173ohos_moduletest("ability_delegator_moduletest") {
174  module_out_path = module_output_path
175
176  sources = [ "ability_delegator_module_test.cpp" ]
177  sources += ability_delegator_mock_sources
178
179  configs = [ ":moduletest_include_dir" ]
180  configs += [ "${ability_runtime_services_path}/common:common_config" ]
181
182  deps = [
183    "${ability_runtime_innerkits_path}/app_manager:app_manager",
184    "${ability_runtime_innerkits_path}/runtime:runtime",
185    "${ability_runtime_native_path}/appkit:app_context",
186    "${ability_runtime_native_path}/appkit:appkit_delegator",
187    "${ability_runtime_native_path}/appkit:appkit_native",
188    "${ability_runtime_services_path}/abilitymgr:abilityms",
189  ]
190
191  external_deps = [
192    "ability_base:want",
193    "ability_runtime:ability_manager",
194    "c_utils:utils",
195    "common_event_service:cesfwk_innerkits",
196    "eventhandler:libeventhandler",
197    "googletest:gmock",
198    "googletest:gmock_main",
199    "googletest:gtest_main",
200    "hilog:libhilog",
201    "init:libbegetutil",
202    "ipc:ipc_core",
203    "runtime_core:ani",
204    "napi:ace_napi",
205  ]
206
207  if (ability_runtime_graphics) {
208    external_deps += [
209      "window_manager:libwsutils",
210      "window_manager:scene_session",
211    ]
212  }
213}
214
215ohos_moduletest("js_test_runner_moduletest") {
216  module_out_path = module_output_path
217
218  sources = [ "js_test_runner_module_test.cpp" ]
219  sources += ability_delegator_mock_sources
220
221  configs = [ ":moduletest_include_dir" ]
222  configs += [ "${ability_runtime_services_path}/common:common_config" ]
223
224  deps = [
225    "${ability_runtime_innerkits_path}/app_manager:app_manager",
226    "${ability_runtime_native_path}/ability/native:abilitykit_native",
227    "${ability_runtime_native_path}/appkit:app_context",
228    "${ability_runtime_native_path}/appkit:appkit_delegator",
229    "${ability_runtime_native_path}/appkit:appkit_native",
230    "${ability_runtime_services_path}/abilitymgr:abilityms",
231  ]
232
233  external_deps = [
234    "ability_base:configuration",
235    "ability_base:extractortool",
236    "ability_base:want",
237    "ability_runtime:ability_manager",
238    "ability_runtime:runtime",
239    "bundle_framework:appexecfwk_base",
240    "c_utils:utils",
241    "common_event_service:cesfwk_innerkits",
242    "ets_runtime:libark_jsruntime",
243    "eventhandler:libeventhandler",
244    "googletest:gmock",
245    "googletest:gmock_main",
246    "googletest:gtest_main",
247    "hilog:libhilog",
248    "init:libbegetutil",
249    "ipc:ipc_core",
250    "runtime_core:ani",
251    "napi:ace_napi",
252  ]
253}
254
255###############################################################################
256
257group("moduletest") {
258  testonly = true
259  deps = []
260
261  deps += [
262    ":ability_delegator_args_moduletest",
263    ":ability_delegator_moduletest",
264    ":ability_delegator_registry_moduletest",
265    ":delegator_thread_moduletest",
266    ":iability_monitor_moduletest",
267    ":js_test_runner_moduletest",
268    ":shell_cmd_result_moduletest",
269  ]
270}
271###############################################################################
272