1# Copyright (c) 2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/test.gni")
16import("//foundation/ability/ability_runtime/ability_runtime.gni")
17
18ohos_unittest("cj_ui_ability_test") {
19  module_out_path = "ability_runtime/cj_ui_ability_test"
20  include_dirs = [
21    "${ability_runtime_test_path}/mock/common/include",
22    "${resource_management_path}/frameworks/resmgr/include",
23    "${ability_runtime_path}/utils/global/freeze",
24    "${ability_runtime_path}/utils/global/freeze/include/freeze_util.h",
25    "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_runtime",
26    "${ability_base_kits_path}/configuration/include",
27    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/app",
28    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
29    "${ability_runtime_path}/interfaces/kits/native/ability/native",
30    "${ability_runtime_path}/interfaces/inner_api/runtime/include",
31    "${ability_runtime_native_path}/runtime",
32    "${ability_runtime_path}/cj_environment/interfaces/inner_api",
33  ]
34
35  configs = [ "${c_utils_base_path}:utils_config" ]
36  cflags = []
37  if (target_cpu == "arm") {
38    cflags += [ "-DBINDER_IPC_32BIT" ]
39  }
40
41  sources = [
42    "${ability_runtime_native_path}/appkit/app/ability_record_mgr.cpp",
43    "${ability_runtime_native_path}/appkit/app/app_context.cpp",
44    "${ability_runtime_native_path}/appkit/app/app_loader.cpp",
45    "${ability_runtime_native_path}/appkit/app/application_cleaner.cpp",
46    "${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
47    "cj_ui_ability_test.cpp",
48    "mock_lifecycle_observer.cpp",
49    "mock_lifecycle_observer.h",
50  ]
51
52  deps = [
53    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
54    "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting",
55    "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper",
56    "${ability_runtime_innerkits_path}/runtime:runtime",
57    "${ability_runtime_native_path}/ability:ability_context_native",
58    "${ability_runtime_native_path}/ability/native:ability_thread",
59    "${ability_runtime_native_path}/ability/native:abilitykit_native",
60    "${ability_runtime_native_path}/ability/native:insight_intent_executor",
61    "${ability_runtime_native_path}/ability/native:uiabilitykit_native",
62    "${ability_runtime_native_path}/appkit:app_context",
63    "${ability_runtime_native_path}/appkit:appkit_delegator",
64    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
65    "${ability_runtime_native_path}/appkit:appkit_native",
66    "${ability_runtime_native_path}/insight_intent/insight_intent_context:insightintentcontext",
67    "${ability_runtime_path}/utils/global/freeze:freeze_util",
68    "${ability_runtime_services_path}/common:event_report",
69    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
70    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
71    "//third_party/googletest:gmock_main",
72    "//third_party/googletest:gtest_main",
73  ]
74
75  external_deps = [
76    "ability_base:base",
77    "ability_base:configuration",
78    "ability_base:session_info",
79    "ability_base:want",
80    "ability_runtime:ability_context_native",
81    "ability_runtime:runtime",
82    "ability_runtime:wantagent_innerkits",
83    "bundle_framework:appexecfwk_base",
84    "bundle_framework:appexecfwk_core",
85    "c_utils:utils",
86    "common_event_service:cesfwk_innerkits",
87    "eventhandler:libeventhandler",
88    "ffrt:libffrt",
89    "hilog:libhilog",
90    "hitrace:hitrace_meter",
91    "init:libbegetutil",
92    "ipc:ipc_core",
93    "napi:ace_napi",
94    "napi:cj_bind_ffi",
95    "napi:cj_bind_native",
96    "window_manager:cj_window_ffi",
97    "window_manager:scene_session",
98  ]
99
100  if (ability_runtime_graphics) {
101    external_deps += [
102      "image_framework:image_native",
103      "input:libmmi-client",
104      "window_manager:libwm",
105    ]
106  }
107
108  defines = [ "CONFIG_HILOG" ]
109}
110
111group("unittest") {
112  testonly = true
113  deps = [ ":cj_ui_ability_test" ]
114}
115