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