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 = "hdf/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 "//third_party/googletest/googlemock/include", 28 "${usb_driver_path}/test/UsbSubscriberTest", 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.0", 43 "//third_party/googletest:gmock_main", 44 "//third_party/googletest:gtest_main", 45 ] 46 47 external_deps = [ 48 "c_utils:utils", 49 "drivers_interface_usb:libusb_proxy_1.0", 50 "eventhandler:libeventhandler", 51 "hdf_core:libhdf_utils", 52 "hilog:libhilog", 53 "ipc:ipc_single", 54 "safwk:system_ability_fwk", 55 "samgr:samgr_proxy", 56 ] 57 module_out_path = module_output_path 58} 59 60ohos_unittest("device_auto_test") { 61 sources = [ 62 "${usb_driver_path}/test/UsbSubscriberTest/UsbSubscriberTest.cpp", 63 "src/mock_linux_adapter.cpp", 64 "src/usbd_device_auto_test.cpp", 65 ] 66 67 include_dirs = [ "${usb_driver_path}/test/UsbSubscriberTest" ] 68 69 configs = [ ":module_private_config" ] 70 71 deps = [ 72 "${usb_driver_path}/ddk:libusb_core", 73 "${usb_driver_path}/hdi_service:libusb_interface_service_1.0", 74 "//third_party/googletest:gmock_main", 75 "//third_party/googletest:gtest_main", 76 ] 77 78 external_deps = [ 79 "c_utils:utils", 80 "drivers_interface_usb:libusb_proxy_1.0", 81 "eventhandler:libeventhandler", 82 "hdf_core:libhdf_utils", 83 "hilog:libhilog", 84 "ipc:ipc_single", 85 "safwk:system_ability_fwk", 86 "samgr:samgr_proxy", 87 ] 88 module_out_path = module_output_path 89} 90 91ohos_unittest("request_auto_test") { 92 sources = [ 93 "src/mock_linux_adapter.cpp", 94 "src/usbd_request_auto_test.cpp", 95 ] 96 97 configs = [ ":module_private_config" ] 98 99 deps = [ 100 "${usb_driver_path}/ddk:libusb_core", 101 "${usb_driver_path}/hdi_service:libusb_interface_service_1.0", 102 "//third_party/googletest:gmock_main", 103 "//third_party/googletest:gtest_main", 104 ] 105 106 external_deps = [ 107 "c_utils:utils", 108 "drivers_interface_usb:libusb_proxy_1.0", 109 "eventhandler:libeventhandler", 110 "hdf_core:libhdf_utils", 111 "hilog:libhilog", 112 "ipc:ipc_single", 113 "safwk:system_ability_fwk", 114 "samgr:samgr_proxy", 115 ] 116 module_out_path = module_output_path 117} 118 119ohos_unittest("function_auto_test") { 120 sources = [ "src/usbd_function_auto_test.cpp" ] 121 122 configs = [ ":module_private_config" ] 123 124 deps = [ 125 "${usb_driver_path}/ddk:libusb_core", 126 "${usb_driver_path}/hdi_service:libusb_interface_service_1.0", 127 "//third_party/googletest:gmock_main", 128 "//third_party/googletest:gtest_main", 129 ] 130 131 external_deps = [ 132 "c_utils:utils", 133 "drivers_interface_usb:libusb_proxy_1.0", 134 "eventhandler:libeventhandler", 135 "hdf_core:libhdf_utils", 136 "hilog:libhilog", 137 "ipc:ipc_single", 138 "safwk:system_ability_fwk", 139 "samgr:samgr_proxy", 140 ] 141 module_out_path = module_output_path 142} 143 144group("usb_mock_test") { 145 testonly = true 146 deps = [] 147} 148