# Copyright (c) 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/aafwk/standard/aafwk.gni")

module_output_path = "ability_runtime/mstabilitymgrservice"

ohos_moduletest("on_new_want_module_test") {
  module_out_path = module_output_path
  cflags_cc = []
  include_dirs = [
    "${services_path}/test/mock/include",
    "//third_party/jsoncpp/include",
    "${aafwk_path}/frameworks/kits/ability/native/include/distributed_ability_runtime",
    "${aafwk_path}/interfaces/innerkits/dataobs_manager/include",
    "//base/hiviewdfx/hicollie/interfaces/native/innerkits/include/xcollie",
  ]

  sources = [ "on_new_want_module_test.cpp" ]
  sources += [
    "${aafwk_path}/services/abilitymgr/src/ability_manager_service.cpp",
    "${aafwk_path}/services/abilitymgr/src/mission_list.cpp",
    "${aafwk_path}/services/abilitymgr/src/mission_list_manager.cpp",
    "${aafwk_path}/services/common/src/permission_verification.cpp",
    "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp",
  ]

  configs = [
    "${services_path}/test:aafwk_module_test_config",
    "${aafwk_path}/interfaces/innerkits/ability_manager:ability_manager_public_config",
    "${aafwk_path}/services/abilitymgr/test/mock/libs/sa_mgr:sa_mgr_mock_config",
    "${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base_sdk_config",
    "${aafwk_path}/interfaces/innerkits/app_manager:appmgr_sdk_config",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  deps = [
    "${aafwk_path}/frameworks/kits/ability/native:abilitykit_native",
    "${aafwk_path}/interfaces/innerkits/app_manager:app_manager",
    "${aafwk_path}/services/abilitymgr:abilityms",
    "${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base",
    "${bundlefwk_inner_api_path}/appexecfwk_core:appexecfwk_core",
    "${bundlefwk_innerkits_path}/libeventhandler:libeventhandler",
    "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "${innerkits_path}/uri_permission:uri_permission_mgr",
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
    "//third_party/jsoncpp:jsoncpp",
    "//utils/native/base:utils",
  ]

  if (os_account_part_enabled) {
    cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ]
    deps += [ "//base/account/os_account/frameworks/osaccount/native:os_account_innerkits" ]
  }

  if (ability_runtime_graphics) {
    deps += [
      "${global_path}/i18n/frameworks/intl:intl_util",
      "${multimedia_path}/interfaces/innerkits:image_native",
      "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
      "//third_party/libpng:libpng",
    ]
  }

  external_deps = [
    "ability_base:want",
    "ability_base:zuri",
    "access_token:libaccesstoken_sdk",
    "common_event_service:cesfwk_core",
    "common_event_service:cesfwk_innerkits",
    "dataability:native_dataability",
    "dsoftbus_standard:softbus_client",
    "hicollie_native:libhicollie",
    "hisysevent_native:libhisysevent",
    "hitrace_native:hitrace_meter",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "relational_store:native_appdatafwk",
    "relational_store:native_rdb",
  ]

  if (ability_runtime_graphics) {
    external_deps += [ "window_manager:libdm" ]
  }
}

group("moduletest") {
  testonly = true

  deps = [ ":on_new_want_module_test" ]
}
