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