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("//base/usb/usb_manager/usbmgr.gni") 15import("//build/test.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 = [ "src/usb_device_pipe_test.cpp" ] 32 33 configs = [ 34 "${utils_path}:utils_config", 35 ":module_private_config", 36 ] 37 38 deps = [ 39 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 40 "${usb_manager_path}/services:usbservice", 41 "//third_party/googletest:gtest_main", 42 ] 43 44 external_deps = [ 45 "ability_base:want", 46 "bundle_framework:appexecfwk_base", 47 "c_utils:utils", 48 "common_event_service:cesfwk_innerkits", 49 "drivers_interface_usb:libusb_proxy_1.0", 50 "eventhandler:libeventhandler", 51 "hiviewdfx_hilog_native:libhilog", 52 "ipc:ipc_core", 53 "safwk:system_ability_fwk", 54 "samgr:samgr_proxy", 55 ] 56} 57 58ohos_unittest("test_bulkcallback") { 59 module_out_path = module_output_path 60 sources = [ 61 "${usb_manager_path}/test/common/src/usb_callback_test.cpp", 62 "src/usb_bulkcallback_test.cpp", 63 ] 64 65 configs = [ 66 "${utils_path}:utils_config", 67 ":module_private_config", 68 ] 69 70 deps = [ 71 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 72 "${usb_manager_path}/services:usbservice", 73 "//third_party/googletest:gtest_main", 74 ] 75 76 external_deps = [ 77 "ability_base:want", 78 "bundle_framework:appexecfwk_base", 79 "c_utils:utils", 80 "common_event_service:cesfwk_innerkits", 81 "drivers_interface_usb:libusb_proxy_1.0", 82 "eventhandler:libeventhandler", 83 "hiviewdfx_hilog_native:libhilog", 84 "ipc:ipc_core", 85 "safwk:system_ability_fwk", 86 "samgr:samgr_proxy", 87 ] 88} 89 90ohos_unittest("test_usbrequest") { 91 module_out_path = module_output_path 92 sources = [ "src/usb_request_test.cpp" ] 93 94 configs = [ 95 "${utils_path}:utils_config", 96 ":module_private_config", 97 ] 98 99 deps = [ 100 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 101 "${usb_manager_path}/services:usbservice", 102 "//third_party/googletest:gtest_main", 103 ] 104 105 external_deps = [ 106 "ability_base:want", 107 "bundle_framework:appexecfwk_base", 108 "c_utils:utils", 109 "common_event_service:cesfwk_innerkits", 110 "drivers_interface_usb:libusb_proxy_1.0", 111 "eventhandler:libeventhandler", 112 "hiviewdfx_hilog_native:libhilog", 113 "ipc:ipc_core", 114 "safwk:system_ability_fwk", 115 "samgr:samgr_proxy", 116 ] 117} 118 119ohos_unittest("test_usbcore") { 120 module_out_path = module_output_path 121 sources = [ "src/usb_core_test.cpp" ] 122 123 configs = [ 124 "${utils_path}:utils_config", 125 ":module_private_config", 126 ] 127 128 deps = [ 129 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 130 "${usb_manager_path}/services:usbservice", 131 "//third_party/googletest:gtest_main", 132 ] 133 134 external_deps = [ 135 "ability_base:want", 136 "bundle_framework:appexecfwk_base", 137 "c_utils:utils", 138 "common_event_service:cesfwk_innerkits", 139 "drivers_interface_usb:libusb_proxy_1.0", 140 "eventhandler:libeventhandler", 141 "hiviewdfx_hilog_native:libhilog", 142 "ipc:ipc_core", 143 "safwk:system_ability_fwk", 144 "samgr:samgr_proxy", 145 ] 146} 147 148ohos_unittest("test_usbevent") { 149 module_out_path = module_output_path 150 sources = [ "src/usb_event_test.cpp" ] 151 152 configs = [ 153 "${utils_path}:utils_config", 154 ":module_private_config", 155 ] 156 157 deps = [ 158 "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 159 "${usb_manager_path}/services:usbservice", 160 "//third_party/googletest:gtest_main", 161 "//third_party/jsoncpp:jsoncpp", 162 ] 163 164 external_deps = [ 165 "ability_base:want", 166 "bundle_framework:appexecfwk_base", 167 "c_utils:utils", 168 "common_event_service:cesfwk_innerkits", 169 "drivers_interface_usb:libusb_proxy_1.0", 170 "eventhandler:libeventhandler", 171 "hiviewdfx_hilog_native:libhilog", 172 "ipc:ipc_core", 173 "safwk:system_ability_fwk", 174 "samgr:samgr_proxy", 175 ] 176} 177 178group("unittest") { 179 testonly = true 180 deps = [ 181 ":test_bulkcallback", 182 ":test_usbcore", 183 ":test_usbdevicepipe", 184 ":test_usbevent", 185 ":test_usbrequest", 186 ] 187} 188