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