1# Copyright (c) 2023 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("./../../../usb.gni") 16 17module_output_path = "drivers_peripheral_usb/drivers_peripheral_usb" 18 19config("module_private_config") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ 23 "include", 24 "./../../../hdi_service/include", 25 "./../../../ddk/host/include", 26 "./../../../gadget/function/include", 27 "${usb_driver_path}/test/UsbSubscriberTest", 28 "${usb_driver_path}/utils/include", 29 ] 30} 31 32ohos_unittest("transfer_auto_test") { 33 sources = [ 34 "src/mock_linux_adapter.cpp", 35 "src/usbd_transfer_auto_test.cpp", 36 ] 37 38 configs = [ ":module_private_config" ] 39 40 deps = [ 41 "${usb_driver_path}/ddk:libusb_core", 42 "${usb_driver_path}/hdi_service:libusb_interface_service_1.2", 43 ] 44 45 external_deps = [ 46 "c_utils:utils", 47 "drivers_interface_usb:libusb_proxy_1.0", 48 "googletest:gmock_main", 49 "googletest:gtest_main", 50 "hdf_core:libhdf_utils", 51 "hilog:libhilog", 52 "ipc:ipc_single", 53 "samgr:samgr_proxy", 54 ] 55 module_out_path = module_output_path 56} 57 58ohos_unittest("device_auto_test") { 59 sources = [ 60 "${usb_driver_path}/test/UsbSubscriberTest/UsbSubscriberTest.cpp", 61 "src/mock_linux_adapter.cpp", 62 "src/usbd_device_auto_test.cpp", 63 ] 64 65 include_dirs = [ 66 "${usb_driver_path}/test/UsbSubscriberTest", 67 "${usb_driver_path}/utils/include", 68 ] 69 70 configs = [ ":module_private_config" ] 71 72 deps = [ 73 "${usb_driver_path}/ddk:libusb_core", 74 "${usb_driver_path}/hdi_service:libusb_interface_service_1.2", 75 ] 76 77 external_deps = [ 78 "c_utils:utils", 79 "drivers_interface_usb:libusb_proxy_1.0", 80 "googletest:gmock_main", 81 "googletest:gtest_main", 82 "hdf_core:libhdf_utils", 83 "hilog:libhilog", 84 "ipc:ipc_single", 85 "samgr:samgr_proxy", 86 ] 87 module_out_path = module_output_path 88} 89 90ohos_unittest("request_auto_test") { 91 sources = [ 92 "src/mock_linux_adapter.cpp", 93 "src/usbd_request_auto_test.cpp", 94 ] 95 96 configs = [ ":module_private_config" ] 97 98 deps = [ 99 "${usb_driver_path}/ddk:libusb_core", 100 "${usb_driver_path}/hdi_service:libusb_interface_service_1.2", 101 ] 102 103 external_deps = [ 104 "c_utils:utils", 105 "drivers_interface_usb:libusb_proxy_1.0", 106 "googletest:gmock_main", 107 "googletest:gtest_main", 108 "hdf_core:libhdf_utils", 109 "hilog:libhilog", 110 "ipc:ipc_single", 111 "samgr:samgr_proxy", 112 ] 113 module_out_path = module_output_path 114} 115 116ohos_unittest("function_auto_test") { 117 sources = [ "src/usbd_function_auto_test.cpp" ] 118 119 configs = [ ":module_private_config" ] 120 121 deps = [ 122 "${usb_driver_path}/ddk:libusb_core", 123 "${usb_driver_path}/hdi_service:libusb_interface_service_1.2", 124 ] 125 126 external_deps = [ 127 "c_utils:utils", 128 "drivers_interface_usb:libusb_proxy_1.0", 129 "googletest:gmock_main", 130 "googletest:gtest_main", 131 "hdf_core:libhdf_utils", 132 "hilog:libhilog", 133 "ipc:ipc_single", 134 "samgr:samgr_proxy", 135 ] 136 module_out_path = module_output_path 137} 138 139group("usb_mock_test") { 140 testonly = true 141 deps = [] 142} 143