# 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.

#####################hydra-fuzz###################
import("//base/web/webview/web_aafwk.gni")
import("//build/config/features.gni")
import("//build/test.gni")
import("../../../config.gni")

##############################fuzztest##########################################
ohos_fuzztest("VerifyPackageInstallFuzzTest") {
  module_out_path = webview_fuzz_test_path
  fuzz_config_file = "$webview_path/test/fuzztest/verifypackageinstall_fuzzer"
  include_dirs = [
    "$webview_path/sa/include",
    "$webview_path/ohos_nweb/include",
    "${target_gen_dir}/../../../sa",
  ]
  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
  sources = [
    "${target_gen_dir}/../../../sa/app_fwk_update/app_fwk_update_service_proxy.cpp",
    "${target_gen_dir}/../../../sa/app_fwk_update/app_fwk_update_service_stub.cpp",
    "${webview_path}/sa/app_fwk_update/src/app_fwk_update_client.cpp",
    "${webview_path}/sa/app_fwk_update/src/app_fwk_update_load_callback.cpp",
    "${webview_path}/sa/app_fwk_update/src/app_fwk_update_service.cpp",
    "verifypackageinstall_fuzzer.cpp",
  ]
  deps = [
    "${webview_path}/sa/app_fwk_update:app_fwk_update_service",
    "${webview_path}/sa/app_fwk_update:app_fwk_update_service_interface",
  ]
  deps += [
    "$webview_path/ohos_nweb:libnweb",
  ]
  external_deps = [
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:napi_common",
    "appspawn:appspawn_client",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "common_event_service:cesfwk_core",
    "common_event_service:cesfwk_innerkits",
    "eventhandler:libeventhandler",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "hilog:libhilog",
    "hitrace:hitrace_meter",
    "init:libbeget_proxy",
    "init:libbegetutil",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "window_manager:libwm",
  ]
}

###############################################################################
group("fuzztest") {
  testonly = true
  deps = []
  if (webview_app_fwk_update_enable) {
    deps += [
      # deps file
      ":VerifyPackageInstallFuzzTest",
    ]
  }
}
###############################################################################