# Copyright (c) 2022-2023 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("//build/config/features.gni")
import("//build/test.gni")
import("./../../../multimedia_camera_framework.gni")

ohos_fuzztest("PhotoOutputFuzzTest") {
  module_out_path = "camera_framework/camera_framework"
  fuzz_config_file = "../photooutput_fuzzer"

  include_dirs = [
    "${driver_disply_path}/interfaces/include",
    "${graphic_surface_path}/surface/include",
    "${multimedia_camera_framework_path}/services/camera_service/include",
    "${multimedia_camera_framework_path}/services/camera_service/binder/base/include",
    "${multimedia_camera_framework_path}/services/camera_service/binder/client/include",
    "${multimedia_camera_framework_path}/services/camera_service/binder/server/include",
    "${multimedia_camera_framework_path}/interfaces/inner_api/native/camera/include",
    "${multimedia_camera_framework_path}/interfaces/inner_api/native/camera/include/output/",
    "${window_manager_path}/interfaces/innerkits/dm",
    "${base_security_path}/interfaces/innerkits/accesstoken/include",
    "${driver_peripheral_path}/interfaces/include",
    "${driver_peripheral_path}/interfaces/hdi_ipc",
    "${driver_peripheral_path}/interfaces/hdi_ipc/utils/include",
    "${driver_peripheral_path}/interfaces/hdi_ipc/callback/device/include",
    "${driver_peripheral_path}/interfaces/hdi_ipc/callback/operator/include",
    "${driver_peripheral_path}/interfaces/hdi_ipc/callback/host/include",
    "${base_security_path}/interfaces/innerkits/token_setproc/include",
    "${system_safwk_path}/native/include",
    "${driver_disply_path}/interfaces/include",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]

  sources = [ "photo_output_fuzzer.cpp" ]

  deps = [ "../../../frameworks/native/camera:camera_framework" ]
  external_deps = [
    "ability_base:want",
    "access_token:libaccesstoken_sdk",
    "access_token:libnativetoken",
    "access_token:libprivacy_sdk",
    "access_token:libtoken_setproc",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "drivers_interface_camera:libbuffer_handle_sequenceable_1.0",
    "drivers_interface_camera:libcamera_proxy_1.0",
    "drivers_interface_camera:libcamera_proxy_1.1",
    "drivers_interface_camera:libmap_data_sequenceable_1.0",
    "drivers_interface_camera:metadata",
    "drivers_peripheral_display:hdi_gralloc_client",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hdf_core:libhdi",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "hitrace:hitrace_meter",
    "ipc:ipc_core",
    "ipc:ipc_single",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "window_manager:libdm",
  ]
}

group("fuzztest") {
  testonly = true
  deps = [ ":PhotoOutputFuzzTest" ]
}