# 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 = "ability_runtime/appmgrservice"
ohos_unittest("AmsRecentAppListTest") {
  module_out_path = module_output_path

  include_dirs = [
    "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include/",
    "//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include/",
    "//base/account/os_account/frameworks/common/database/include",
    "//base/account/os_account/frameworks/common/account_error/include",
  ]

  sources = [
    "${services_path}/appmgr/src/ability_running_record.cpp",
    "${services_path}/appmgr/src/app_lifecycle_deal.cpp",
    "${services_path}/appmgr/src/app_mgr_service_inner.cpp",
    "${services_path}/appmgr/src/app_process_manager.cpp",
    "${services_path}/appmgr/src/app_running_manager.cpp",
    "${services_path}/appmgr/src/app_running_record.cpp",
    "${services_path}/appmgr/src/app_spawn_client.cpp",
    "${services_path}/appmgr/src/app_spawn_msg_wrapper.cpp",
    "${services_path}/appmgr/src/app_spawn_socket.cpp",
    "${services_path}/appmgr/src/cgroup_manager.cpp",
    "${services_path}/appmgr/src/lmks_client.cpp",
    "${services_path}/appmgr/src/module_running_record.cpp",
    "${services_path}/appmgr/src/process_optimizer.cpp",
    "${services_path}/appmgr/src/process_optimizer_uba.cpp",
    "${services_path}/appmgr/src/remote_client_manager.cpp",
    "${services_path}/appmgr/test/mock/src/mock_bundle_manager.cpp",
  ]

  sources += [ "ams_recent_app_list_test.cpp" ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  configs = [ "${appexecfwk_path}/libs/libeventhandler:libeventhandler_config" ]

  deps = [
    "${appexecfwk_path}/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "${appexecfwk_path}/libs/libeventhandler:libeventhandler_target",
    "${services_path}/appmgr/test:appmgr_test_source",
    "//base/account/os_account/frameworks/osaccount/native:os_account_innerkits",
    "//foundation/aafwk/standard/interfaces/innerkits/app_manager:app_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/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk",
  ]

  external_deps = [
    "appspawn:appspawn_socket_client",
    "bytrace_standard:bytrace_core",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]
}

group("unittest") {
  testonly = true

  deps = [ ":AmsRecentAppListTest" ]
}
