• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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("../../../nfc.gni")
16
17config("nfc_service_unit_test_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [
21    "$NFC_DIR/interfaces/inner_api/cardEmulation",
22    "$NFC_DIR/interfaces/inner_api/common",
23    "$NFC_DIR/interfaces/inner_api/controller",
24    "$NFC_DIR/interfaces/inner_api/tags",
25    "$NFC_DIR/services/include",
26    "$NFC_DIR/services/src/nci_adapter/nci_native_default/include",
27    "$NFC_DIR/services/src",
28    "$NFC_DIR/services/src/external_deps",
29    "$NFC_DIR/services/src/tag",
30    "$NFC_DIR/test/unittest/mock",
31  ]
32
33  defines = []
34  if (nfc_service_feature_vendor_applications_enabled) {
35    defines += [ "VENDOR_APPLICATIONS_ENABLED" ]
36  }
37  cflags_cc = []
38  ldflags = []
39  libs = []
40}
41
42unit_test_deps = [
43  "$NFC_DIR/interfaces/inner_api/cardEmulation:nfc_inner_kits_card_emulation",
44  "$NFC_DIR/interfaces/inner_api/common:nfc_inner_kits_common",
45  "$NFC_DIR/interfaces/inner_api/controller:nfc_inner_kits_controller",
46  "$NFC_DIR/interfaces/inner_api/tags:nfc_inner_kits_tags",
47  "$NFC_DIR/services:nfc_service_static",
48]
49
50unit_test_external_deps = [
51  "ability_base:want",
52  "ability_base:zuri",
53  "ability_runtime:ability_manager",
54  "ability_runtime:app_manager",
55  "ability_runtime:dataobs_manager",
56  "access_token:libaccesstoken_sdk",
57  "bluetooth:btframework",
58  "bundle_framework:appexecfwk_core",
59  "c_utils:utils",
60  "common_event_service:cesfwk_innerkits",
61  "data_share:datashare_consumer",
62  "googletest:gtest_main",
63  "hilog:libhilog",
64  "ipc:ipc_core",
65  "preferences:native_preferences",
66  "safwk:system_ability_fwk",
67  "samgr:samgr_proxy",
68  "wifi:wifi_sdk",
69]
70
71ohos_unittest("controller_test") {
72  module_out_path = unit_module_out_path
73
74  sources = [
75    "controller_test/app_data_parser_test.cpp",
76    "controller_test/external_deps_proxy_test.cpp",
77    "controller_test/ndef_msg_callback_stub_test.cpp",
78    "controller_test/nfc_ability_connection_callback_test.cpp",
79    "controller_test/nfc_controller_callback_stub_test.cpp",
80    "controller_test/nfc_controller_death_recipient_test.cpp",
81    "controller_test/nfc_controller_impl_test.cpp",
82    "controller_test/nfc_controller_test.cpp",
83    "controller_test/nfc_preferences_test.cpp",
84    "controller_test/on_card_emulation_notify_cb_stub_test.cpp",
85    "controller_test/query_app_info_callback_stub_test.cpp",
86    "controller_test/reader_mode_callback_stub_test.cpp",
87    "controller_test/tag_ability_dispatcher_test.cpp",
88  ]
89
90  configs = [ ":nfc_service_unit_test_config" ]
91
92  deps = unit_test_deps
93
94  external_deps = unit_test_external_deps
95
96  part_name = "nfc"
97  subsystem_name = "communication"
98}
99
100ohos_unittest("cardemulation_test") {
101  module_out_path = unit_module_out_path
102
103  sources = [ "cardemulation_test/cardemulation_test.cpp" ]
104
105  configs = [ ":nfc_service_unit_test_config" ]
106
107  deps = unit_test_deps
108
109  external_deps = unit_test_external_deps
110
111  part_name = "nfc"
112  subsystem_name = "communication"
113}
114
115ohos_unittest("ce_service_test") {
116  module_out_path = unit_module_out_path
117
118  sources = [ "ce_service_test/ce_service_test.cpp" ]
119
120  configs = [ ":nfc_service_unit_test_config" ]
121
122  deps = unit_test_deps
123
124  external_deps = unit_test_external_deps
125
126  part_name = "nfc"
127  subsystem_name = "communication"
128}
129
130ohos_unittest("hce_cmd_callback_stub_test") {
131  module_out_path = unit_module_out_path
132
133  sources = [ "hce_cmd_callback_stub_test/hce_cmd_callback_stub_test.cpp" ]
134
135  configs = [ ":nfc_service_unit_test_config" ]
136
137  deps = unit_test_deps
138
139  external_deps = unit_test_external_deps
140
141  part_name = "nfc"
142  subsystem_name = "communication"
143}
144
145ohos_unittest("hce_service_test") {
146  module_out_path = unit_module_out_path
147
148  sources = [ "hce_service_test/hce_service_test.cpp" ]
149
150  configs = [ ":nfc_service_unit_test_config" ]
151
152  deps = unit_test_deps
153
154  external_deps = unit_test_external_deps
155
156  part_name = "nfc"
157  subsystem_name = "communication"
158}
159
160ohos_unittest("hce_session_test") {
161  module_out_path = unit_module_out_path
162
163  sources = [ "hce_session_test/hce_session_test.cpp" ]
164
165  configs = [ ":nfc_service_unit_test_config" ]
166
167  deps = unit_test_deps
168
169  external_deps = unit_test_external_deps
170
171  part_name = "nfc"
172  subsystem_name = "communication"
173}
174
175ohos_unittest("host_card_emulation_manager_test") {
176  module_out_path = unit_module_out_path
177
178  sources = [
179    "host_card_emulation_manager_test/host_card_emulation_manager_test.cpp",
180  ]
181
182  configs = [ ":nfc_service_unit_test_config" ]
183
184  deps = unit_test_deps
185
186  external_deps = unit_test_external_deps
187
188  part_name = "nfc"
189  subsystem_name = "communication"
190}
191
192ohos_unittest("isodep_card_handler_test") {
193  module_out_path = unit_module_out_path
194
195  sources = [ "isodep_card_handler_test/isodep_card_handler_test.cpp" ]
196
197  configs = [ ":nfc_service_unit_test_config" ]
198
199  deps = unit_test_deps
200
201  external_deps = unit_test_external_deps
202
203  part_name = "nfc"
204  subsystem_name = "communication"
205}
206
207ohos_unittest("nci_ce_proxy_test") {
208  module_out_path = unit_module_out_path
209
210  sources = [ "nci_ce_proxy_test/nci_ce_proxy_test.cpp" ]
211
212  configs = [ ":nfc_service_unit_test_config" ]
213
214  deps = unit_test_deps
215
216  external_deps = unit_test_external_deps
217
218  part_name = "nfc"
219  subsystem_name = "communication"
220}
221
222ohos_unittest("nci_nfcc_proxy_test") {
223  module_out_path = unit_module_out_path
224
225  sources = [ "nci_nfcc_proxy_test/nci_nfcc_proxy_test.cpp" ]
226
227  configs = [ ":nfc_service_unit_test_config" ]
228
229  deps = unit_test_deps
230
231  external_deps = unit_test_external_deps
232
233  part_name = "nfc"
234  subsystem_name = "communication"
235}
236
237ohos_unittest("nci_tag_proxy_test") {
238  module_out_path = unit_module_out_path
239
240  sources = [ "nci_tag_proxy_test/nci_tag_proxy_test.cpp" ]
241
242  configs = [ ":nfc_service_unit_test_config" ]
243
244  deps = unit_test_deps
245
246  external_deps = unit_test_external_deps
247
248  part_name = "nfc"
249  subsystem_name = "communication"
250}
251
252ohos_unittest("tags_test") {
253  module_out_path = unit_module_out_path
254
255  sources = [
256    "tags_test/foreground_callback_stub_test.cpp",
257    "tags_test/iso15693_tag_test.cpp",
258    "tags_test/isodep_tag_test.cpp",
259    "tags_test/mifare_classic_tag_test.cpp",
260    "tags_test/mifare_ultralight_tag_test.cpp",
261    "tags_test/ndef_formatable_tag_test.cpp",
262    "tags_test/ndef_har_data_parser_test.cpp",
263    "tags_test/ndef_har_dispatch_test.cpp",
264    "tags_test/ndef_message_test.cpp",
265    "tags_test/ndef_tag_test.cpp",
266    "tags_test/nfca_tag_test.cpp",
267    "tags_test/nfcb_tag_test.cpp",
268    "tags_test/nfcf_tag_test.cpp",
269    "tags_test/tag_foreground_test.cpp",
270    "tags_test/tag_info_test.cpp",
271    "tags_test/taginfo_parcelable_test.cpp",
272  ]
273
274  configs = [ ":nfc_service_unit_test_config" ]
275
276  deps = unit_test_deps
277
278  external_deps = unit_test_external_deps
279
280  part_name = "nfc"
281  subsystem_name = "communication"
282}
283
284ohos_unittest("public_test") {
285  module_out_path = unit_module_out_path
286
287  sources = [ "public_test/nfc_public_test.cpp" ]
288
289  configs = [ ":nfc_service_unit_test_config" ]
290
291  deps = unit_test_deps
292
293  external_deps = unit_test_external_deps
294
295  part_name = "nfc"
296  subsystem_name = "communication"
297}
298
299ohos_unittest("services_test") {
300  module_out_path = unit_module_out_path
301
302  sources = [
303    "services_test/app_data_parser_test.cpp",
304    "services_test/ndef_bt_data_parser_test.cpp",
305    "services_test/ndef_wifi_data_parser_test.cpp",
306    "services_test/nfc_event_handler_test.cpp",
307    "services_test/nfc_polling_manager_test.cpp",
308    "services_test/nfc_polling_params_test.cpp",
309  ]
310
311  configs = [ ":nfc_service_unit_test_config" ]
312
313  deps = unit_test_deps
314
315  external_deps = unit_test_external_deps
316
317  part_name = "nfc"
318  subsystem_name = "communication"
319}
320
321ohos_unittest("services_tags_test") {
322  module_out_path = unit_module_out_path
323
324  sources = [
325    "services_tags_test/bt_connection_manager_test.cpp",
326    "services_tags_test/nfc_service_tdd.cpp",
327    "services_tags_test/tag_dispatcher_test.cpp",
328    "services_tags_test/tag_session_stub_test.cpp",
329    "services_tags_test/tag_session_test.cpp",
330    "services_tags_test/wifi_connection_manager_test.cpp",
331  ]
332
333  configs = [ ":nfc_service_unit_test_config" ]
334
335  deps = unit_test_deps
336
337  external_deps = unit_test_external_deps
338
339  part_name = "nfc"
340  subsystem_name = "communication"
341}
342
343ohos_unittest("nci_adapter_test") {
344  module_out_path = unit_module_out_path
345  configs = [ ":nfc_service_unit_test_config" ]
346  cflags_cc = [ "-DNXP_EXTNS=TRUE" ]
347
348  sources = [
349    "nci_adapter_test/nfcc_nci_adapter_test.cpp",
350    "nci_adapter_test/tag_host_test.cpp",
351    "nci_adapter_test/tag_nci_adapter_test.cpp",
352  ]
353
354  deps = unit_test_deps
355  if (!nfc_use_vendor_nci_native) {
356    deps += [
357      "$NFC_DIR/services/src/nci_adapter/nci_native_default:nci_native_default",
358    ]
359  }
360  external_deps = unit_test_external_deps
361
362  part_name = "nfc"
363  subsystem_name = "communication"
364}
365
366ohos_unittest("interfaces_test") {
367  module_out_path = unit_module_out_path
368  configs = [ ":nfc_service_unit_test_config" ]
369  cflags_cc = [ "-DNXP_EXTNS=TRUE" ]
370
371  sources = [ "interfaces_test/nfc_sdk_common_test.cpp" ]
372
373  deps = unit_test_deps
374
375  external_deps = unit_test_external_deps
376
377  part_name = "nfc"
378  subsystem_name = "communication"
379}
380
381group("nfc_service_unittest") {
382  testonly = true
383  deps = [
384    ":cardemulation_test",
385    ":ce_service_test",
386    ":controller_test",
387    ":hce_cmd_callback_stub_test",
388    ":hce_service_test",
389    ":hce_session_test",
390    ":host_card_emulation_manager_test",
391    ":interfaces_test",
392    ":isodep_card_handler_test",
393    ":nci_ce_proxy_test",
394    ":nci_nfcc_proxy_test",
395    ":nci_tag_proxy_test",
396    ":public_test",
397    ":services_tags_test",
398    ":services_test",
399    ":tags_test",
400  ]
401  if (!nfc_use_vendor_nci_native) {
402    deps += [ ":nci_adapter_test" ]
403  }
404}
405