1# Copyright (c) 2021 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 14base_root = "../../../.." 15import("$base_root/arkcompiler/ets_frontend/es2panda/es2abc_config.gni") 16import("$base_root/build/ohos.gni") 17 18source_root = "$base_root/test/testfwk/arkxtest/uitest" 19 20config("uitest_common_configs") { 21 include_dirs = [ 22 "//third_party/json/single_include/nlohmann", 23 "$base_root/foundation/mutimodalinput/input/interfaces", 24 ] 25 cflags = [ 26 "-Wfloat-equal", 27 "-Wformat=2", 28 "-Wshadow", 29 ] 30} 31 32ohos_static_library("uitest_core") { 33 use_exceptions = true 34 configs = [ ":uitest_common_configs" ] 35 sources = [ 36 "${source_root}/core/dump_handler.cpp", 37 "${source_root}/core/frontend_api_handler.cpp", 38 "${source_root}/core/rect_algorithm.cpp", 39 "${source_root}/core/select_strategy.cpp", 40 "${source_root}/core/ui_action.cpp", 41 "${source_root}/core/ui_driver.cpp", 42 "${source_root}/core/ui_model.cpp", 43 "${source_root}/core/widget_operator.cpp", 44 "${source_root}/core/widget_selector.cpp", 45 "${source_root}/core/window_operator.cpp", 46 ] 47 external_deps = [ "hilog:libhilog" ] 48 defines = [ 49 "__OHOS__=1", 50 "LOG_TAG=\"UiTestKit_Base\"", 51 ] 52 53 subsystem_name = "testfwk" 54 part_name = "arkxtest" 55} 56 57ohos_static_library("uitest_input") { 58 use_exceptions = true 59 configs = [ ":uitest_common_configs" ] 60 sources = [ "${source_root}/input/ui_input.cpp" ] 61 deps = [ ":uitest_core" ] 62 defines = [ 63 "__OHOS__=1", 64 "LOG_TAG=\"UiTestKit_Input\"", 65 ] 66 include_dirs = [ "${source_root}/core" ] 67 external_deps = [ "hilog:libhilog" ] 68 subsystem_name = "testfwk" 69 part_name = "arkxtest" 70} 71 72ohos_static_library("uitest_record") { 73 use_exceptions = true 74 configs = [ ":uitest_common_configs" ] 75 sources = [ 76 "${source_root}/record/external_calls.cpp", 77 "${source_root}/record/find_widget.cpp", 78 "${source_root}/record/keyevent_tracker.cpp", 79 "${source_root}/record/least_square_impl.cpp", 80 "${source_root}/record/matrix3.cpp", 81 "${source_root}/record/pointer_info.cpp", 82 "${source_root}/record/pointer_tracker.cpp", 83 "${source_root}/record/ui_record.cpp", 84 "${source_root}/record/velocity_tracker.cpp", 85 ] 86 deps = [ ":uitest_core" ] 87 defines = [ 88 "__OHOS__=1", 89 "LOG_TAG=\"UiTestKit_Base\"", 90 ] 91 include_dirs = [ "${source_root}/core" ] 92 external_deps = [ 93 "ability_base:want", 94 "ability_runtime:ability_manager", 95 "hilog:libhilog", 96 "input:libmmi-client", 97 ] 98 99 subsystem_name = "testfwk" 100 part_name = "arkxtest" 101} 102common_external_deps = [ 103 "c_utils:utils", 104 "hilog:libhilog", 105] 106 107ohos_static_library("uitest_ipc") { 108 configs = [ ":uitest_common_configs" ] 109 sources = [ "${source_root}/connection/ipc_transactor.cpp" ] 110 include_dirs = [ "${source_root}/core" ] 111 external_deps = [ 112 "ability_base:want", 113 "common_event_service:cesfwk_innerkits", 114 "ipc:ipc_core", 115 ] 116 external_deps += common_external_deps 117 118 subsystem_name = "testfwk" 119 part_name = "arkxtest" 120 121 defines = [ 122 "__OHOS__=1", 123 "LOG_TAG=\"UiTestKit_Conn\"", 124 ] 125} 126 127ohos_static_library("uitest_addon") { 128 configs = [ ":uitest_common_configs" ] 129 sources = [ 130 "${source_root}/addon/extension_executor.cpp", 131 "${source_root}/addon/screen_copy.cpp", 132 ] 133 include_dirs = [ 134 "${source_root}/core", 135 "${source_root}/record", 136 ] 137 deps = [ 138 ":uitest_core", 139 "//third_party/libjpeg-turbo:turbojpeg_static", 140 ] 141 external_deps = [ 142 "image_framework:image_native", 143 "input:libmmi-client", 144 "window_manager:libdm", 145 "window_manager:libwm", 146 ] 147 external_deps += common_external_deps 148 149 subsystem_name = "testfwk" 150 part_name = "arkxtest" 151 152 defines = [ 153 "__OHOS__=1", 154 "LOG_TAG=\"UiTestKit_Addon\"", 155 ] 156} 157 158ohos_executable("uitest_server") { 159 configs = [ ":uitest_common_configs" ] 160 sources = [ 161 "${source_root}/server/element_node_iterator_impl.cpp", 162 "${source_root}/server/server_main.cpp", 163 "${source_root}/server/system_ui_controller.cpp", 164 ] 165 include_dirs = [ 166 "${source_root}/core", 167 "${source_root}/connection", 168 "${source_root}/record", 169 "${source_root}/addon", 170 "${source_root}/input", 171 ] 172 173 # static link the uitest_core as server end 174 deps = [ 175 ":uitest_addon", 176 ":uitest_core", 177 ":uitest_input", 178 ":uitest_ipc", 179 ":uitest_record", 180 ] 181 182 #dependencies for screencap 183 deps += [ 184 "$base_root/foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client", 185 "//third_party/libpng:libpng", 186 ] 187 external_deps = [ 188 "ability_runtime:ability_manager", 189 "accessibility:accessibleability", 190 "image_framework:image_native", 191 "input:libmmi-client", 192 "pasteboard:pasteboard_client", 193 "window_manager:libdm", 194 "window_manager:libwm", 195 ] 196 197 subsystem_name = "testfwk" 198 part_name = "arkxtest" 199 output_name = "uitest" 200 install_enable = true 201 external_deps += common_external_deps 202 defines = [ 203 "__OHOS__=1", 204 "LOG_TAG=\"UiTestKit_Server\"", 205 ] 206 207 if (defined(global_parts_info) && 208 defined(global_parts_info.hiviewdfx_hidumper)) { 209 include_dirs += 210 [ "//base/hiviewdfx/hidumper/interfaces/native/innerkits/include" ] 211 external_deps += [ 212 "hidumper:hidumper_client", 213 "samgr:samgr_proxy", 214 ] 215 defines += [ "HIDUMPER_ENABLED" ] 216 } 217} 218 219es2abc_gen_abc("gen_uitest_exporter_abc") { 220 src_js = rebase_path("${source_root}/napi/uitest_exporter.js") 221 dst_file = rebase_path(target_out_dir + "/uitest_exporter.abc") 222 in_puts = [ "${source_root}/napi/uitest_exporter.js" ] 223 out_puts = [ target_out_dir + "/uitest_exporter.abc" ] 224 extra_args = [ "--module" ] 225} 226 227gen_js_obj("uitest_exporter_js") { 228 input = "${source_root}/napi/uitest_exporter.js" 229 output = target_out_dir + "/uitest_exporter.o" 230} 231 232gen_js_obj("uitest_exporter_abc") { 233 input = get_label_info(":gen_exporter_abc", "target_out_dir") + 234 "/uitest_exporter.abc" 235 output = target_out_dir + "/uitest_exporter_abc.o" 236 dep = ":gen_uitest_exporter_abc" 237} 238 239ohos_shared_library("uitest_client") { 240 configs = [ ":uitest_common_configs" ] 241 sources = [ 242 "${source_root}/napi/ui_event_observer_napi.cpp", 243 "${source_root}/napi/uitest_napi.cpp", 244 ] 245 include_dirs = [ 246 "//third_party/libuv/include", 247 "${source_root}/core", 248 "${source_root}/connection", 249 ] 250 deps = [ 251 ":uitest_exporter_abc", 252 ":uitest_exporter_js", 253 ":uitest_ipc", 254 ] 255 subsystem_name = "testfwk" 256 part_name = "arkxtest" 257 output_name = "uitest" 258 external_deps = common_external_deps 259 external_deps += [ 260 "image_framework:image_native", 261 "napi:ace_napi", 262 "pasteboard:pasteboard_client", 263 ] 264 relative_install_dir = "module" 265 defines = [ 266 "__OHOS__=1", 267 "LOG_TAG=\"UiTestKit_Client\"", 268 ] 269} 270 271ohos_unittest("uitest_core_unittest") { 272 sources = [ 273 "${source_root}/test/common_utilities_test.cpp", 274 "${source_root}/test/frontend_api_handler_test.cpp", 275 "${source_root}/test/rect_algorithm_test.cpp", 276 "${source_root}/test/select_strategy_test.cpp", 277 "${source_root}/test/ui_action_test.cpp", 278 "${source_root}/test/ui_driver_test.cpp", 279 "${source_root}/test/ui_model_test.cpp", 280 "${source_root}/test/widget_operator_test.cpp", 281 "${source_root}/test/widget_selector_test.cpp", 282 ] 283 deps = [ 284 ":uitest_core", 285 "//third_party/googletest:gtest_main", 286 ] 287 include_dirs = [ 288 "$base_root/base/hiviewdfx/hilog/interfaces/native/innerkits/include", 289 "//third_party/json/single_include/nlohmann", 290 "${source_root}/core", 291 ] 292 cflags = [ "-g" ] 293 cflags_cc = [ "-g" ] 294 use_exceptions = true 295 module_out_path = "uitestkit/unittest" 296 testonly = true 297 subsystem_name = "testfwk" 298 part_name = "arkxtest" 299} 300 301ohos_unittest("uitest_ipc_unittest") { 302 sources = [ "${source_root}/test/ipc_transactor_test.cpp" ] 303 deps = [ 304 ":uitest_ipc", 305 "//third_party/googletest:gtest_main", 306 ] 307 include_dirs = [ 308 "${source_root}/connection", 309 "${source_root}/core", 310 "//third_party/json/single_include/nlohmann", 311 "//third_party/json/single_include", 312 ] 313 cflags = [ "-g" ] 314 cflags_cc = [ "-g" ] 315 module_out_path = "uitestkit/unittest" 316 testonly = true 317 subsystem_name = "testfwk" 318 part_name = "arkxtest" 319} 320 321group("uitestkit") { 322 deps = [ 323 ":uitest_client", 324 ":uitest_server", 325 ] 326} 327 328group("uitestkit_test") { 329 testonly = true 330 deps = [ 331 ":uitest_core_unittest", 332 ":uitest_ipc_unittest", 333 ] 334} 335