# Copyright (c) 2021 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/aafwk/standard/aafwk.gni")
import("//foundation/aafwk/standard/services/abilitymgr/abilitymgr.gni")

EVENT_DIR = "//base/notification/ces_standard/"

ohos_source_set("abilityms_test_source") {
  sources = [
    "${services_path}/abilitymgr/src/ability_connect_callback_stub.cpp",
    "${services_path}/abilitymgr/src/ability_connect_manager.cpp",
    "${services_path}/abilitymgr/src/ability_event_handler.cpp",
    "${services_path}/abilitymgr/src/ability_manager_proxy.cpp",
    "${services_path}/abilitymgr/src/ability_manager_service.cpp",
    "${services_path}/abilitymgr/src/ability_manager_stub.cpp",
    "${services_path}/abilitymgr/src/ability_mission_info.cpp",
    "${services_path}/abilitymgr/src/ability_record.cpp",
    "${services_path}/abilitymgr/src/ability_record_info.cpp",
    "${services_path}/abilitymgr/src/ability_scheduler_proxy.cpp",
    "${services_path}/abilitymgr/src/ability_scheduler_stub.cpp",
    "${services_path}/abilitymgr/src/ability_stack_manager.cpp",
    "${services_path}/abilitymgr/src/ability_start_setting.cpp",
    "${services_path}/abilitymgr/src/ability_token_stub.cpp",
    "${services_path}/abilitymgr/src/ams_configuration_parameter.cpp",
    "${services_path}/abilitymgr/src/call_container.cpp",
    "${services_path}/abilitymgr/src/call_record.cpp",
    "${services_path}/abilitymgr/src/caller_info.cpp",
    "${services_path}/abilitymgr/src/connection_record.cpp",
    "${services_path}/abilitymgr/src/data_ability_caller_recipient.cpp",
    "${services_path}/abilitymgr/src/data_ability_manager.cpp",
    "${services_path}/abilitymgr/src/data_ability_record.cpp",
    "${services_path}/abilitymgr/src/image_info.cpp",
    "${services_path}/abilitymgr/src/inner_mission_info.cpp",
    "${services_path}/abilitymgr/src/kernal_ability_manager.cpp",
    "${services_path}/abilitymgr/src/kernal_system_app_manager.cpp",
    "${services_path}/abilitymgr/src/launch_param.cpp",
    "${services_path}/abilitymgr/src/lifecycle_deal.cpp",
    "${services_path}/abilitymgr/src/lifecycle_state_info.cpp",
    "${services_path}/abilitymgr/src/lock_mission_container.cpp",
    "${services_path}/abilitymgr/src/lock_screen_event_subscriber.cpp",
    "${services_path}/abilitymgr/src/lock_screen_white_list.cpp",
    "${services_path}/abilitymgr/src/mission.cpp",
    "${services_path}/abilitymgr/src/mission_data_storage.cpp",
    "${services_path}/abilitymgr/src/mission_description_info.cpp",
    "${services_path}/abilitymgr/src/mission_index_info.cpp",
    "${services_path}/abilitymgr/src/mission_info.cpp",
    "${services_path}/abilitymgr/src/mission_info_mgr.cpp",
    "${services_path}/abilitymgr/src/mission_list.cpp",
    "${services_path}/abilitymgr/src/mission_list_manager.cpp",
    "${services_path}/abilitymgr/src/mission_listener_controller.cpp",
    "${services_path}/abilitymgr/src/mission_listener_proxy.cpp",
    "${services_path}/abilitymgr/src/mission_listener_stub.cpp",
    "${services_path}/abilitymgr/src/mission_option.cpp",
    "${services_path}/abilitymgr/src/mission_record.cpp",
    "${services_path}/abilitymgr/src/mission_record_info.cpp",
    "${services_path}/abilitymgr/src/mission_snapshot.cpp",
    "${services_path}/abilitymgr/src/mission_stack.cpp",
    "${services_path}/abilitymgr/src/mission_stack_info.cpp",
    "${services_path}/abilitymgr/src/pending_want_common_event.cpp",
    "${services_path}/abilitymgr/src/pending_want_key.cpp",
    "${services_path}/abilitymgr/src/pending_want_manager.cpp",
    "${services_path}/abilitymgr/src/pending_want_record.cpp",
    "${services_path}/abilitymgr/src/power_storage.cpp",
    "${services_path}/abilitymgr/src/remote_mission_listener_proxy.cpp",
    "${services_path}/abilitymgr/src/remote_mission_listener_stub.cpp",
    "${services_path}/abilitymgr/src/resume_mission_container.cpp",
    "${services_path}/abilitymgr/src/screenshot_handler.cpp",
    "${services_path}/abilitymgr/src/screenshot_response.cpp",
    "${services_path}/abilitymgr/src/sender_info.cpp",
    "${services_path}/abilitymgr/src/shared_memory.cpp",
    "${services_path}/abilitymgr/src/stack_info.cpp",
    "${services_path}/abilitymgr/src/stack_setting.cpp",
    "${services_path}/abilitymgr/src/task_data_persistence_mgr.cpp",
    "${services_path}/abilitymgr/src/user_controller.cpp",
    "${services_path}/abilitymgr/src/user_event_handler.cpp",
    "${services_path}/abilitymgr/src/want_receiver_proxy.cpp",
    "${services_path}/abilitymgr/src/want_receiver_stub.cpp",
    "${services_path}/abilitymgr/src/want_sender_info.cpp",
    "${services_path}/abilitymgr/src/want_sender_proxy.cpp",
    "${services_path}/abilitymgr/src/want_sender_stub.cpp",
    "${services_path}/abilitymgr/src/wants_info.cpp",
  ]

  include_dirs = [
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/",
    "${EVENT_DIR}/frameworks/core/include",
    "${EVENT_DIR}/interfaces/innerkits/native/include",
    "${services_path}/abilitymgr/test/mock/libs/system_ability_mock",
    "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core",
    "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
    "//foundation/aafwk/standard/interfaces/innerkits/app_manager/include/appmgr",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/include/distributed_ability_runtime",
    "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include",
    "//base/account/os_account/frameworks/common/account_error/include",
    "//base/account/os_account/frameworks/common/database/include",
    "//base/account/os_account/frameworks/common/log/include",
    "//base/account/os_account/interfaces/innerkits/osaccount/native/include",
    "//base/hiviewdfx/hicollie/interfaces/native/innerkits/include/xcollie",
  ]

  external_dependent_files = [
    "//foundation/aafwk/standard/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_state_callback_host.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_mgr_client.cpp",
    "//foundation/appexecfwk/standard/common/log/src/app_log_wrapper.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/app_state_callback_proxy.cpp",
  ]

  sources += external_dependent_files

  public_configs = [
    "${services_path}/abilitymgr:abilityms_config",
    "${services_path}/abilitymgr/test/mock:aafwk_mock_config",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  deps = [
    "${aafwk_path}/interfaces/innerkits/app_manager:app_manager",
    "${innerkits_path}/base:base",
    "${innerkits_path}/want:want",
    "${services_path}/abilitymgr/test/mock/libs/sa_mgr:sa_mgr_mock",
    "//base/account/os_account/frameworks/osaccount/native:os_account_innerkits",
    "//base/global/i18n_standard/frameworks/intl:intl_util",
    "//base/hiviewdfx/hiview/adapter/utility:hiview_adapter_utility",
    "//foundation/ace/ace_engine/interfaces/innerkits/ui_service_manager:ui_service_mgr",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
    "//foundation/graphic/standard:libwmservice",
    "//foundation/multimedia/image_standard/interfaces/innerkits:image_native",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "bytrace_standard:bytrace_core",
    "ces_standard:cesfwk_core",
    "ces_standard:cesfwk_innerkits",
    "dsoftbus_standard:softbus_client",
    "hicollie_native:libhicollie",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
    "resmgr_standard:global_resmgr",
  ]
}

group("unittest") {
  testonly = true

  deps = [
    "unittest/phone/ability_connect_callback_proxy_test:unittest",
    "unittest/phone/ability_connect_callback_stub_test:unittest",
    "unittest/phone/ability_connect_manage_test:unittest",
    "unittest/phone/ability_dump_test:unittest",
    "unittest/phone/ability_manager_proxy_test:unittest",
    "unittest/phone/ability_manager_service_test:unittest",
    "unittest/phone/ability_manager_stub_test:unittest",
    "unittest/phone/ability_record_test:unittest",
    "unittest/phone/ability_scheduler_proxy_test:unittest",
    "unittest/phone/ability_scheduler_stub_test:unittest",
    "unittest/phone/ability_service_start_test:unittest",
    "unittest/phone/ability_stack_manager_test:unittest",
    "unittest/phone/ability_token_proxy_test:unittest",
    "unittest/phone/ability_token_stub_test:unittest",
    "unittest/phone/ability_with_applications_test:unittest",
    "unittest/phone/abilityms_appms_test:unittest",
    "unittest/phone/app_scheduler_test:unittest",
    "unittest/phone/configuration_test:unittest",
    "unittest/phone/connection_record_test:unittest",
    "unittest/phone/data_ability_manager_test:unittest",
    "unittest/phone/data_ability_record_test:unittest",
    "unittest/phone/info_test:unittest",
    "unittest/phone/kernal_system_app_manager_test:unittest",
    "unittest/phone/lifecycle_deal_test:unittest",
    "unittest/phone/lifecycle_test:unittest",
    "unittest/phone/lock_screen_white_list_test:unittest",
    "unittest/phone/mission_record_test:unittest",
    "unittest/phone/mission_stack_test:unittest",
    "unittest/phone/pending_want_key_test:unittest",
    "unittest/phone/pending_want_manager_test:unittest",
    "unittest/phone/pending_want_record_test:unittest",
    "unittest/phone/resume_mission_container_test:unittest",
    "unittest/phone/screenshot_handler_test:unittest",
    "unittest/phone/sender_info_test:unittest",
    "unittest/phone/terminate_ability_test:unittest",
    "unittest/phone/want_receiver_proxy_test:unittest",
    "unittest/phone/want_receiver_stub_test:unittest",
    "unittest/phone/want_sender_info_test:unittest",
    "unittest/phone/want_sender_proxy_test:unittest",
    "unittest/phone/want_sender_stub_test:unittest",
    "unittest/phone/wants_info_test:unittest",
    "unittest/phone/window_info_test:unittest",
  ]
}
