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:configuration_helper",
61    "${ability_runtime_native_path}/ability/native:insight_intent_executor",
62    "${ability_runtime_native_path}/ability/native:uiabilitykit_native",
63    "${ability_runtime_native_path}/appkit:app_context",
64    "${ability_runtime_native_path}/appkit:appkit_delegator",
65    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
66    "${ability_runtime_native_path}/appkit:appkit_native",
67    "${ability_runtime_native_path}/insight_intent/insight_intent_context:insightintentcontext",
68    "${ability_runtime_path}/utils/global/freeze:freeze_util",
69    "${ability_runtime_services_path}/common:event_report",
70    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
71    "${global_path}/resource_management/frameworks/resmgr:global_resmgr",
72    "//third_party/googletest:gmock_main",
73    "//third_party/googletest:gtest_main",
74  ]
75
76  external_deps = [
77    "ability_base:base",
78    "ability_base:configuration",
79    "ability_base:session_info",
80    "ability_base:want",
81    "ability_runtime:ability_context_native",
82    "ability_runtime:runtime",
83    "ability_runtime:wantagent_innerkits",
84    "bundle_framework:appexecfwk_base",
85    "bundle_framework:appexecfwk_core",
86    "c_utils:utils",
87    "common_event_service:cesfwk_innerkits",
88    "eventhandler:libeventhandler",
89    "ffrt:libffrt",
90    "hilog:libhilog",
91    "hitrace:hitrace_meter",
92    "init:libbegetutil",
93    "ipc:ipc_core",
94    "napi:ace_napi",
95    "napi:cj_bind_ffi",
96    "napi:cj_bind_native",
97    "window_manager:cj_window_ffi",
98    "window_manager:scene_session",
99  ]
100
101  if (ability_runtime_graphics) {
102    external_deps += [
103      "image_framework:image_native",
104      "input:libmmi-client",
105      "window_manager:libwm",
106    ]
107  }
108
109  defines = [ "CONFIG_HILOG" ]
110}
111
112group("unittest") {
113  testonly = true
114  deps = [ ":cj_ui_ability_test" ]
115}
116