# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("./../../../usbmgr.gni") module_output_path = "${usb_manager_part_name}/usb_unittest_test" config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "include", "//third_party/googletest/googlemock/include", "${usb_manager_path}/interfaces/kits/js/napi/include", "${usb_manager_path}/utils/native/include", "${usb_manager_path}/test/common/include", "${usb_manager_path}/test/native/mock/include", "${usb_manager_path}/test/native/service_unittest/include", ] } ohos_unittest("test_mock_bulkcallback") { module_out_path = module_output_path sources = [ "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", "${usb_manager_path}/test/common/src/usb_callback_test.cpp", "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", "src/usb_bulkcallback_mock_test.cpp", "src/usb_impl_mock.cpp", ] configs = [ "${utils_path}:utils_config", ":module_private_config", ] deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client", "${usb_manager_path}/services:usbservice", "//third_party/cJSON:cjson", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "drivers_interface_usb:libusb_proxy_1.0", "eventhandler:libeventhandler", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] } ohos_unittest("test_mock_usbcore") { module_out_path = module_output_path sources = [ "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", "src/usb_core_mock_test.cpp", "src/usb_impl_mock.cpp", ] configs = [ "${utils_path}:utils_config", ":module_private_config", ] deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client", "${usb_manager_path}/services:usbservice", "//third_party/cJSON:cjson", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "drivers_interface_usb:libusb_proxy_1.0", "eventhandler:libeventhandler", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] } ohos_unittest("test_mock_usbdevicepipe") { module_out_path = module_output_path sources = [ "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", "src/usb_device_pipe_mock_test.cpp", "src/usb_impl_mock.cpp", ] configs = [ "${utils_path}:utils_config", ":module_private_config", ] deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client", "${usb_manager_path}/services:usbservice", "//third_party/cJSON:cjson", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "drivers_interface_usb:libusb_proxy_1.0", "eventhandler:libeventhandler", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] } ohos_unittest("test_mock_usbevent") { module_out_path = module_output_path sources = [ "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", "src/usb_event_mock_test.cpp", "src/usb_impl_mock.cpp", ] configs = [ "${utils_path}:utils_config", ":module_private_config", ] deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client", "${usb_manager_path}/services:usbservice", "//third_party/cJSON:cjson", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "drivers_interface_usb:libusb_proxy_1.0", "eventhandler:libeventhandler", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] } ohos_unittest("test_mock_usbrequest") { module_out_path = module_output_path sources = [ "${usb_manager_path}/services/native/src/usb_service_subscriber.cpp", "${usb_manager_path}/test/native/service_unittest/src/usb_common_test.cpp", "src/usb_impl_mock.cpp", "src/usb_request_mock_test.cpp", ] configs = [ "${utils_path}:utils_config", ":module_private_config", ] deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client", "${usb_manager_path}/services:usbservice", "//third_party/cJSON:cjson", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:ability_manager", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "drivers_interface_usb:libusb_proxy_1.0", "eventhandler:libeventhandler", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] } group("usb_auto_test") { testonly = true deps = [ ":test_mock_bulkcallback", ":test_mock_usbcore", ":test_mock_usbdevicepipe", ":test_mock_usbevent", ":test_mock_usbrequest", ] }