1# Copyright (c) 2023-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("../../../../security_component.gni")
16
17sec_comp_root_dir = "../../../.."
18
19ohos_unittest("sec_comp_sdk_test") {
20  subsystem_name = "security"
21  part_name = "security_component_manager"
22  module_out_path = part_name + "/" + part_name
23
24  include_dirs = [
25    "${sec_comp_root_dir}/frameworks/common/include",
26    "${sec_comp_root_dir}/frameworks/security_component/include",
27    "${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
28  ]
29
30  sources = [
31    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_caller_authorization.cpp",
32    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_client.cpp",
33    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_death_recipient.cpp",
34    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_dialog_callback.cpp",
35    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_dialog_callback_stub.cpp",
36    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_kit.cpp",
37    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_load_callback.cpp",
38    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_proxy.cpp",
39    "${sec_comp_root_dir}/interfaces/inner_api/security_component/src/sec_comp_ui_register.cpp",
40    "unittest/src/location_button_test.cpp",
41    "unittest/src/paste_button_test.cpp",
42    "unittest/src/save_button_test.cpp",
43    "unittest/src/sec_comp_kit_test.cpp",
44    "unittest/src/test_common.cpp",
45  ]
46  configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
47  cflags_cc = [ "-DHILOG_ENABLE" ]
48
49  if (security_component_enhance_enable) {
50    cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ]
51  }
52
53  deps = [
54    "${sec_comp_root_dir}/frameworks:security_component_no_cfi_enhance_adapter_src_set",
55    "${sec_comp_root_dir}/frameworks:security_component_no_cfi_framework_src_set",
56    "${sec_comp_root_dir}/interfaces/inner_api/enhance_kits:security_component_no_cfi_enhance_sdk_src_set",
57  ]
58
59  external_deps = [
60    "access_token:libaccesstoken_sdk",
61    "bundle_framework:appexecfwk_core",
62    "c_utils:utils",
63    "hilog:libhilog",
64    "hisysevent:libhisysevent",
65    "ipc:ipc_core",
66    "samgr:samgr_proxy",
67  ]
68}
69
70ohos_unittest("sec_comp_register_callback_test") {
71  subsystem_name = "security"
72  part_name = "security_component_manager"
73  module_out_path = part_name + "/" + part_name
74
75  include_dirs = [
76    "${sec_comp_root_dir}/frameworks/common/include",
77    "${sec_comp_root_dir}/frameworks/security_component/include",
78    "${sec_comp_root_dir}/interfaces/inner_api/security_component/include",
79  ]
80
81  sources = [
82    "unittest/src/sec_comp_register_callback_test.cpp",
83    "unittest/src/test_common.cpp",
84  ]
85  configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
86  cflags_cc = [
87    "-DHILOG_ENABLE",
88    "-O0",
89  ]
90
91  if (security_component_enhance_enable) {
92    cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ]
93  }
94
95  deps = [ "${sec_comp_root_dir}/interfaces/inner_api/security_component:libsecurity_component_sdk" ]
96
97  external_deps = [
98    "access_token:libaccesstoken_sdk",
99    "access_token:libtoken_setproc",
100    "bundle_framework:appexecfwk_core",
101    "c_utils:utils",
102    "hilog:libhilog",
103    "hisysevent:libhisysevent",
104    "ipc:ipc_core",
105    "samgr:samgr_proxy",
106  ]
107}
108
109group("unittest") {
110  testonly = true
111  deps = [
112    ":sec_comp_register_callback_test",
113    ":sec_comp_sdk_test",
114  ]
115}
116