# 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")

module_output_path = "aafwk_standard/mstabilitymgrservice"
EVENT_DIR = "//base/notification/ces_standard"

ohos_moduletest("AbilityRecordModuleTest") {
  module_out_path = module_output_path

  include_dirs = [
    "${EVENT_DIR}/frameworks/core/include",
    "${EVENT_DIR}/interfaces/innerkits/native/include",
    "//third_party/jsoncpp/include",
    "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include",
  ]

  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_token_stub.cpp",
    "${services_path}/abilitymgr/src/app_scheduler.cpp",
    "${services_path}/abilitymgr/src/caller_info.cpp",
    "${services_path}/abilitymgr/src/connection_record.cpp",
    "${services_path}/abilitymgr/src/data_ability_manager.cpp",
    "${services_path}/abilitymgr/src/data_ability_record.cpp",
    "${services_path}/abilitymgr/src/kernal_system_app_manager.cpp",
    "${services_path}/abilitymgr/src/lifecycle_deal.cpp",
    "${services_path}/abilitymgr/src/lifecycle_state_info.cpp",
    "${services_path}/abilitymgr/src/mission_description_info.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_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/sa_mgr_client.cpp",
    "${services_path}/abilitymgr/src/sender_info.cpp",
    "${services_path}/abilitymgr/src/stack_info.cpp",
    "${services_path}/abilitymgr/src/want_receiver_stub.cpp",
    "${services_path}/abilitymgr/src/want_sender_info.cpp",
    "${services_path}/abilitymgr/src/want_sender_stub.cpp",
    "${services_path}/abilitymgr/src/wants_info.cpp",
    "//foundation/aafwk/standard/services/test/mock/src/mock_app_mgr_client.cpp",
  ]

  sources += [ "ability_record_module_test.cpp" ]

  configs = [
    "${services_path}/test:aafwk_module_test_config",
    "//foundation/appexecfwk/standard/common:appexecfwk_common_config",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core_config",
    "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:public_libeventhandler_config",
    "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  deps = [
    "${innerkits_path}/want:want",
    "//base/global/i18n_standard/frameworks/intl:intl_util",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
    "//foundation/aafwk/standard/services/abilitymgr:abilityms",
    "//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/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk",
    "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
    "//third_party/jsoncpp:jsoncpp",
    "//utils/native/base:utilsbase",
  ]

  external_deps = [
    "ces_standard:cesfwk_core",
    "ces_standard:cesfwk_innerkits",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
  ]
}

group("moduletest") {
  testonly = true

  deps = [ ":AbilityRecordModuleTest" ]
}
