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/test.gni")
15import("../../../access_token.gni")
16
17if (is_standard_system && ability_base_enable) {
18  ohos_unittest("libipc_code_test") {
19    subsystem_name = "security"
20    part_name = "access_token"
21    module_out_path = part_name + "/" + part_name
22    sanitize = {
23      cfi = true
24      cfi_cross_dso = true
25      debug = false
26    }
27    branch_protector_ret = "pac_ret"
28
29    include_dirs = [
30      "${access_token_path}/frameworks/privacy/include",
31      "${access_token_path}/frameworks/common/include",
32      "${access_token_path}/services/common/ability_manager/include",
33      "${access_token_path}/services/common/app_manager/include",
34      "${access_token_path}/services/privacymanager/src/camera_manager",
35    ]
36
37    sources = [ "unittest/interface_code_test.cpp" ]
38
39    cflags_cc = []
40
41    configs = [ "${access_token_path}/config:coverage_flags" ]
42
43    deps = [
44      "${access_token_path}/frameworks/common:accesstoken_common_cxx",
45      "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx",
46      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
47      "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
48      "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk",
49      "${access_token_path}/interfaces/innerkits/token_setproc:libtokensetproc_shared",
50      "${access_token_path}/services/common:accesstoken_service_common",
51      "${access_token_path}/services/privacymanager:privacy_manager_service",
52    ]
53
54    external_deps = [
55      "ability_base:want",
56      "access_token:libaccesstoken_sdk",
57      "c_utils:utils",
58      "googletest:gtest_main",
59      "hilog:libhilog",
60      "init:libbegetutil",
61      "ipc:ipc_core",
62      "safwk:system_ability_fwk",
63      "samgr:samgr_proxy",
64      "sqlite:sqlite",
65    ]
66
67    if (audio_framework_enable) {
68      cflags_cc += [ "-DAUDIO_FRAMEWORK_ENABLE" ]
69      external_deps += [ "audio_framework:audio_client" ]
70    }
71
72    if (ability_runtime_enable) {
73      cflags_cc += [ "-DABILITY_RUNTIME_ENABLE" ]
74      external_deps += [
75        "ability_runtime:ability_manager",
76        "ability_runtime:app_manager",
77      ]
78    }
79    if (camera_framework_enable) {
80      cflags_cc += [ "-DCAMERA_FRAMEWORK_ENABLE" ]
81      external_deps += [ "camera_framework:camera_framework" ]
82    }
83  }
84}
85
86group("unittest") {
87  testonly = true
88  deps = [ ":libipc_code_test" ]
89}
90