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
18module_output_path = "ability_runtime/uripermmgr"
19config("coverage_flags") {
20  if (ability_runtime_feature_coverage) {
21    cflags = [ "--coverage" ]
22    ldflags = [ "--coverage" ]
23  }
24}
25
26ohos_unittest("uri_perm_mgr_test") {
27  module_out_path = module_output_path
28  sanitize = {
29    cfi = true
30    cfi_cross_dso = true
31    debug = false
32    blocklist = "../../cfi_blocklist.txt"
33  }
34  branch_protector_ret = "pac_ret"
35  include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ]
36
37  sources = [
38    "tokenid_permission_test.cpp",
39    "uri_permission_manager_service_test.cpp",
40  ]
41
42  configs = [
43    ":coverage_flags",
44    "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config",
45  ]
46  cflags = []
47  if (target_cpu == "arm") {
48    cflags += [ "-DBINDER_IPC_32BIT" ]
49  }
50  deps = [
51    "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
52    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
53    "${ability_runtime_services_path}/common:event_report",
54    "${ability_runtime_services_path}/uripermmgr:libupms_static",
55    "//third_party/googletest:gtest_main",
56  ]
57
58  external_deps = [
59    "ability_base:configuration",
60    "access_token:libtokenid_sdk",
61    "bundle_framework:appexecfwk_base",
62    "bundle_framework:appexecfwk_core",
63    "hilog:libhilog",
64    "storage_service:storage_manager_sa_proxy",
65  ]
66  if (background_task_mgr_continuous_task_enable) {
67    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
68  }
69  if (ability_runtime_feature_sandboxmanager) {
70    external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ]
71    defines = [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ]
72  }
73}
74
75group("unittest") {
76  testonly = true
77
78  deps = [ ":uri_perm_mgr_test" ]
79}
80