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("file_permission_manager_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 = [ "file_permission_manager_test.cpp" ]
38
39  configs = [
40    ":coverage_flags",
41    "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config",
42  ]
43  cflags = []
44  if (target_cpu == "arm") {
45    cflags += [ "-DBINDER_IPC_32BIT" ]
46  }
47  deps = [
48    "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
49    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
50    "${ability_runtime_services_path}/common:event_report",
51    "${ability_runtime_services_path}/uripermmgr:libupms_static",
52    "//third_party/googletest:gtest_main",
53  ]
54
55  external_deps = [
56    "ability_base:base",
57    "ability_base:want",
58    "bundle_framework:appexecfwk_base",
59    "c_utils:utils",
60    "eventhandler:libeventhandler",
61    "hilog:libhilog",
62    "init:libbegetutil",
63    "ipc:ipc_core",
64    "napi:ace_napi",
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 = [ ":file_permission_manager_test" ]
79}
80