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

module_output_path = "aafwk_standard/aafwk_L2"

###############################################################################
#1. intent(c++) get/set test without transport

config("module_private_config") {
  visibility = [ ":*" ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  include_dirs = [
    "//third_party/json/include",
    "//utils/native/base/include",
    "//sdk/appexecfwk_L2/appexecfwk_base/include",
    "//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include",
    "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include",
    "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
    "//utils/system/safwk/native/include",
    "//foundation/aafwk/standard/services/common/include",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS",
    "//foundation/aafwk/standard/services/common/include",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility",
    "//foundation/aafwk/standard/services/abilitymgr/include",
    "//third_party/jsoncpp/include",
    "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include",
  ]
}

ohos_moduletest("ability_moduletest") {
  module_out_path = module_output_path
  sources = [
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS/mock_ability_manager_client.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS/mock_ability_manager_service.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility/demo_ability_test.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_connect_callback_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_proxy.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_mission_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_record_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_proxy.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/caller_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/image_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/lifecycle_state_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_description_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_option.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/sender_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/shared_memory.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/stack_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/stack_setting.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/want_sender_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/wants_info.cpp",
    "moduletest/cpp/abilitytest/ability_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:ability_config",
  ]

  deps = [
    "//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "//foundation/appexecfwk/standard/kits:appkit_native",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//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:utils",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "multimodalinput_base:libmmi-client",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
  ]
}

ohos_moduletest("ability_conetxt_test") {
  module_out_path = module_output_path
  sources = [
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS/mock_ability_manager_client.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility/demo_ability_test.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_connect_callback_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_proxy.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_record_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_proxy.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/caller_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/lifecycle_state_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/stack_info.cpp",
    "//foundation/distributedschedule/dmsfwk/utils/native/source/uri.cpp",
    "moduletest/cpp/abilitytest/ability_context_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:ability_config",
  ]

  deps = [
    "//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
    "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "//foundation/appexecfwk/standard/kits:appkit_native",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//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:utils",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "multimodalinput_base:libmmi-client",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
  ]
}

ohos_moduletest("data_ability_operation_moduletest") {
  module_out_path = module_output_path
  sources = [
    "//foundation/aafwk/standard/frameworks/kits/ability/native/src/data_ability_operation.cpp",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/src/data_ability_operation_builder.cpp",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager.cpp",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include/sys_mgr_client_mock.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS/mock_ability_manager_client.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/AMS/mock_ability_manager_service.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility/demo_ability_test.cpp",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility/mock_lifecycle_observer.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_connect_callback_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_proxy.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_mission_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_record_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_proxy.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_stub.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/caller_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/lifecycle_state_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_description_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/sender_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/stack_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/want_sender_info.cpp",
    "//foundation/aafwk/standard/services/abilitymgr/src/wants_info.cpp",
    "moduletest/cpp/abilitytest/data_ability_operation_module_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:ability_config",
  ]

  deps = [
    "//base/global/resmgr_standard/frameworks/resmgr:global_resmgr",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
    "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "//foundation/appexecfwk/standard/kits:appkit_native",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//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:utils",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "multimodalinput_base:libmmi-client",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
  ]
}

ohos_moduletest("data_ability_helper_module_test") {
  module_out_path = module_output_path

  include_dirs = [
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoAbility",
    "//foundation/aafwk/standard/frameworks/kits/test/mock/DemoObServer",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/test/mock/include",
    "//foundation/aafwk/standard/services/dataobsmgr/include",
    "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include",
    "//foundation/distributedschedule/samgr/services/samgr/native/include",
    "//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
  ]

  sources = [ "//foundation/aafwk/standard/frameworks/kits/test/moduletest/cpp/abilitytest/data_ability_helper_module_test.cpp" ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:ability_config",
  ]

  deps = [
    "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
    "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
    "//foundation/appexecfwk/standard/kits:appkit_native",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "multimodalinput_base:libmmi-client",
    "native_appdatamgr:native_appdatafwk",
    "native_appdatamgr:native_dataability",
    "native_appdatamgr:native_rdb",
  ]
}

################################################################################
group("moduletest") {
  testonly = true

  deps = []

  if (is_phone_product) {
    deps += [
      ":ability_conetxt_test",
      ":ability_moduletest",
      ":data_ability_helper_module_test",
      ":data_ability_operation_moduletest",
    ]
  }
}
