# Copyright (c) Huawei Device Co., Ltd. 2026-2026. All rights reserved.
# 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.
# Description: oe service test build.gn file

import("//build/test.gni")
import("//foundation/officeservice/object_editor/object_editor.gni")

module_out_path = "object_editor/object_editor"

config("system_ability_unittest_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "include",
    "${object_editor_path}/system_ability/include",
    "${object_editor_path}/common/include",
    "${innerkits_path}/include",
    "${kits_path}/c",
    "${object_editor_path}/document/include",
    "${object_editor_path}/database/include",
    "${object_editor_path}/client/include",
    "${object_editor_path}/extension_ability/include",
    "${object_editor_path}/frameworks/kits/extension/include",
    "${object_editor_path}/frameworks/ndk/include",
    "${object_editor_path}/utils/include",
    "${object_editor_path}/utils/include/dfx",
    "${object_editor_path}/test/mock/",
    "${object_editor_path}/test/mock/message_parcel",
    "${object_editor_path}/test/mock/ability_manager_client",
  ]
}

ohos_unittest("object_editor_manager_stub_test") {
  module_out_path = module_out_path
  sources = [
    "object_editor_manager_stub_test.cpp",
    "${object_editor_path}/test/mock/message_parcel/mock_message_parcel.cpp",
  ]
  configs = [
    ":system_ability_unittest_config",
    "${object_editor_path}/resources/config/build:coverage_flags",
    "${object_editor_path}/resources/config/build:testcase_flags",
  ]
  deps = [
    "${object_editor_path}/client:content_embed_client",
    "${object_editor_path}/system_ability:content_embed_service",
  ]
  external_deps = [
    "c_utils:utils",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "hilog:libhilog",
    "relational_store:native_rdb",
    "ability_runtime:uri_permission_mgr",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:app_context",
    "ability_base:zuri",
    "ability_base:want",
    "ability_runtime:wantagent_innerkits",
    "os_account:os_account_innerkits",
    "cJSON:cjson",
    "bundle_framework:appexecfwk_core",
    "bundle_framework:bundle_napi_common",
    "napi:ace_napi",
    "udmf:utd_client",
    "app_file_service:fileuri_native",
    "image_framework:image_native",
    "resource_management:global_resmgr",
    "access_token:libaccesstoken_sdk",
    "common_event_service:cesfwk_innerkits",
    "hisysevent:libhisysevent",
    "googletest:gmock",
  ]
  part_name = "object_editor"
  subsystem_name = "officeservice"
}

ohos_unittest("object_editor_manager_system_ability_test") {
  module_out_path = module_out_path

  sources = [
    "object_editor_manager_system_ability_test.cpp",
  ]

  deps = [
    "${object_editor_path}/system_ability:content_embed_service",
    "${object_editor_path}/document:content_embed_document",
    "${object_editor_path}/utils:content_embed_utils",
  ]

  configs = [
    ":system_ability_unittest_config",
    "${object_editor_path}/resources/config/build:coverage_flags",
    "${object_editor_path}/resources/config/build:testcase_flags",
  ]

  external_deps = [
    "c_utils:utils",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "hilog:libhilog",
    "relational_store:native_rdb",
    "ability_runtime:uri_permission_mgr",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:app_context",
    "ability_base:zuri",
    "ability_base:want",
    "ability_runtime:wantagent_innerkits",
    "os_account:os_account_innerkits",
    "cJSON:cjson",
    "bundle_framework:appexecfwk_core",
    "bundle_framework:bundle_napi_common",
    "napi:ace_napi",
    "udmf:utd_client",
    "app_file_service:fileuri_native",
    "image_framework:image_native",
    "resource_management:global_resmgr",
    "access_token:libaccesstoken_sdk",
    "common_event_service:cesfwk_innerkits",
    "hisysevent:libhisysevent",
    "googletest:gmock",
  ]

  defines = [
    "private=public",
  ]

  part_name = "object_editor"
  subsystem_name = "officeservice"
}

ohos_unittest("object_editor_connection_test") {
  module_out_path = module_out_path

  sources = [
    "object_editor_connection_test.cpp",
  ]

  deps = [
    "${object_editor_path}/system_ability:content_embed_service",
    "${object_editor_path}/document:content_embed_document",
    "${object_editor_path}/utils:content_embed_utils",
  ]

  configs = [
    ":system_ability_unittest_config",
    "${object_editor_path}/resources/config/build:coverage_flags",
    "${object_editor_path}/resources/config/build:testcase_flags",
  ]

  external_deps = [
    "c_utils:utils",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "hilog:libhilog",
    "relational_store:native_rdb",
    "ability_runtime:uri_permission_mgr",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:app_context",
    "ability_base:zuri",
    "ability_base:want",
    "ability_runtime:wantagent_innerkits",
    "os_account:os_account_innerkits",
    "cJSON:cjson",
    "bundle_framework:appexecfwk_core",
    "bundle_framework:bundle_napi_common",
    "napi:ace_napi",
    "udmf:utd_client",
    "app_file_service:fileuri_native",
    "image_framework:image_native",
    "resource_management:global_resmgr",
    "access_token:libaccesstoken_sdk",
    "common_event_service:cesfwk_innerkits",
    "hisysevent:libhisysevent",
    "googletest:gmock",
  ]

  defines = [
    "private=public",
  ]

  part_name = "object_editor"
  subsystem_name = "officeservice"
}

ohos_unittest("object_editor_client_death_recipient_test") {
  module_out_path = module_out_path

  sources = [
    "object_editor_client_death_recipient_test.cpp",
  ]

  deps = [
    "${object_editor_path}/system_ability:content_embed_service",
    "${object_editor_path}/document:content_embed_document",
  ]

  configs = [
    ":system_ability_unittest_config",
    "${object_editor_path}/resources/config/build:coverage_flags",
    "${object_editor_path}/resources/config/build:testcase_flags",
  ]

  external_deps = [
    "c_utils:utils",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
    "hilog:libhilog",
    "relational_store:native_rdb",
    "ability_runtime:uri_permission_mgr",
    "ability_runtime:ability_connect_callback_stub",
    "ability_runtime:ability_manager",
    "ability_runtime:app_context",
    "ability_base:zuri",
    "ability_base:want",
    "ability_runtime:wantagent_innerkits",
    "os_account:os_account_innerkits",
    "cJSON:cjson",
    "bundle_framework:appexecfwk_core",
    "bundle_framework:bundle_napi_common",
    "napi:ace_napi",
    "udmf:utd_client",
    "app_file_service:fileuri_native",
    "image_framework:image_native",
    "resource_management:global_resmgr",
    "access_token:libaccesstoken_sdk",
    "common_event_service:cesfwk_innerkits",
    "hisysevent:libhisysevent",
    "googletest:gmock",
  ]

  defines = [
    "private=public",
  ]

  part_name = "object_editor"
  subsystem_name = "officeservice"
}

group("system_ability_unittest") {
  testonly = true

  deps = [
    ":object_editor_manager_system_ability_test",
    ":object_editor_manager_stub_test",
    ":object_editor_connection_test",
    ":object_editor_client_death_recipient_test",
  ]
}