# Copyright (c) 2021-2022 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/test.gni")
import("//foundation/ability/ability_runtime/ability_runtime.gni")

module_output_path = "ability_runtime/ability_test"

###############################################################################
config("module_private_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "${ability_runtime_innerkits_path}/ability_manager/include",
    "${ability_runtime_innerkits_path}/app_manager/include/appmgr",
    "${ability_runtime_path}/interfaces/kits/native/ability/native",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include",
    "${ability_runtime_path}/interfaces/kits/native/appkit/app",
    "${ability_runtime_path}/interfaces/kits/native/appkit/app/task",
    "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include",
    "${ability_runtime_services_path}/abilitymgr/include",
    "${ability_runtime_services_path}/common/include",
    "${distributeddatamgr_path}/distributeddatamgr/interfaces/innerkits/app_distributeddata/include",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ]

  if (ability_runtime_graphics) {
    include_dirs += [
      "${global_path}/i18n/frameworks/intl/include",
      "${form_fwk_path}/interfaces/kits/native/include",
    ]
  }
}

config("module_ability_context_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "${ability_runtime_innerkits_path}/app_manager/include/appmgr",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include",
    "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include",
    "${ability_runtime_innerkits_path}/ability_manager/include",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
    "//third_party/googletest/googlemock/include",
    "${ability_runtime_path}/interfaces/kits/native/ability/native",
    "${ability_runtime_path}/interfaces/kits/native/appkit/app",
    "${multimodalinput_path}/interfaces/native/innerkits/event/include",
    "//third_party/libuv/include",
    "${global_path}/resource_management/interfaces/inner_api/include",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ]
}

