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 14import("//ark/ts2abc/ts2panda/ts2abc_config.gni") 15import("//build/ohos.gni") 16 17source_root = "//test/arkXtest/uitest" 18 19config("uitest_common_configs") { 20 include_dirs = [ "//third_party/json/single_include/nlohmann" ] 21 cflags = [ 22 "-Wfloat-equal", 23 "-Wformat=2", 24 "-Wshadow", 25 ] 26} 27 28ohos_static_library("uitest_core") { 29 use_exceptions = true 30 configs = [ ":uitest_common_configs" ] 31 sources = [ 32 "${source_root}/core/extern_api.cpp", 33 "${source_root}/core/extern_api_registration.cpp", 34 "${source_root}/core/ui_action.cpp", 35 "${source_root}/core/ui_controller.cpp", 36 "${source_root}/core/ui_driver.cpp", 37 "${source_root}/core/ui_model.cpp", 38 "${source_root}/core/widget_image.cpp", 39 "${source_root}/core/widget_matcher.cpp", 40 "${source_root}/core/widget_selector.cpp", 41 ] 42 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 43 defines = [ 44 "__OHOS__=1", 45 "LOG_TAG=\"UiTestKit_Base\"", 46 ] 47} 48 49common_external_deps = [ 50 "ability_base:want", 51 "ces_standard:cesfwk_core", 52 "ces_standard:cesfwk_innerkits", 53 "hiviewdfx_hilog_native:libhilog", 54 "ipc:ipc_core", 55] 56 57accessibility_include_dirs = [ 58 "//base/accessibility/frameworks/aafwk/include", 59 "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", 60 "//utils/native/base/include", 61 "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include", 62 "//base/accessibility/interfaces/innerkits/asacfwk/include", 63 "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", 64 "//base/accessibility/frameworks/asacfwk/include", 65 "//foundation/appexecfwk/appexecfwk_lite/utils/bundle_lite", 66 "//base/accessibility/util/include", 67 "//base/accessibility/common/log/include", 68 "//base/accessibility/dummyData", 69 "//base/accessibility/interfaces/kits/napi/include", 70 "//foundation/aafwk/standard/frameworks/kits/ability/native/src", 71 "//foundation/aafwk/standard/frameworks/kits/ability/native/include", 72 "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include", 73 "//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime/", 74 "//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime/context/", 75 "//foundation/aafwk/standard/interfaces/innerkits/runtime/include/", 76 "//base/accessibility/interfaces/innerkits/aafwk/include", 77] 78 79ohos_executable("uitest_server") { 80 configs = [ ":uitest_common_configs" ] 81 sources = [ 82 "${source_root}/connection/ipc_transactors.cpp", 83 "${source_root}/connection/ipc_transactors_impl.cpp", 84 "${source_root}/server/server_main.cpp", 85 "${source_root}/server/system_ui_controller.cpp", 86 ] 87 include_dirs = [ 88 "${source_root}/core", 89 "${source_root}/connection", 90 ] 91 include_dirs += accessibility_include_dirs 92 93 # static link the uitest_core as server end 94 deps = [ ":uitest_core" ] 95 96 deps += [ 97 "//foundation/aafwk/standard/frameworks/kits/appkit:app_context", 98 "//foundation/aafwk/standard/frameworks/kits/appkit:appkit_native", 99 ] 100 101 external_deps = [ 102 "ability_base:want", 103 "ability_runtime:ability_manager", 104 "ability_runtime:runtime", 105 "accessibility:accessibilityclient", 106 "accessibility:accessibleability", 107 ] 108 external_deps += [ 109 "ability_base:want", 110 "ability_runtime:ability_context_native", 111 "ability_runtime:ability_manager", 112 "ability_runtime:abilitykit_native", 113 "ability_runtime:runtime", 114 "bundle_framework:appexecfwk_base", 115 "bundle_framework:appexecfwk_core", 116 "hiviewdfx_hilog_native:libhilog", 117 "ipc:ipc_core", 118 "multimodalinput_base:libmmi-client", 119 "samgr_standard:samgr_proxy", 120 ] 121 122 #dependencies for screencap 123 deps += [ "//third_party/libpng:libpng" ] 124 external_deps += [ 125 "multimedia_image_standard:image_native", 126 "window_manager:libdm", 127 "window_manager:libwm", 128 ] 129 130 subsystem_name = "test" 131 part_name = "arkXtest" 132 output_name = "uitest" 133 install_enable = true 134 external_deps += common_external_deps 135 defines = [ 136 "__OHOS__=1", 137 "LOG_TAG=\"UiTestKit_Server\"", 138 ] 139} 140 141ts2abc_gen_abc("gen_uitest_exporter_abc") { 142 src_js = rebase_path("${source_root}/napi/uitest_exporter.js") 143 dst_file = rebase_path(target_out_dir + "/uitest_exporter.abc") 144 in_puts = [ "${source_root}/napi/uitest_exporter.js" ] 145 out_puts = [ target_out_dir + "/uitest_exporter.abc" ] 146 extra_args = [ "--module" ] 147} 148 149gen_js_obj("uitest_exporter_js") { 150 input = "${source_root}/napi/uitest_exporter.js" 151 output = target_out_dir + "/uitest_exporter.o" 152} 153 154gen_js_obj("uitest_exporter_abc") { 155 input = get_label_info(":gen_exporter_abc", "target_out_dir") + 156 "/uitest_exporter.abc" 157 output = target_out_dir + "/uitest_exporter_abc.o" 158 dep = ":gen_uitest_exporter_abc" 159} 160 161ohos_shared_library("uitest_client") { 162 configs = [ ":uitest_common_configs" ] 163 sources = [ 164 "${source_root}/connection/ipc_transactors.cpp", 165 "${source_root}/connection/ipc_transactors_impl.cpp", 166 "${source_root}/napi/uitest_napi.cpp", 167 ] 168 include_dirs = [ 169 "${source_root}/core", 170 "${source_root}/connection", 171 ] 172 deps = [ 173 ":uitest_exporter_abc", 174 ":uitest_exporter_js", 175 ] 176 subsystem_name = "test" 177 part_name = "arkXtest" 178 output_name = "uitest" 179 external_deps = common_external_deps 180 external_deps += [ "napi:ace_napi" ] 181 relative_install_dir = "module" 182 defines = [ 183 "__OHOS__=1", 184 "LOG_TAG=\"UiTestKit_Client\"", 185 ] 186} 187 188ohos_unittest("uitest_core_unittest") { 189 sources = [ 190 "${source_root}/test/common_utilities_test.cpp", 191 "${source_root}/test/extern_api_test.cpp", 192 "${source_root}/test/transaction_connection_test.cpp", 193 "${source_root}/test/ui_action_test.cpp", 194 "${source_root}/test/ui_controller_test.cpp", 195 "${source_root}/test/ui_model_test.cpp", 196 "${source_root}/test/uidriver_test.cpp", 197 "${source_root}/test/widget_image_test.cpp", 198 "${source_root}/test/widget_matcher_test.cpp", 199 "${source_root}/test/widget_selector_test.cpp", 200 ] 201 sources += [ "${source_root}/connection/ipc_transactors.cpp" ] 202 deps = [ 203 ":uitest_core", 204 "//third_party/googletest:gtest_main", 205 ] 206 include_dirs = [ 207 "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", 208 "//third_party/json/single_include/nlohmann", 209 "${source_root}/core", 210 "${source_root}/connection", 211 ] 212 cflags = [ "-g" ] 213 cflags_cc = [ "-g" ] 214 use_exceptions = true 215 module_out_path = "uitestkit/unittest" 216 testonly = true 217 subsystem_name = "test" 218 part_name = "arkXtest" 219} 220 221group("uitestkit") { 222 deps = [ 223 ":uitest_client", 224 ":uitest_server", 225 ] 226} 227 228group("uitestkit_test") { 229 testonly = true 230 deps = [ ":uitest_core_unittest" ] 231} 232