• 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("//base/security/access_token/access_token.gni")
15import("//build/test.gni")
16import("//foundation/ability/ability_runtime/ability_runtime.gni")
17
18module_output_path = "ability_tools/tools"
19
20ability_delegator_mock_sources =
21    [ "${ability_runtime_path}/tools/test/mock/mock_ability_manager_stub.cpp" ]
22
23config("tools_ability_delegator_config") {
24  include_dirs = [
25    "${ability_runtime_path}/tools/test/mock",
26    "//third_party/googletest/googlemock/include",
27    "${ability_runtime_path}/tools/aa/include",
28  ]
29}
30
31ohos_unittest("ability_command_test") {
32  module_out_path = module_output_path
33
34  configs = [ ":tools_ability_delegator_config" ]
35
36  sources = [ "ability_command_test.cpp" ]
37  sources += ability_delegator_mock_sources
38
39  deps = [
40    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
41    "//third_party/googletest:gmock_main",
42    "//third_party/googletest:gtest_main",
43  ]
44
45  external_deps = [
46    "ability_base:configuration",
47    "bundle_framework:appexecfwk_base",
48    "hilog:libhilog",
49    "ipc:ipc_core",
50  ]
51}
52
53ohos_unittest("test_observer_test") {
54  module_out_path = module_output_path
55
56  configs = [ ":tools_ability_delegator_config" ]
57
58  sources = [ "test_observer_test.cpp" ]
59  sources += ability_delegator_mock_sources
60
61  deps = [
62    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
63    "//third_party/googletest:gmock_main",
64    "//third_party/googletest:gtest_main",
65  ]
66
67  external_deps = [
68    "ability_base:configuration",
69    "bundle_framework:appexecfwk_base",
70    "hilog:libhilog",
71    "ipc:ipc_core",
72  ]
73}
74
75ohos_unittest("test_observer_proxy_test") {
76  module_out_path = module_output_path
77
78  sources = [ "test_observer_proxy_test.cpp" ]
79
80  deps = [
81    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
82    "//third_party/googletest:gmock_main",
83    "//third_party/googletest:gtest_main",
84  ]
85
86  external_deps = [
87    "hilog:libhilog",
88    "ipc:ipc_core",
89  ]
90}
91
92ohos_unittest("test_observer_stub_test") {
93  module_out_path = module_output_path
94
95  sources = [
96    "mock_test_observer_stub.cpp",
97    "test_observer_stub_test.cpp",
98  ]
99
100  deps = [
101    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
102    "//third_party/googletest:gmock_main",
103    "//third_party/googletest:gtest_main",
104  ]
105
106  external_deps = [
107    "hilog:libhilog",
108    "ipc:ipc_core",
109  ]
110}
111
112ohos_unittest("shell_command_result_test") {
113  module_out_path = module_output_path
114
115  sources = [ "shell_command_result_test.cpp" ]
116
117  configs = [ ":tools_ability_delegator_config" ]
118
119  deps = [
120    "${ability_runtime_path}/tools/aa:tools_aa_source_set",
121    "//third_party/googletest:gmock_main",
122    "//third_party/googletest:gtest_main",
123  ]
124
125  external_deps = [
126    "ability_base:configuration",
127    "bundle_framework:appexecfwk_base",
128    "hilog:libhilog",
129    "ipc:ipc_core",
130  ]
131}
132
133print("accessibility_enable = ", accessibility_enable)
134if (accessibility_enable) {
135  ohos_unittest("shell_command_executor_test") {
136    module_out_path = module_output_path
137
138    sources = [ "shell_command_executor_test.cpp" ]
139
140    configs = [ ":tools_ability_delegator_config" ]
141
142    deps = [
143      "${ability_runtime_path}/tools/aa:tools_aa_source_set",
144      "//third_party/googletest:gmock_main",
145      "//third_party/googletest:gtest_main",
146    ]
147
148    external_deps = [
149      "ability_base:configuration",
150      "accessibility:accessibility_common",
151      "accessibility:accessibilityclient",
152      "accessibility:accessibilityconfig",
153      "bundle_framework:appexecfwk_base",
154      "hilog:libhilog",
155      "ipc:ipc_core",
156    ]
157  }
158  ohos_unittest("accessibility_ability_command_test") {
159    module_out_path = module_output_path
160
161    symlink_target_name = [ "ability_tool" ]
162
163    include_dirs =
164        [ "${access_token_path}/interfaces/innerkits/token_setproc/include/" ]
165
166    configs = [ ":tools_ability_delegator_config" ]
167
168    sources = [
169      "${ability_runtime_path}/tools/aa/src/accessibility_ability_command.cpp",
170      "${ability_runtime_path}/tools/aa/src/accessibility_ability_utils.cpp",
171      "accessibility_ability_command_test.cpp",
172      "mock_accessibility_config.cpp",
173    ]
174
175    deps = [
176      "${ability_runtime_path}/tools/aa:tools_aa_source_set",
177      "//third_party/googletest:gtest_main",
178    ]
179
180    external_deps = [
181      "ability_base:configuration",
182      "access_token:libaccesstoken_sdk",
183      "access_token:libnativetoken",
184      "access_token:libtoken_setproc",
185      "accessibility:accessibilityclient",
186      "accessibility:accessibilityconfig",
187      "bundle_framework:appexecfwk_base",
188      "hilog:libhilog",
189      "ipc:ipc_core",
190    ]
191  }
192}
193group("unittest") {
194  testonly = true
195
196  deps = [
197    ":ability_command_test",
198    ":shell_command_result_test",
199    ":test_observer_proxy_test",
200    ":test_observer_stub_test",
201    ":test_observer_test",
202  ]
203  if (accessibility_enable) {
204    deps += [
205      ":accessibility_ability_command_test",
206      ":shell_command_executor_test",
207    ]
208  }
209}
210