ohos_unittest("ability_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/appkit/app/ability_record_mgr.cpp",
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "ability_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_lifecycle_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/ability/native/ability_lifecycle.cpp",
    "ability_lifecycle_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_lifecycle_executor_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/ability/native/ability_lifecycle_executor.cpp",
    "ability_lifecycle_executor_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_context_interface_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_client_interface1.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_resourceManager_interface1.cpp",
    "ability_context_interface1_test.cpp",
  ]

  configs = [ ":module_ability_context_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_context_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_clientex.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_service.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp",
    "ability_context_test.cpp",
  ]

  include_dirs = [ "${ability_runtime_napi_path}/inner/napi_common" ]

  configs = [ ":module_ability_context_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_napi_path}/inner/napi_common:napi_common",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "napi:ace_napi",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("page_ability_impl_test") {
  module_out_path = module_output_path
  if (ability_runtime_graphics) {
    sources = [
      "${ability_runtime_native_path}/ability/native/page_ability_impl.cpp",
      "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_replace_ability_impl.cpp",
      "page_ability_impl_test.cpp",
    ]

    configs = [ ":module_private_config" ]

    deps = [
      "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
      "${ability_runtime_native_path}/ability/native:abilitykit_native",
      "${ability_runtime_native_path}/appkit:app_context",
      "${ability_runtime_native_path}/appkit:appkit_native",
      "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
      "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
      "${multimodalinput_path}/frameworks/proxy:libmmi-common",
      "//third_party/googletest:gtest_main",
    ]

    external_deps = [
      "ability_base:want",
      "bundle_framework:appexecfwk_base",
      "c_utils:utils",
      "hitrace_native:hitrace_meter",
      "hiviewdfx_hilog_native:libhilog",
      "input:libmmi-client",
      "ipc:ipc_core",
    ]
  }
}

ohos_unittest("service_ability_impl_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/ability/native/page_ability_impl.cpp",
    "service_ability_impl_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "hitrace_native:hitrace_meter",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("scene_created_test") {
  module_out_path = module_output_path
  if (ability_runtime_graphics) {
    include_dirs = [ "${windowmanager_path}/interfaces/innerkits/wm" ]

    configs = [ ":module_ability_context_config" ]

    sources = [ "scene_created_test.cpp" ]

    deps = [
      "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
      "${ability_runtime_native_path}/ability/native:abilitykit_native",
      "${ability_runtime_native_path}/appkit:app_context",
      "${ability_runtime_native_path}/appkit:appkit_native",
      "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
      "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
      "//third_party/googletest:gtest_main",
    ]

    external_deps = [
      "ability_base:want",
      "bundle_framework:appexecfwk_base",
      "c_utils:utils",
      "hiviewdfx_hilog_native:libhilog",
      "input:libmmi-client",
      "ipc:ipc_core",
    ]
  }
}

ohos_unittest("data_ability_helper_test") {
  module_out_path = module_output_path
  include_dirs = [ "${ability_runtime_services_path}/abilitymgr/include" ]

  sources = [ "data_ability_helper_test.cpp" ]

  configs = [ ":module_ability_context_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/ability/native:data_ability_helper",
    "${ability_runtime_native_path}/appkit:app_context",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:want",
    "ability_base:zuri",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("data_ability_operation_test") {
  module_out_path = module_output_path
  sources = [ "data_ability_operation_test.cpp" ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:want",
    "ability_base:zuri",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_impl_active_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    sources += [ "ability_impl_active_test.cpp" ]
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_impl_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_innerkits_path}/app_manager:app_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    sources += [ "ability_impl_test.cpp" ]
    deps += [
      "${global_path}/i18n/frameworks/intl:intl_util",
      "${multimodalinput_path}/frameworks/proxy:libmmi-common",
    ]
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_thread_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/context_container.cpp",
    "${ability_runtime_native_path}/appkit/app/context_deal.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_client.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_data_ability_impl.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp",
    "ability_thread_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_deps_wrapper",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_thread_call_request_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/appkit/app/context_container.cpp",
    "ability_thread_call_request_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
  ]
}

ohos_unittest("form_provider_client_test") {
  module_out_path = module_output_path
  if (ability_runtime_graphics) {
    include_dirs = []

    sources = [
      "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_form_supply_callback.cpp",
      "form_provider_client_test.cpp",
    ]

    configs = [ ":module_private_config" ]

    deps = [
      "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
      "${ability_runtime_innerkits_path}/app_manager:app_manager",
      "${ability_runtime_native_path}/ability/native:abilitykit_native",
      "${ability_runtime_native_path}/appkit:app_context",
      "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
      "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
      "//third_party/googletest:gtest_main",
    ]

    external_deps = [
      "ability_base:want",
      "access_token:libaccesstoken_sdk",
      "bundle_framework:appexecfwk_base",
      "bundle_framework:appexecfwk_core",
      "c_utils:utils",
      "eventhandler:libeventhandler",
      "form_fwk:form_manager",
      "hiviewdfx_hilog_native:libhilog",
      "input:libmmi-client",
      "ipc:ipc_core",
    ]
  }
}

ohos_unittest("form_extension_provider_client_test") {
  module_out_path = module_output_path
  if (ability_runtime_graphics) {
    include_dirs = []

    sources = [
      "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_form_supply_callback.cpp",
      "form_extension_provider_client_test.cpp",
    ]

    configs = [ ":module_private_config" ]

    deps = [
      "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
      "${ability_runtime_innerkits_path}/app_manager:app_manager",
      "${ability_runtime_native_path}/ability/native:abilitykit_native",
      "${ability_runtime_native_path}/ability/native:form_extension",
      "${ability_runtime_native_path}/appkit:app_context",
      "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
      "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
      "//third_party/googletest:gtest_main",
    ]

    external_deps = [
      "ability_base:want",
      "access_token:libaccesstoken_sdk",
      "bundle_framework:appexecfwk_base",
      "bundle_framework:appexecfwk_core",
      "c_utils:utils",
      "eventhandler:libeventhandler",
      "form_fwk:fmskit_native",
      "form_fwk:form_manager",
      "hiviewdfx_hilog_native:libhilog",
      "input:libmmi-client",
      "ipc:ipc_core",
    ]
  }
}

ohos_unittest("data_ability_impl_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/context_container.cpp",
    "${ability_runtime_native_path}/appkit/app/context_deal.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_replace_ability_impl.cpp",
    "data_ability_impl_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_deps_wrapper",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("data_ability_impl_file_secondpart_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/context_container.cpp",
    "${ability_runtime_native_path}/appkit/app/context_deal.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_replace_ability_impl.cpp",
    "data_ability_impl_file_secondpart_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_deps_wrapper",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("data_ability_impl_file_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/context_container.cpp",
    "${ability_runtime_native_path}/appkit/app/context_deal.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_replace_ability_impl.cpp",
    "data_ability_impl_file_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_deps_wrapper",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_thread_dataability_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_info.cpp",
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/context_container.cpp",
    "${ability_runtime_native_path}/appkit/app/context_deal.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_client.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_data_ability_impl.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp",
    "ability_thread_dataability_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:ability_deps_wrapper",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

config("data_uri_utils_test_config") {
  visibility = [ ":*" ]
  include_dirs =
      [ "${ability_runtime_path}/interfaces/kits/native/ability/native/" ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ]
}
ohos_unittest("data_uri_utils_test") {
  module_out_path = module_output_path

  configs = [
    ":module_private_config",
    ":data_uri_utils_test_config",
  ]

  sources = [
    "${ability_runtime_native_path}/ability/native/data_uri_utils.cpp",
    "data_uri_utils_test.cpp",
  ]

  deps = [
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:zuri",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("pac_map_test") {
  module_out_path = module_output_path
  sources = [ "pac_map_test.cpp" ]

  configs = [ ":module_private_config" ]

  deps = [ "//third_party/googletest:gtest_main" ]

  external_deps = [
    "ability_base:base",
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_permission_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_service.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp",
    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp",
    "ability_permission_test.cpp",
  ]

  configs = [ ":module_ability_context_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]
  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("task_handler_client_test") {
  module_out_path = module_output_path
  sources = [ "task_handler_client_test.cpp" ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "c_utils:utils",
    "hiviewdfx_hilog_native:libhilog",
  ]
  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_thread_for_ability_on_configuration_update") {
  module_out_path = module_output_path

  sources = [ "ability_thread_for_ability_on_configuration_update.cpp" ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("data_ability_result_test") {
  module_out_path = module_output_path
  sources = [ "data_ability_result_test.cpp" ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:zuri",
    "c_utils:utils",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("form_host_client_test") {
  module_out_path = module_output_path
  if (ability_runtime_graphics) {
    sources = [
      "${ability_runtime_native_path}/appkit/app/ability_record_mgr.cpp",
      "${ability_runtime_native_path}/appkit/app/app_context.cpp",
      "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
      "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
      "${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp",
      "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager_form.cpp",
      "form_host_client_test.cpp",
    ]

    configs = [ ":module_private_config" ]

    deps = [
      "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
      "${ability_runtime_innerkits_path}/app_manager:app_manager",
      "${ability_runtime_native_path}/ability/native:abilitykit_native",
      "${ability_runtime_native_path}/appkit:app_context",
      "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
      "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
      "//third_party/googletest:gmock_main",
      "//third_party/googletest:gtest_main",
    ]

    external_deps = [
      "ability_base:configuration",
      "ability_base:want",
      "ability_runtime:runtime",
      "bundle_framework:appexecfwk_base",
      "bundle_framework:appexecfwk_core",
      "c_utils:utils",
      "eventhandler:libeventhandler",
      "form_fwk:fmskit_native",
      "form_fwk:form_manager",
      "hiviewdfx_hilog_native:libhilog",
      "input:libmmi-client",
      "ipc:ipc_core",
    ]
  }
}

ohos_unittest("continuation_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
    "continuation_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [
    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
    "${ability_runtime_native_path}/ability/native:abilitykit_native",
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:appkit_native",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "input:libmmi-client" ]
  }
}

ohos_unittest("ability_transaction_callback_info_test") {
  module_out_path = module_output_path
  sources = [
    "${ability_runtime_native_path}/ability/native/ability_transaction_callback_info.cpp",
    "ability_transaction_callback_info_test.cpp",
  ]

  configs = [ ":module_private_config" ]

  deps = [ "//third_party/googletest:gtest_main" ]

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "ability_base:zuri",
    "ability_runtime:runtime",
    "bundle_framework:appexecfwk_base",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_dataability",
    "relational_store:native_rdb",
  ]
}

ohos_unittest("new_ability_impl_test") {
  module_out_path = module_output_path
  if (ability_runtime_graphics) {
    sources = [
      "${ability_runtime_native_path}/ability/native/new_ability_impl.cpp",
      "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_replace_ability_impl.cpp",
      "new_ability_impl_test.cpp",
    ]

    configs = [ ":module_private_config" ]

    deps = [
      "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
      "${ability_runtime_native_path}/ability/native:abilitykit_native",
      "${ability_runtime_native_path}/appkit:app_context",
      "${ability_runtime_native_path}/appkit:appkit_native",
      "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
      "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
      "${multimodalinput_path}/frameworks/proxy:libmmi-common",
      "//third_party/googletest:gtest_main",
    ]

    external_deps = [
      "ability_base:want",
      "bundle_framework:appexecfwk_base",
      "c_utils:utils",
      "hitrace_native:hitrace_meter",
      "hiviewdfx_hilog_native:libhilog",
      "input:libmmi-client",
      "ipc:ipc_core",
    ]
  }
}

###############################################################################

group("unittest") {
  testonly = true
  deps = []

  deps += [
    ":ability_context_test",
    ":ability_impl_test",
    ":ability_lifecycle_executor_test",
    ":ability_lifecycle_test",
    ":ability_permission_test",
    ":ability_test",
    ":ability_thread_call_request_test",
    ":ability_thread_dataability_test",
    ":ability_thread_test",
    ":continuation_test",
    ":data_ability_helper_test",
    ":data_ability_impl_file_secondpart_test",
    ":data_ability_impl_file_test",
    ":data_ability_impl_test",
    ":data_ability_operation_test",
    ":data_ability_result_test",
    ":data_uri_utils_test",
    ":new_ability_impl_test",
    ":pac_map_test",
    ":service_ability_impl_test",
    ":task_handler_client_test",
  ]

  if (ability_runtime_graphics) {
    deps += [
      ":form_extension_provider_client_test",
      ":form_host_client_test",
      ":form_provider_client_test",
      ":page_ability_impl_test",
    ]
  }
}
###############################################################################
