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 "//foundation/communication/nfc/interfaces/inner_api/include", 22 "//foundation/communication/nfc/interfaces/inner_api/include/controller", 23 "//foundation/communication/nfc/interfaces/inner_api/include/tags", 24 "//foundation/communication/nfc/interfaces/inner_api/include/cardEmulation", 25 "$NFC_SERVICE_ROOT/services/include", 26 "$NFC_SERVICE_ROOT/services/src", 27 ] 28 29 defines = [] 30 cflags_cc = [] 31 ldflags = [] 32 libs = [] 33} 34 35unit_test_deps = [ 36 "$NFC_SERVICE_ROOT/services:nfc_service", 37 "//foundation/communication/nfc/interfaces/inner_api:nfc_inner_kits", 38 "//third_party/googletest:gtest_main", 39] 40 41unit_test_external_deps = [ 42 "ability_base:want", 43 "access_token:libaccesstoken_sdk", 44 "bundle_framework:appexecfwk_core", 45 "c_utils:utils", 46 "hilog:libhilog", 47 "ipc:ipc_core", 48 "safwk:system_ability_fwk", 49 "samgr:samgr_proxy", 50] 51 52ohos_unittest("controller_test") { 53 module_out_path = "nfc/services" 54 55 sources = [ 56 "controller_test/nfc_controller_callback_stub_test.cpp", 57 "controller_test/nfc_controller_test.cpp", 58 ] 59 60 configs = [ ":nfc_service_unit_test_config" ] 61 62 deps = unit_test_deps 63 64 external_deps = unit_test_external_deps 65 66 part_name = "nfc" 67 subsystem_name = "communication" 68} 69 70ohos_unittest("cardemulation_test") { 71 module_out_path = "nfc/services" 72 73 sources = [ "cardemulation_test/cardemulation_test.cpp" ] 74 75 configs = [ ":nfc_service_unit_test_config" ] 76 77 deps = unit_test_deps 78 79 external_deps = unit_test_external_deps 80 81 part_name = "nfc" 82 subsystem_name = "communication" 83} 84 85ohos_unittest("tags_test") { 86 module_out_path = "nfc/services" 87 88 sources = [ 89 "tags_test/foreground_callback_stub_test.cpp", 90 "tags_test/iso15693_tag_test.cpp", 91 "tags_test/isodep_tag_test.cpp", 92 "tags_test/mifare_classic_tag_test.cpp", 93 "tags_test/mifare_ultralight_tag_test.cpp", 94 "tags_test/ndef_formatable_tag_test.cpp", 95 "tags_test/ndef_message_test.cpp", 96 "tags_test/ndef_tag_test.cpp", 97 "tags_test/nfca_tag_test.cpp", 98 "tags_test/nfcb_tag_test.cpp", 99 "tags_test/nfcf_tag_test.cpp", 100 "tags_test/tag_info_test.cpp", 101 "tags_test/taginfo_parcelable_test.cpp", 102 ] 103 104 configs = [ ":nfc_service_unit_test_config" ] 105 106 deps = unit_test_deps 107 108 external_deps = unit_test_external_deps 109 110 part_name = "nfc" 111 subsystem_name = "communication" 112} 113 114ohos_unittest("public_test") { 115 module_out_path = "nfc/services" 116 117 sources = [ "public_test/nfc_public_test.cpp" ] 118 119 configs = [ ":nfc_service_unit_test_config" ] 120 121 deps = unit_test_deps 122 123 external_deps = unit_test_external_deps 124 125 part_name = "nfc" 126 subsystem_name = "communication" 127} 128 129ohos_unittest("services_test") { 130 module_out_path = "nfc/services" 131 132 sources = [ 133 "services_test/app_data_parser_test.cpp", 134 "services_test/nfc_polling_params_test.cpp", 135 "services_test/nfc_service_test.cpp", 136 ] 137 138 configs = [ ":nfc_service_unit_test_config" ] 139 140 deps = unit_test_deps 141 142 external_deps = unit_test_external_deps 143 144 part_name = "nfc" 145 subsystem_name = "communication" 146} 147 148ohos_unittest("services_tags_test") { 149 module_out_path = "nfc/services" 150 151 sources = [ 152 "services_tags_test/nfc_service_tdd.cpp", 153 "services_tags_test/tag_dispatcher_test.cpp", 154 "services_tags_test/tag_session_stub_test.cpp", 155 "services_tags_test/tag_session_test.cpp", 156 ] 157 158 configs = [ ":nfc_service_unit_test_config" ] 159 160 deps = unit_test_deps 161 162 external_deps = unit_test_external_deps 163 164 part_name = "nfc" 165 subsystem_name = "communication" 166} 167 168ohos_unittest("nci_adapter_test") { 169 module_out_path = "nfc/services" 170 171 sources = [ 172 "nci_adapter_test/nfcc_host_test.cpp", 173 "nci_adapter_test/nfcc_nci_adapter_test.cpp", 174 "nci_adapter_test/tag_host_test.cpp", 175 "nci_adapter_test/tag_nci_adapter_test.cpp", 176 ] 177 178 configs = [ ":nfc_service_unit_test_config" ] 179 180 deps = unit_test_deps 181 182 external_deps = unit_test_external_deps 183 184 part_name = "nfc" 185 subsystem_name = "communication" 186} 187 188group("nfc_service_unittest") { 189 testonly = true 190 deps = [ 191 ":cardemulation_test", 192 ":controller_test", 193 ":nci_adapter_test", 194 ":public_test", 195 ":services_tags_test", 196 ":services_test", 197 ":tags_test", 198 ] 199} 200