• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024-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("../../../access_token.gni")
16
17if (is_standard_system && ability_base_enable == true) {
18  ohos_unittest("el5_filekey_manager_service_mock_unittest") {
19    subsystem_name = "accesscontrol"
20    part_name = "access_token"
21    module_out_path = "access_token/el5_filekey_manager"
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      "../include",
31      "mock/include",
32      "include",
33      "common/include",
34      "${access_token_path}/frameworks/inner_api/el5filekeymanager/include/",
35    ]
36
37    sources = [
38      "../src/el5_filekey_manager_service.cpp",
39      "../src/el5_memory_manager.cpp",
40      "common/src/el5_test_common.cpp",
41      "mock/src/mock_ipc.cpp",
42      "src/el5_filekey_manager_service_mock_unittest.cpp",
43    ]
44
45    configs = [ "${access_token_path}/config:coverage_flags" ]
46
47    deps = [
48      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_sdk",
49      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_stub",
50      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
51      "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
52      "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
53    ]
54
55    external_deps = [
56      "ability_base:want",
57      "c_utils:utils",
58      "hilog:libhilog",
59      "ipc:ipc_single",
60      "safwk:system_ability_fwk",
61      "samgr:samgr_proxy",
62    ]
63
64    cflags_cc = [
65      "-DHILOG_ENABLE",
66      "-DDEBUG_API_PERFORMANCE",
67    ]
68
69    if (common_event_service_enable) {
70      cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ]
71      external_deps += [ "common_event_service:cesfwk_innerkits" ]
72      sources += [ "../src/el5_filekey_manager_subscriber.cpp" ]
73    }
74
75    if (eventhandler_enable == true) {
76      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
77      external_deps += [ "eventhandler:libeventhandler" ]
78    }
79
80    if (theme_screenlock_mgr_enable) {
81      cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ]
82      external_deps += [ "screenlock_mgr:screenlock_client" ]
83    }
84  }
85
86  ohos_unittest("el5_filekey_manager_service_unittest") {
87    subsystem_name = "accesscontrol"
88    part_name = "access_token"
89    module_out_path = "access_token/el5_filekey_manager"
90    sanitize = {
91      cfi = true
92      cfi_cross_dso = true
93      debug = false
94    }
95    branch_protector_ret = "pac_ret"
96
97    include_dirs = [
98      "../include",
99      "include",
100      "${access_token_path}/frameworks/inner_api/el5filekeymanager/include/",
101    ]
102
103    sources = [
104      "../src/el5_filekey_manager_service.cpp",
105      "../src/el5_memory_manager.cpp",
106      "src/el5_filekey_manager_service_unittest.cpp",
107    ]
108
109    configs = [ "${access_token_path}/config:coverage_flags" ]
110
111    deps = [
112      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_sdk",
113      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_stub",
114      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
115      "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
116      "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
117    ]
118
119    external_deps = [
120      "ability_base:want",
121      "c_utils:utils",
122      "hilog:libhilog",
123      "ipc:ipc_single",
124      "safwk:system_ability_fwk",
125      "samgr:samgr_proxy",
126    ]
127
128    cflags_cc = [
129      "-DHILOG_ENABLE",
130      "-DDEBUG_API_PERFORMANCE",
131    ]
132
133    if (common_event_service_enable) {
134      cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ]
135      external_deps += [ "common_event_service:cesfwk_innerkits" ]
136      sources += [ "../src/el5_filekey_manager_subscriber.cpp" ]
137    }
138
139    if (eventhandler_enable == true) {
140      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
141      external_deps += [ "eventhandler:libeventhandler" ]
142    }
143
144    if (theme_screenlock_mgr_enable) {
145      cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ]
146      external_deps += [ "screenlock_mgr:screenlock_client" ]
147    }
148  }
149
150  ohos_unittest("el5_filekey_manager_stub_unittest") {
151    subsystem_name = "accesscontrol"
152    part_name = "access_token"
153    module_out_path = "access_token/el5_filekey_manager"
154    sanitize = {
155      cfi = true
156      cfi_cross_dso = true
157      debug = false
158    }
159    branch_protector_ret = "pac_ret"
160
161    include_dirs = [
162      "../include",
163      "include",
164      "${access_token_path}/frameworks/inner_api/el5filekeymanager/include/",
165    ]
166
167    sources = [
168      "../src/el5_filekey_manager_service.cpp",
169      "../src/el5_memory_manager.cpp",
170      "src/el5_filekey_manager_stub_unittest.cpp",
171    ]
172
173    configs = [ "${access_token_path}/config:coverage_flags" ]
174
175    deps = [
176      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_sdk",
177      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_stub",
178      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
179      "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
180      "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
181    ]
182
183    external_deps = [
184      "ability_base:want",
185      "c_utils:utils",
186      "hilog:libhilog",
187      "ipc:ipc_single",
188      "safwk:system_ability_fwk",
189      "samgr:samgr_proxy",
190    ]
191
192    cflags_cc = [
193      "-DHILOG_ENABLE",
194      "-DDEBUG_API_PERFORMANCE",
195    ]
196
197    if (common_event_service_enable) {
198      cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ]
199      external_deps += [ "common_event_service:cesfwk_innerkits" ]
200      sources += [ "../src/el5_filekey_manager_subscriber.cpp" ]
201    }
202
203    if (eventhandler_enable == true) {
204      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
205      external_deps += [ "eventhandler:libeventhandler" ]
206    }
207
208    if (theme_screenlock_mgr_enable) {
209      cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ]
210      external_deps += [ "screenlock_mgr:screenlock_client" ]
211    }
212  }
213
214  ohos_unittest("el5_filekey_memory_manager_unittest") {
215    subsystem_name = "accesscontrol"
216    part_name = "access_token"
217    module_out_path = "access_token/el5_filekey_manager"
218    sanitize = {
219      cfi = true
220      cfi_cross_dso = true
221      debug = false
222    }
223    branch_protector_ret = "pac_ret"
224
225    include_dirs = [
226      "../include",
227      "include",
228      "${access_token_path}/frameworks/inner_api/el5filekeymanager/include/",
229    ]
230
231    sources = [
232      "../src/el5_filekey_manager_service.cpp",
233      "../src/el5_filekey_manager_service_ability.cpp",
234      "../src/el5_memory_manager.cpp",
235      "src/el5_filekey_memory_manager_unittest.cpp",
236    ]
237
238    configs = [ "${access_token_path}/config:coverage_flags" ]
239
240    deps = [
241      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_sdk",
242      "${access_token_path}/interfaces/inner_api/el5filekeymanager:el5_filekey_manager_stub",
243      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
244      "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
245      "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
246    ]
247
248    external_deps = [
249      "ability_base:want",
250      "c_utils:utils",
251      "hilog:libhilog",
252      "ipc:ipc_single",
253      "safwk:system_ability_fwk",
254      "samgr:samgr_proxy",
255    ]
256
257    cflags_cc = [
258      "-DHILOG_ENABLE",
259      "-DDEBUG_API_PERFORMANCE",
260    ]
261
262    if (common_event_service_enable) {
263      cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ]
264      external_deps += [ "common_event_service:cesfwk_innerkits" ]
265      sources += [ "../src/el5_filekey_manager_subscriber.cpp" ]
266    }
267
268    if (eventhandler_enable == true) {
269      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
270      external_deps += [ "eventhandler:libeventhandler" ]
271    }
272
273    if (theme_screenlock_mgr_enable) {
274      cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ]
275      external_deps += [ "screenlock_mgr:screenlock_client" ]
276    }
277  }
278
279  group("unittest") {
280    testonly = true
281    deps = [
282      ":el5_filekey_manager_service_mock_unittest",
283      ":el5_filekey_manager_service_unittest",
284      ":el5_filekey_manager_stub_unittest",
285      ":el5_filekey_memory_manager_unittest",
286    ]
287  }
288}
289