142103316Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd. 242103316Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 342103316Sopenharmony_ci# you may not use this file except in compliance with the License. 442103316Sopenharmony_ci# You may obtain a copy of the License at 542103316Sopenharmony_ci# 642103316Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 742103316Sopenharmony_ci# 842103316Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 942103316Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1042103316Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1142103316Sopenharmony_ci# See the License for the specific language governing permissions and 1242103316Sopenharmony_ci# limitations under the License. 1342103316Sopenharmony_ci 1442103316Sopenharmony_ciimport("//build/test.gni") 1542103316Sopenharmony_ciimport("./../../../usbmgr.gni") 1642103316Sopenharmony_ci 1742103316Sopenharmony_cimodule_output_path = "${usb_manager_part_name}/usb_unittest_test" 1842103316Sopenharmony_ci 1942103316Sopenharmony_ciconfig("module_private_config") { 2042103316Sopenharmony_ci visibility = [ ":*" ] 2142103316Sopenharmony_ci include_dirs = [ 2242103316Sopenharmony_ci "include", 2342103316Sopenharmony_ci "//third_party/googletest/googlemock/include", 2442103316Sopenharmony_ci "${usb_manager_path}/interfaces/kits/js/napi/include", 2542103316Sopenharmony_ci "${usb_manager_path}/utils/native/include", 2642103316Sopenharmony_ci "${usb_manager_path}/test/common/include", 2742103316Sopenharmony_ci "${usb_manager_path}/test/native/mock/include", 2842103316Sopenharmony_ci "${usb_manager_path}/test/native/service_unittest/include", 2942103316Sopenharmony_ci ] 3042103316Sopenharmony_ci} 3142103316Sopenharmony_ci 3242103316Sopenharmony_ciohos_unittest("test_mock_bulkcallback") { 3342103316Sopenharmony_ci module_out_path = module_output_path 3442103316Sopenharmony_ci sources = [ 3542103316Sopenharmony_ci "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", 3642103316Sopenharmony_ci "${usb_manager_path}/test/common/src/usb_callback_test.cpp", 3742103316Sopenharmony_ci "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", 3842103316Sopenharmony_ci "src/usb_bulkcallback_mock_test.cpp", 3942103316Sopenharmony_ci "src/usb_impl_mock.cpp", 4042103316Sopenharmony_ci ] 4142103316Sopenharmony_ci 4242103316Sopenharmony_ci configs = [ 4342103316Sopenharmony_ci "${utils_path}:utils_config", 4442103316Sopenharmony_ci ":module_private_config", 4542103316Sopenharmony_ci ] 4642103316Sopenharmony_ci 4742103316Sopenharmony_ci deps = [ 4842103316Sopenharmony_ci "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 4942103316Sopenharmony_ci "${usb_manager_path}/services:usbservice", 5042103316Sopenharmony_ci "//third_party/cJSON:cjson", 5142103316Sopenharmony_ci "//third_party/googletest:gmock_main", 5242103316Sopenharmony_ci "//third_party/googletest:gtest_main", 5342103316Sopenharmony_ci ] 5442103316Sopenharmony_ci 5542103316Sopenharmony_ci external_deps = [ 5642103316Sopenharmony_ci "ability_base:want", 5742103316Sopenharmony_ci "ability_runtime:ability_manager", 5842103316Sopenharmony_ci "access_token:libaccesstoken_sdk", 5942103316Sopenharmony_ci "access_token:libnativetoken", 6042103316Sopenharmony_ci "access_token:libtoken_setproc", 6142103316Sopenharmony_ci "bundle_framework:appexecfwk_base", 6242103316Sopenharmony_ci "bundle_framework:appexecfwk_core", 6342103316Sopenharmony_ci "c_utils:utils", 6442103316Sopenharmony_ci "common_event_service:cesfwk_innerkits", 6542103316Sopenharmony_ci "drivers_interface_usb:libusb_proxy_1.0", 6642103316Sopenharmony_ci "eventhandler:libeventhandler", 6742103316Sopenharmony_ci "hilog:libhilog", 6842103316Sopenharmony_ci "ipc:ipc_core", 6942103316Sopenharmony_ci "samgr:samgr_proxy", 7042103316Sopenharmony_ci ] 7142103316Sopenharmony_ci} 7242103316Sopenharmony_ci 7342103316Sopenharmony_ciohos_unittest("test_mock_usbcore") { 7442103316Sopenharmony_ci module_out_path = module_output_path 7542103316Sopenharmony_ci sources = [ 7642103316Sopenharmony_ci "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", 7742103316Sopenharmony_ci "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", 7842103316Sopenharmony_ci "src/usb_core_mock_test.cpp", 7942103316Sopenharmony_ci "src/usb_impl_mock.cpp", 8042103316Sopenharmony_ci ] 8142103316Sopenharmony_ci 8242103316Sopenharmony_ci configs = [ 8342103316Sopenharmony_ci "${utils_path}:utils_config", 8442103316Sopenharmony_ci ":module_private_config", 8542103316Sopenharmony_ci ] 8642103316Sopenharmony_ci 8742103316Sopenharmony_ci deps = [ 8842103316Sopenharmony_ci "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 8942103316Sopenharmony_ci "${usb_manager_path}/services:usbservice", 9042103316Sopenharmony_ci "//third_party/cJSON:cjson", 9142103316Sopenharmony_ci "//third_party/googletest:gmock_main", 9242103316Sopenharmony_ci "//third_party/googletest:gtest_main", 9342103316Sopenharmony_ci ] 9442103316Sopenharmony_ci 9542103316Sopenharmony_ci external_deps = [ 9642103316Sopenharmony_ci "ability_base:want", 9742103316Sopenharmony_ci "ability_runtime:ability_manager", 9842103316Sopenharmony_ci "access_token:libaccesstoken_sdk", 9942103316Sopenharmony_ci "access_token:libnativetoken", 10042103316Sopenharmony_ci "access_token:libtoken_setproc", 10142103316Sopenharmony_ci "bundle_framework:appexecfwk_base", 10242103316Sopenharmony_ci "bundle_framework:appexecfwk_core", 10342103316Sopenharmony_ci "c_utils:utils", 10442103316Sopenharmony_ci "common_event_service:cesfwk_innerkits", 10542103316Sopenharmony_ci "drivers_interface_usb:libusb_proxy_1.0", 10642103316Sopenharmony_ci "eventhandler:libeventhandler", 10742103316Sopenharmony_ci "hilog:libhilog", 10842103316Sopenharmony_ci "ipc:ipc_core", 10942103316Sopenharmony_ci "samgr:samgr_proxy", 11042103316Sopenharmony_ci ] 11142103316Sopenharmony_ci} 11242103316Sopenharmony_ci 11342103316Sopenharmony_ciohos_unittest("test_mock_usbdevicepipe") { 11442103316Sopenharmony_ci module_out_path = module_output_path 11542103316Sopenharmony_ci sources = [ 11642103316Sopenharmony_ci "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", 11742103316Sopenharmony_ci "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", 11842103316Sopenharmony_ci "src/usb_device_pipe_mock_test.cpp", 11942103316Sopenharmony_ci "src/usb_impl_mock.cpp", 12042103316Sopenharmony_ci ] 12142103316Sopenharmony_ci 12242103316Sopenharmony_ci configs = [ 12342103316Sopenharmony_ci "${utils_path}:utils_config", 12442103316Sopenharmony_ci ":module_private_config", 12542103316Sopenharmony_ci ] 12642103316Sopenharmony_ci 12742103316Sopenharmony_ci deps = [ 12842103316Sopenharmony_ci "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 12942103316Sopenharmony_ci "${usb_manager_path}/services:usbservice", 13042103316Sopenharmony_ci "//third_party/cJSON:cjson", 13142103316Sopenharmony_ci "//third_party/googletest:gmock_main", 13242103316Sopenharmony_ci "//third_party/googletest:gtest_main", 13342103316Sopenharmony_ci ] 13442103316Sopenharmony_ci 13542103316Sopenharmony_ci external_deps = [ 13642103316Sopenharmony_ci "ability_base:want", 13742103316Sopenharmony_ci "ability_runtime:ability_manager", 13842103316Sopenharmony_ci "access_token:libaccesstoken_sdk", 13942103316Sopenharmony_ci "access_token:libnativetoken", 14042103316Sopenharmony_ci "access_token:libtoken_setproc", 14142103316Sopenharmony_ci "bundle_framework:appexecfwk_base", 14242103316Sopenharmony_ci "bundle_framework:appexecfwk_core", 14342103316Sopenharmony_ci "c_utils:utils", 14442103316Sopenharmony_ci "common_event_service:cesfwk_innerkits", 14542103316Sopenharmony_ci "drivers_interface_usb:libusb_proxy_1.0", 14642103316Sopenharmony_ci "eventhandler:libeventhandler", 14742103316Sopenharmony_ci "hilog:libhilog", 14842103316Sopenharmony_ci "ipc:ipc_core", 14942103316Sopenharmony_ci "samgr:samgr_proxy", 15042103316Sopenharmony_ci ] 15142103316Sopenharmony_ci} 15242103316Sopenharmony_ci 15342103316Sopenharmony_ciohos_unittest("test_mock_usbevent") { 15442103316Sopenharmony_ci module_out_path = module_output_path 15542103316Sopenharmony_ci sources = [ 15642103316Sopenharmony_ci "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", 15742103316Sopenharmony_ci "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", 15842103316Sopenharmony_ci "src/usb_event_mock_test.cpp", 15942103316Sopenharmony_ci "src/usb_impl_mock.cpp", 16042103316Sopenharmony_ci ] 16142103316Sopenharmony_ci 16242103316Sopenharmony_ci configs = [ 16342103316Sopenharmony_ci "${utils_path}:utils_config", 16442103316Sopenharmony_ci ":module_private_config", 16542103316Sopenharmony_ci ] 16642103316Sopenharmony_ci 16742103316Sopenharmony_ci deps = [ 16842103316Sopenharmony_ci "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 16942103316Sopenharmony_ci "${usb_manager_path}/services:usbservice", 17042103316Sopenharmony_ci "//third_party/cJSON:cjson", 17142103316Sopenharmony_ci "//third_party/googletest:gmock_main", 17242103316Sopenharmony_ci "//third_party/googletest:gtest_main", 17342103316Sopenharmony_ci ] 17442103316Sopenharmony_ci 17542103316Sopenharmony_ci external_deps = [ 17642103316Sopenharmony_ci "ability_base:want", 17742103316Sopenharmony_ci "ability_runtime:ability_manager", 17842103316Sopenharmony_ci "access_token:libaccesstoken_sdk", 17942103316Sopenharmony_ci "access_token:libnativetoken", 18042103316Sopenharmony_ci "access_token:libtoken_setproc", 18142103316Sopenharmony_ci "bundle_framework:appexecfwk_base", 18242103316Sopenharmony_ci "bundle_framework:appexecfwk_core", 18342103316Sopenharmony_ci "c_utils:utils", 18442103316Sopenharmony_ci "common_event_service:cesfwk_innerkits", 18542103316Sopenharmony_ci "drivers_interface_usb:libusb_proxy_1.0", 18642103316Sopenharmony_ci "eventhandler:libeventhandler", 18742103316Sopenharmony_ci "hilog:libhilog", 18842103316Sopenharmony_ci "ipc:ipc_core", 18942103316Sopenharmony_ci "samgr:samgr_proxy", 19042103316Sopenharmony_ci ] 19142103316Sopenharmony_ci} 19242103316Sopenharmony_ci 19342103316Sopenharmony_ciohos_unittest("test_mock_usbrequest") { 19442103316Sopenharmony_ci module_out_path = module_output_path 19542103316Sopenharmony_ci sources = [ 19642103316Sopenharmony_ci "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", 19742103316Sopenharmony_ci "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", 19842103316Sopenharmony_ci "src/usb_impl_mock.cpp", 19942103316Sopenharmony_ci "src/usb_request_mock_test.cpp", 20042103316Sopenharmony_ci ] 20142103316Sopenharmony_ci 20242103316Sopenharmony_ci configs = [ 20342103316Sopenharmony_ci "${utils_path}:utils_config", 20442103316Sopenharmony_ci ":module_private_config", 20542103316Sopenharmony_ci ] 20642103316Sopenharmony_ci 20742103316Sopenharmony_ci deps = [ 20842103316Sopenharmony_ci "${usb_manager_path}/interfaces/innerkits:usbsrv_client", 20942103316Sopenharmony_ci "${usb_manager_path}/services:usbservice", 21042103316Sopenharmony_ci "//third_party/cJSON:cjson", 21142103316Sopenharmony_ci "//third_party/googletest:gmock_main", 21242103316Sopenharmony_ci "//third_party/googletest:gtest_main", 21342103316Sopenharmony_ci ] 21442103316Sopenharmony_ci 21542103316Sopenharmony_ci external_deps = [ 21642103316Sopenharmony_ci "ability_base:want", 21742103316Sopenharmony_ci "ability_runtime:ability_manager", 21842103316Sopenharmony_ci "access_token:libaccesstoken_sdk", 21942103316Sopenharmony_ci "access_token:libnativetoken", 22042103316Sopenharmony_ci "access_token:libtoken_setproc", 22142103316Sopenharmony_ci "bundle_framework:appexecfwk_base", 22242103316Sopenharmony_ci "bundle_framework:appexecfwk_core", 22342103316Sopenharmony_ci "c_utils:utils", 22442103316Sopenharmony_ci "common_event_service:cesfwk_innerkits", 22542103316Sopenharmony_ci "drivers_interface_usb:libusb_proxy_1.0", 22642103316Sopenharmony_ci "eventhandler:libeventhandler", 22742103316Sopenharmony_ci "hilog:libhilog", 22842103316Sopenharmony_ci "ipc:ipc_core", 22942103316Sopenharmony_ci "samgr:samgr_proxy", 23042103316Sopenharmony_ci ] 23142103316Sopenharmony_ci} 23242103316Sopenharmony_ci 23342103316Sopenharmony_cigroup("usb_auto_test") { 23442103316Sopenharmony_ci testonly = true 23542103316Sopenharmony_ci deps = [ 23642103316Sopenharmony_ci ":test_mock_bulkcallback", 23742103316Sopenharmony_ci ":test_mock_usbcore", 23842103316Sopenharmony_ci ":test_mock_usbdevicepipe", 23942103316Sopenharmony_ci ":test_mock_usbevent", 24042103316Sopenharmony_ci ":test_mock_usbrequest", 24142103316Sopenharmony_ci ] 24242103316Sopenharmony_ci} 243