# Copyright (c) 2021-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.

hdf_audio_path = "./../../../.."
hdf_audio_test_path = "./../.."

if (defined(ohos_lite)) {
  import("//build/lite/config/test.gni")
} else {
  import("//build/test.gni")
}
import("$hdf_audio_path/audio.gni")

if (defined(ohos_lite)) {
  moduletest("hdf_audio_adm_interface_test") {
    sources = [
      "$hdf_audio_test_path/common/adm_common/src/audio_adm_common.cpp",
      "$hdf_audio_test_path/common/hdi_common/src/audio_hdi_common.cpp",
      "src/audio_adm_interface_test.cpp",
    ]
    include_dirs = [
      "$hdf_audio_path/hal/hdi_passthrough/include",
      "$hdf_audio_path/interfaces/include",
      "//third_party/bounds_checking_function/include",
      "$hdf_audio_test_path/common/adm_common/include",
      "$hdf_audio_test_path/common/hdi_common/include",
      "//third_party/googletest/googletest/include/gtest",
      "$hdf_audio_test_path/adm/audio_adm_interface/include",
    ]

    public_deps = [
      "//drivers/hdf_core/adapter/uhdf/manager:hdf_core",
      "//drivers/hdf_core/adapter/uhdf/posix:hdf_posix_osal",
      "//third_party/bounds_checking_function:libsec_shared",
    ]
  }
} else {
  module_output_path = "drivers_peripheral_audio/drivers_peripheral_audio"

  ohos_systemtest("hdf_audio_adm_interface_test") {
    resource_config_file = "./../../../resource/ohos_test.xml"
    module_out_path = module_output_path
    sources = [
      "$hdf_audio_test_path/common/adm_common/src/audio_adm_common.cpp",
      "$hdf_audio_test_path/common/hdi_common/src/audio_hdi_common.cpp",
      "src/audio_adm_interface_test.cpp",
    ]

    include_dirs = [
      "$hdf_audio_path/hal/hdi_passthrough/include",
      "$hdf_audio_path/interfaces/include",
      "$hdf_audio_test_path/common/adm_common/include",
      "$hdf_audio_test_path/common/hdi_common/include",
      "//third_party/googletest/googletest/include/gtest",
      "$hdf_audio_test_path/adm/audio_adm_interface/include",
    ]
    deps = [
      "//third_party/googletest:gmock_main",
      "//third_party/googletest:gtest_main",
    ]
    external_deps = [ "hdf_core:libhdf_utils" ]
    if (enable_c_utils) {
      external_deps += [ "c_utils:utils" ]
    }
    external_deps += [ "bounds_checking_function:libsec_shared" ]
    defines = []
    if (enable_audio_adm_passthrough) {
      defines += [ "AUDIO_ADM_SO" ]
    }
    if (enable_audio_adm_service) {
      defines += [ "AUDIO_ADM_SERVICE" ]
    }
  }
}