1# Copyright (c) 2022-2025 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( 16 "//foundation/distributedhardware/distributed_screen/distributedscreen.gni") 17 18module_out_path = "distributed_screen/distributed_screen/soft_bus_adapter_test" 19 20config("module_private_config") { 21 visibility = [ ":*" ] 22 include_dirs = [ 23 "include", 24 "${common_path}/include", 25 "${services_path}/common/databuffer/include", 26 "${services_path}/common/screen_channel/include", 27 "${services_path}/common/utils/include", 28 "${services_path}/screentransport/test/unittest/screensourcetrans/include", 29 "${services_path}/screentransport/screensourcetrans/include", 30 "${services_path}/screentransport/screendatachannel/include", 31 "${services_path}/screentransport/screensourceprocessor/include", 32 "${services_path}/screentransport/screensourceprocessor/encoder/include", 33 "${services_path}/softbusadapter/include", 34 ] 35} 36 37## UnitTest screen_soft_bus_adapter_test 38ohos_unittest("SoftBusAdapterTest") { 39 module_out_path = module_out_path 40 41 sources = [ "${services_path}/softbusadapter/test/unittest/src/softbus_adapter_test.cpp" ] 42 43 configs = [ 44 ":module_private_config", 45 "${common_path}/test/unittest/resource:dscreen_unittest_public_config", 46 ] 47 48 defines = [ 49 "HI_LOG_ENABLE", 50 "DH_LOG_TAG=\"SoftbusAdapterTest\"", 51 "LOG_DOMAIN=0xD004140", 52 "NORMAL_MOCK", 53 ] 54 55 deps = [ "${services_path}/screentransport/screensourcetrans:distributed_screen_sourcetrans" ] 56 57 external_deps = [ 58 "access_token:libaccesstoken_sdk", 59 "access_token:libnativetoken_shared", 60 "access_token:libtokensetproc_shared", 61 "c_utils:utils", 62 "device_manager:devicemanagersdk", 63 "distributed_hardware_fwk:distributedhardwareutils", 64 "dsoftbus:softbus_client", 65 "googletest:gmock", 66 "googletest:gtest_main", 67 "hilog:libhilog", 68 "os_account:libaccountkits", 69 "os_account:os_account_innerkits", 70 "safwk:system_ability_fwk", 71 "samgr:samgr_proxy", 72 ] 73 74 if (need_same_account) { 75 defines += [ "SUPPORT_SAME_ACCOUNT" ] 76 } 77} 78 79ohos_unittest("SoftbusPermissionCheckTest") { 80 module_out_path = module_out_path 81 82 include_dirs = [ 83 "${services_path}/softbusadapter/include", 84 "${services_path}/softbusadapter/test/unittest/include" 85 ] 86 87 sources = [ 88 "${services_path}/softbusadapter/src/softbus_permission_check.cpp", 89 "${services_path}/softbusadapter/test/unittest/src/device_manager_impl_mock.cpp", 90 "${services_path}/softbusadapter/test/unittest/src/mock_other_method.cpp", 91 "${services_path}/softbusadapter/test/unittest/src/socket_mock.cpp", 92 "${services_path}/softbusadapter/test/unittest/src/softbus_permission_check_test.cpp", 93 ] 94 95 configs = [ 96 ":module_private_config", 97 "${common_path}/test/unittest/resource:dscreen_unittest_public_config", 98 ] 99 100 defines = [ 101 "HI_LOG_ENABLE", 102 "DH_LOG_TAG=\"SoftbusPermissionCheckTest\"", 103 "LOG_DOMAIN=0xD004140", 104 "NORMAL_MOCK", 105 ] 106 107 external_deps = [ 108 "access_token:libaccesstoken_sdk", 109 "c_utils:utils", 110 "device_manager:devicemanagersdk", 111 "dsoftbus:softbus_client", 112 "googletest:gmock_main", 113 "googletest:gtest_main", 114 "hilog:libhilog", 115 "hisysevent:libhisysevent", 116 "ipc:ipc_core", 117 "os_account:libaccountkits", 118 "os_account:os_account_innerkits", 119 "safwk:system_ability_fwk", 120 "samgr:samgr_proxy", 121 ] 122 123 if (need_same_account) { 124 defines += [ "SUPPORT_SAME_ACCOUNT" ] 125 } 126} 127 128group("soft_bus_adapter_test") { 129 testonly = true 130 deps = [ 131 ":SoftBusAdapterTest", 132 ":SoftbusPermissionCheckTest", 133 ] 134} 135