# 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("//build/ohos.gni")
import("//build/test.gni")
import("../../../../../accessibility.gni")
import("../../../../../bluetooth_part.gni")
import("../../../../../config.gni")

group("audio_server_src_unittest_packages") {
  testonly = true
  deps = [
    ":audio_policy_manager_listener_unit_test"
  ]
}

module_output_path = "audio_framework/audio_framework_policy/audio_policy"
audio_framework_root = "../../../../.."

ohos_unittest("audio_policy_manager_listener_unit_test") {
  module_out_path = module_output_path

  include_dirs = [
    "./include",
    "../../include",
  ]

  use_exceptions = true

  cflags = [
    "-Wall",
    "-Werror",
    "-Wno-macro-redefined",
  ]

  cflags_cc = cflags
  cflags_cc += [ "-fno-access-control" ]

  sanitize = {
    cfi = true
    cfi_cross_dso = false
    boundary_sanitize = true
    debug = false
    integer_overflow = true
    ubsan = false
    blocklist = "${audio_framework_root}/cfi_blocklist.txt"
  }

  external_deps = [
    "ability_base:session_info",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:app_context",
    "ability_runtime:dataobs_manager",
    "ability_runtime:extension_manager",
    "ability_runtime:wantagent_innerkits",
    "access_token:libaccesstoken_sdk",
    "access_token:libprivacy_sdk",
    "access_token:libtokenid_sdk",
    "access_token:libtokensetproc_shared",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "data_share:datashare_common",
    "data_share:datashare_consumer",
    "distributed_notification_service:ans_innerkits",
    "drivers_interface_audio:libaudio_proxy_6.1",
    "eventhandler:libeventhandler",
    "googletest:gmock",
    "hdf_core:libhdf_host",
    "hdf_core:libhdf_ipc_adapter",
    "hdf_core:libhdf_utils",
    "hdf_core:libhdi",
    "hdf_core:libpub_utils",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "i18n:intl_util",
    "image_framework:image_native",
    "init:libbegetutil",
    "ipc:ipc_single",
    "kv_store:distributeddata_inner",
    "media_foundation:media_monitor_client",
    "media_foundation:media_monitor_common",
    "os_account:os_account_innerkits",
    "power_manager:power_setting",
    "power_manager:powermgr_client",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "ffrt:libffrt",
  ]

  sources = [ "./src/audio_policy_manager_listener_unit_test.cpp" ]

  deps = [
    "../../../../audio_policy:audio_policy_client",
    "../../../../audio_policy:audio_policy_service_static",
    "../../../../audio_service:audio_client",
    "../../../../audio_service:audio_engine_manager",
    "../../../../audio_service:audio_policy_manager",
    "../../../../audio_service:audio_stream_client",
    "../../../../audio_service:audio_common",
  ]
}