# Copyright (c) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//base/web/webview/web_aafwk.gni")
import("//build/test.gni")
import("../../../config.gni")
module_output_path = "webview/Web_Framework"
config("module_private_config") {
visibility = [ ":*" ]
include_dirs = [
"$webview_path/arkweb_utils",
"../../../ohos_nweb/include/",
"../../../ohos_adapter/hiviewdfx_adapter/include/",
"../../../ohos_adapter/system_properties_adapter/include",
"../../../ohos_interface/include/ohos_adapter",
]
}
ohos_unittest("arkweb_utils_test") {
module_out_path = module_output_path
sources = [ "arkweb_utils_test.cpp" ]
configs = [ ":module_private_config" ]
deps = [
"$webview_path/arkweb_utils:libarkweb_utils",
"$webview_path/ohos_adapter:nweb_ohos_adapter"
]
deps += [
"$webview_path/ohos_nweb:libnweb",
]
external_deps = [
"ability_runtime:app_context",
"ability_runtime:app_manager",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken",
"access_token:libtoken_setproc",
"audio_framework:audio_capturer",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"googletest:gmock_main",
"googletest:gtest_main",
"hilog:libhilog",
"cJSON:cjson",
"bundle_framework:appexecfwk_base",
"graphic_2d:librender_service_client",
"init:libbegetutil",
"window_manager:libwm",
"selinux_adapter:librestorecon"
]
}
ohos_unittest("share_relro_test") {
module_out_path = module_output_path
sources = [
"share_relro_test.cpp",
"mock_system_func.c"
]
configs = [ ":module_private_config" ]
defines = [
"mmap=MmapMock",
"unlink=UnlinkMock",
"dlopen_ns_ext=DlopenNsExtMock",
"prctl=PrctlMock",
"setuid=SetUidMock",
"setgid=SetGidMock",
"RestoreconRecurse=RestoreconRecurseMock",
"mount=MountMock",
]
deps = [
"$webview_path/arkweb_utils:libarkweb_utils",
"$webview_path/ohos_nweb:libnweb"
]
external_deps = [
"ability_runtime:app_context",
"ability_runtime:app_manager",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken",
"access_token:libtoken_setproc",
"audio_framework:audio_capturer",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"googletest:gmock_main",
"googletest:gtest_main",
"hilog:libhilog",
"cJSON:cjson",
"bundle_framework:appexecfwk_base",
"graphic_2d:librender_service_client",
"init:libbegetutil",
"window_manager:libwm",
"selinux_adapter:librestorecon"
]
}
ohos_unittest("arkweb_preload_test") {
module_out_path = module_output_path
sources = [
"arkweb_preload_test.cpp",
]
configs = [ ":module_private_config" ]
defines = [
"dlopen=DlopenMock",
"dlopen_ns=DlopenNsMock",
"sysinfo=SysinfoMock",
"dlns_init=DlnsInitMock",
"dlns_create=DlnsCreateMock",
"dlns_get=DlnsGetMock",
"dlns_inherit=DlnsInheritMock",
]
deps = [
"$webview_path/arkweb_utils:libarkweb_utils",
"$webview_path/ohos_nweb:libnweb",
]
external_deps = [
"ability_runtime:app_context",
"ability_runtime:app_manager",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken",
"access_token:libtoken_setproc",
"audio_framework:audio_capturer",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"googletest:gmock_main",
"googletest:gtest_main",
"hilog:libhilog",
"cJSON:cjson",
"bundle_framework:appexecfwk_base",
"graphic_2d:librender_service_client",
"init:libbegetutil",
"window_manager:libwm",
"selinux_adapter:librestorecon",
"ace_engine:ace_forward_compatibility",
]
}
group("unittest") {
testonly = true
deps = [
":arkweb_utils_test",
":share_relro_test",
":arkweb_preload_test"
]
}