1# Copyright (c) 2021-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("./../../../usbmgr.gni") 16 17module_output_path = "${usb_manager_part_name}/usb_unittest_test" 18 19config("module_private_config") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ 23 "include", 24 "${usb_manager_path}/test/common/include/", 25 "//third_party/jsoncpp/include/json", 26 ] 27} 28 29ohos_unittest("test_usbdevicepipe") { 30 module_out_path = module_output_path 31 sources = [ 32 "src/usb_common_test.cpp", 33 "src/usb_device_pipe_test.cpp", 34 ] 35 36 configs = [ 37 "${utils_path}:utils_config", 38 ":module_private_config", 39 ] 40 41 deps = [ 42 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 43 "${usb_manager_path}/services:usbservice", 44 "//third_party/googletest:gtest_main", 45 ] 46 47 external_deps = [ 48 "ability_base:want", 49 "access_token:libaccesstoken_sdk", 50 "access_token:libnativetoken", 51 "access_token:libtoken_setproc", 52 "bundle_framework:appexecfwk_base", 53 "c_utils:utils", 54 "common_event_service:cesfwk_innerkits", 55 "drivers_interface_usb:libusb_proxy_1.0", 56 "eventhandler:libeventhandler", 57 "hilog:libhilog", 58 "ipc:ipc_core", 59 "safwk:system_ability_fwk", 60 "samgr:samgr_proxy", 61 ] 62} 63 64ohos_unittest("test_bulkcallback") { 65 module_out_path = module_output_path 66 sources = [ 67 "${usb_manager_path}/test/common/src/usb_callback_test.cpp", 68 "src/usb_bulkcallback_test.cpp", 69 "src/usb_common_test.cpp", 70 ] 71 72 configs = [ 73 "${utils_path}:utils_config", 74 ":module_private_config", 75 ] 76 77 deps = [ 78 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 79 "${usb_manager_path}/services:usbservice", 80 "//third_party/googletest:gtest_main", 81 ] 82 83 external_deps = [ 84 "ability_base:want", 85 "access_token:libaccesstoken_sdk", 86 "access_token:libnativetoken", 87 "access_token:libtoken_setproc", 88 "bundle_framework:appexecfwk_base", 89 "c_utils:utils", 90 "common_event_service:cesfwk_innerkits", 91 "drivers_interface_usb:libusb_proxy_1.0", 92 "eventhandler:libeventhandler", 93 "hilog:libhilog", 94 "ipc:ipc_core", 95 "safwk:system_ability_fwk", 96 "samgr:samgr_proxy", 97 ] 98} 99 100ohos_unittest("test_usbrequest") { 101 module_out_path = module_output_path 102 sources = [ 103 "src/usb_common_test.cpp", 104 "src/usb_request_test.cpp", 105 ] 106 107 configs = [ 108 "${utils_path}:utils_config", 109 ":module_private_config", 110 ] 111 112 deps = [ 113 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 114 "${usb_manager_path}/services:usbservice", 115 "//third_party/googletest:gtest_main", 116 ] 117 118 external_deps = [ 119 "ability_base:want", 120 "access_token:libaccesstoken_sdk", 121 "access_token:libnativetoken", 122 "access_token:libtoken_setproc", 123 "bundle_framework:appexecfwk_base", 124 "c_utils:utils", 125 "common_event_service:cesfwk_innerkits", 126 "drivers_interface_usb:libusb_proxy_1.0", 127 "eventhandler:libeventhandler", 128 "hilog:libhilog", 129 "ipc:ipc_core", 130 "safwk:system_ability_fwk", 131 "samgr:samgr_proxy", 132 ] 133} 134 135ohos_unittest("test_usbcore") { 136 module_out_path = module_output_path 137 sources = [ 138 "src/usb_common_test.cpp", 139 "src/usb_core_test.cpp", 140 ] 141 142 configs = [ 143 "${utils_path}:utils_config", 144 ":module_private_config", 145 ] 146 147 deps = [ 148 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 149 "${usb_manager_path}/services:usbservice", 150 "//third_party/googletest:gtest_main", 151 ] 152 153 external_deps = [ 154 "ability_base:want", 155 "access_token:libaccesstoken_sdk", 156 "access_token:libnativetoken", 157 "access_token:libtoken_setproc", 158 "bundle_framework:appexecfwk_base", 159 "c_utils:utils", 160 "common_event_service:cesfwk_innerkits", 161 "drivers_interface_usb:libusb_proxy_1.0", 162 "eventhandler:libeventhandler", 163 "hilog:libhilog", 164 "ipc:ipc_core", 165 "safwk:system_ability_fwk", 166 "samgr:samgr_proxy", 167 ] 168} 169 170ohos_unittest("test_usbevent") { 171 module_out_path = module_output_path 172 sources = [ "src/usb_event_test.cpp" ] 173 174 configs = [ 175 "${utils_path}:utils_config", 176 ":module_private_config", 177 ] 178 179 deps = [ 180 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 181 "${usb_manager_path}/services:usbservice", 182 "//third_party/googletest:gtest_main", 183 "//third_party/jsoncpp:jsoncpp", 184 ] 185 186 external_deps = [ 187 "ability_base:want", 188 "bundle_framework:appexecfwk_base", 189 "c_utils:utils", 190 "common_event_service:cesfwk_innerkits", 191 "drivers_interface_usb:libusb_proxy_1.0", 192 "eventhandler:libeventhandler", 193 "hilog:libhilog", 194 "ipc:ipc_core", 195 "safwk:system_ability_fwk", 196 "samgr:samgr_proxy", 197 ] 198} 199 200group("unittest") { 201 testonly = true 202 deps = [ 203 ":test_bulkcallback", 204 ":test_usbcore", 205 ":test_usbdevicepipe", 206 ":test_usbevent", 207 ":test_usbrequest", 208 ] 209} 210