1# Copyright (c) 2021-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
18config("module_private_config") {
19  visibility = [ ":*" ]
20  include_dirs = [
21    "${ability_runtime_innerkits_path}/ability_manager/include",
22    "${ability_runtime_innerkits_path}/app_manager/include/appmgr",
23    "${ability_runtime_path}/interfaces/kits/native/ability/native",
24    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper",
25    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include",
26    "${ability_runtime_path}/interfaces/kits/native/appkit/app",
27    "${ability_runtime_path}/interfaces/kits/native/appkit/app/task",
28    "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/aakit/include",
29    "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include",
30    "${ability_runtime_services_path}/abilitymgr/include/utils",
31    "${ability_runtime_services_path}/abilitymgr/include",
32
33    "${ability_runtime_services_path}/common/include",
34    "${distributeddatamgr_path}/distributeddatamgr/interfaces/innerkits/app_distributeddata/include",
35    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
36    "${ability_base_kits_path}/extractortool/include",
37    "${ability_runtime_test_path}/mock/services_appmgr_test/include",
38    "${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
39  ]
40  cflags = []
41  if (target_cpu == "arm") {
42    cflags += [ "-DBINDER_IPC_32BIT" ]
43  }
44  defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ]
45
46  if (ability_runtime_graphics) {
47    include_dirs += [
48      "${global_path}/i18n/frameworks/intl/include",
49      "${form_fwk_path}/interfaces/kits/native/include",
50    ]
51  }
52}
53
54config("module_ability_context_config") {
55  visibility = [ ":*" ]
56  include_dirs = [
57    "${ability_runtime_innerkits_path}/app_manager/include/appmgr",
58    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include",
59    "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include",
60    "${ability_runtime_innerkits_path}/ability_manager/include",
61    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
62    "//third_party/googletest/googlemock/include",
63    "${ability_runtime_path}/interfaces/kits/native/ability/native",
64    "${ability_runtime_path}/interfaces/kits/native/appkit/app",
65    "${multimodalinput_path}/interfaces/native/innerkits/event/include",
66    "//third_party/libuv/include",
67    "${global_path}/resource_management/interfaces/inner_api/include",
68  ]
69  cflags = []
70  if (target_cpu == "arm") {
71    cflags += [ "-DBINDER_IPC_32BIT" ]
72  }
73  defines = [ "AMS_LOG_TAG = \"AbilityUnitTest\"" ]
74}
75
76ohos_unittest("photo_editor_extension_module_loader_test") {
77  sanitize = {
78    cfi = true
79    cfi_cross_dso = true
80    debug = false
81  }
82
83  module_out_path = "ability_runtime/photo_editor_extension"
84
85  sources = [
86    "${ability_runtime_native_path}/ability/native/photo_editor_extension_ability/photo_editor_extension_module_loader.cpp",
87    "photo_editor_extension_module_loader_test.cpp",
88  ]
89
90  cflags = []
91
92  include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability" ]
93
94  if (target_cpu == "arm") {
95    cflags += [ "-DBINDER_IPC_32BIT" ]
96  }
97
98  deps = [
99    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
100    "${ability_runtime_native_path}/ability/native:abilitykit_native",
101    "${ability_runtime_native_path}/ability/native:photo_editor_extension",
102    "${ability_runtime_native_path}/ability/native:ui_extension",
103    "${ability_runtime_native_path}/appkit:app_context",
104    "${ability_runtime_native_path}/appkit:appkit_native",
105    "//third_party/googletest:gmock_main",
106    "//third_party/googletest:gtest_main",
107  ]
108
109  external_deps = [
110    "c_utils:utils",
111    "hilog:libhilog",
112    "napi:ace_napi",
113  ]
114}
115
116ohos_unittest("photo_editor_extension_test") {
117  sanitize = {
118    cfi = true
119    cfi_cross_dso = true
120    debug = false
121  }
122
123  module_out_path = "ability_runtime/photo_editor_extension"
124
125  include_dirs = [
126    "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include",
127    "${ability_runtime_path}/interfaces/kits/native/ability/native/photo_editor_extension_ability",
128  ]
129
130  sources = [ "photo_editor_extension_test.cpp" ]
131
132  configs = [ ":module_private_config" ]
133
134  deps = [
135    "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
136    "${ability_runtime_innerkits_path}/runtime:runtime",
137    "${ability_runtime_native_path}/ability/native:abilitykit_native",
138    "${ability_runtime_native_path}/ability/native:photo_editor_extension",
139    "${ability_runtime_native_path}/ability/native:ui_extension",
140    "${ability_runtime_native_path}/appkit:app_context",
141    "${ability_runtime_native_path}/appkit:appkit_native",
142    "//third_party/googletest:gmock_main",
143    "//third_party/googletest:gtest_main",
144  ]
145
146  external_deps = [
147    "ability_base:base",
148    "ability_base:want",
149    "bundle_framework:appexecfwk_base",
150    "c_utils:utils",
151    "eventhandler:libeventhandler",
152    "hilog:libhilog",
153    "init:libbegetutil",
154    "ipc:ipc_core",
155    "napi:ace_napi",
156  ]
157}
158
159group("unittest") {
160  testonly = true
161  deps = [
162    ":photo_editor_extension_module_loader_test",
163    ":photo_editor_extension_test",
164  ]
165}
166