• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-2025 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/test.gni")
15import("//foundation/ability/ability_runtime/ability_runtime.gni")
16
17module_output_path = "ability_runtime/ability_runtime/abilitymgr"
18
19ohos_unittest("uri_permission_impl_test") {
20  module_out_path = module_output_path
21  sanitize = {
22    cfi = true
23    cfi_cross_dso = true
24    debug = false
25    blocklist = "../../cfi_blocklist.txt"
26  }
27  branch_protector_ret = "pac_ret"
28  include_dirs = [
29    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper",
30    "${ability_runtime_test_path}/mock/common/include",
31    "${ability_runtime_test_path}/mock/services_appmgr_test/include/",
32    "mock/include",
33  ]
34
35  sources = [
36    "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp",
37    "mock/src/mock_ability_manager_client.cpp",
38    "mock/src/mock_accesstoken_kit.cpp",
39    "mock/src/mock_app_utils.cpp",
40    "mock/src/mock_bundle_mgr_helper.cpp",
41    "mock/src/mock_iability_manager_collaborator.cpp",
42    "mock/src/mock_ipc_skeleton.cpp",
43    "mock/src/mock_my_flag.cpp",
44    "mock/src/mock_permission_verification.cpp",
45    "mock/src/mock_sandbox_manager.cpp",
46    "mock/src/mock_udmf_utils.cpp",
47    "mock/src/mock_uri_permission_utils.cpp",
48    "batch_uri_test.cpp",
49    "uri_permission_impl_test.cpp",
50  ]
51
52  configs = [
53    "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config",
54    "${ability_runtime_innerkits_path}/uri_permission:uripermkit_public_config",
55  ]
56
57  deps = [
58    "${ability_runtime_innerkits_path}/app_manager:app_manager",
59    "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
60    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
61    "${ability_runtime_services_path}/common:event_report",
62    "${ability_runtime_services_path}/uripermmgr:libupms_static",
63  ]
64
65  external_deps = [
66    "ability_base:configuration",
67    "ability_base:zuri",
68    "access_token:libnativetoken",
69    "access_token:libtoken_setproc",
70    "access_token:libtokenid_sdk",
71    "app_file_service:fileuri_native",
72    "bundle_framework:appexecfwk_base",
73    "bundle_framework:appexecfwk_core",
74    "cJSON:cjson",
75    "c_utils:utils",
76    "googletest:gmock_main",
77    "googletest:gtest_main",
78    "hilog:libhilog",
79    "hisysevent:libhisysevent",
80    "init:libbeget_proxy",
81    "init:libbegetutil",
82    "selinux_adapter:librestorecon",
83    "storage_service:storage_manager_sa_proxy",
84  ]
85  if (ability_runtime_feature_sandboxmanager) {
86    external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ]
87    defines = [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ]
88  }
89  cflags_cc = []
90  if (os_dlp_part_enabled) {
91    cflags_cc += [ "-DWITH_DLP" ]
92  }
93}
94
95ohos_unittest("uri_permission_manager_stub_impl_test") {
96  module_out_path = module_output_path
97  sanitize = {
98    cfi = true
99    cfi_cross_dso = true
100    debug = false
101    blocklist = "../../cfi_blocklist.txt"
102  }
103  branch_protector_ret = "pac_ret"
104  include_dirs = [
105    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper",
106    "${ability_runtime_test_path}/mock/common/include",
107    "${ability_runtime_test_path}/mock/services_appmgr_test/include/",
108    "mock/include",
109  ]
110
111  sources = [
112    "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp",
113    "mock/src/mock_ability_manager_client.cpp",
114    "mock/src/mock_my_flag.cpp",
115    "mock/src/mock_uri_permission_utils.cpp",
116    "mock/src/mock_iability_manager_collaborator.cpp",
117    "uri_permission_manager_stub_impl_test.cpp",
118  ]
119
120  configs = [
121    "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config",
122    "${ability_runtime_innerkits_path}/uri_permission:uripermkit_public_config",
123  ]
124
125  deps = [
126    "${ability_runtime_innerkits_path}/app_manager:app_manager",
127    "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper",
128    "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
129    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
130    "${ability_runtime_services_path}/common:app_util",
131    "${ability_runtime_services_path}/common:event_report",
132    "${ability_runtime_services_path}/common:perm_verification",
133    "${ability_runtime_services_path}/uripermmgr:libupms_static",
134  ]
135
136  external_deps = [
137    "ability_base:configuration",
138    "ability_base:want",
139    "ability_base:zuri",
140    "access_token:libaccesstoken_sdk",
141    "access_token:libnativetoken",
142    "access_token:libtoken_setproc",
143    "access_token:libtokenid_sdk",
144    "app_file_service:fileuri_native",
145    "background_task_mgr:bgtaskmgr_innerkits",
146    "bundle_framework:appexecfwk_base",
147    "bundle_framework:appexecfwk_core",
148    "cJSON:cjson",
149    "c_utils:utils",
150    "common_event_service:cesfwk_core",
151    "common_event_service:cesfwk_innerkits",
152    "data_share:datashare_consumer",
153    "eventhandler:libeventhandler",
154    "googletest:gmock_main",
155    "googletest:gtest_main",
156    "graphic_2d:color_manager",
157    "hilog:libhilog",
158    "hisysevent:libhisysevent",
159    "hitrace:hitrace_meter",
160    "init:libbeget_proxy",
161    "init:libbegetutil",
162    "ipc:ipc_core",
163    "relational_store:native_dataability",
164    "relational_store:native_rdb",
165    "safwk:system_ability_fwk",
166    "samgr:samgr_proxy",
167    "selinux_adapter:librestorecon",
168    "storage_service:storage_manager_sa_proxy",
169  ]
170  if (ability_runtime_feature_sandboxmanager) {
171    external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ]
172    defines = [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ]
173  }
174  cflags_cc = []
175  if (os_dlp_part_enabled) {
176    cflags_cc += [ "-DWITH_DLP" ]
177  }
178}
179
180ohos_unittest("upms_udmf_utils_test") {
181  module_out_path = module_output_path
182  sanitize = {
183    cfi = true
184    cfi_cross_dso = true
185    debug = false
186    blocklist = "../../cfi_blocklist.txt"
187  }
188  branch_protector_ret = "pac_ret"
189  include_dirs = [
190    "mock/include",
191  ]
192
193  sources = [
194    "${ability_runtime_services_path}/uripermmgr/src/upms_udmf_utils.cpp",
195    "mock/src/mock_my_flag.cpp",
196    "mock/src/mock_uri_permission_utils.cpp",
197    "mock/src/udmf_client.cpp",
198    "udmf_utils_test.cpp",
199  ]
200
201  configs = [
202    "${ability_runtime_services_path}/common:common_config",
203    "${ability_runtime_services_path}/uripermmgr:upms_config",
204  ]
205
206  deps = []
207
208  external_deps = [
209    "ability_base:zuri",
210    "access_token:libaccesstoken_sdk",
211    "access_token:libnativetoken",
212    "access_token:libtoken_setproc",
213    "access_token:libtokenid_sdk",
214    "c_utils:utils",
215    "googletest:gmock_main",
216    "googletest:gtest_main",
217    "hilog:libhilog",
218    "hitrace:hitrace_meter",
219    "ipc:ipc_core",
220  ]
221  cflags_cc = []
222}
223
224group("unittest") {
225  testonly = true
226
227  deps = [
228    ":uri_permission_impl_test",
229    ":uri_permission_manager_stub_impl_test",
230    ":upms_udmf_utils_test",
231  ]
232}
233