1# Copyright (c) 2021 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/lite/config/component/lite_component.gni") 15import("//build/ohos.gni") 16import("//build/test.gni") 17import("//foundation/communication/dsoftbus/dsoftbus.gni") 18import("//foundation/communication/dsoftbus/tests/utils/utils.gni") 19 20module_output_path = "dsoftbus/discovery" 21 22ohos_unittest("DiscManagerTest") { 23 module_out_path = module_output_path 24 sources = [ "disc_manager_test.cpp" ] 25 26 include_dirs = [ 27 "$softbus_adapter_common/include", 28 "$dsoftbus_root_path/core/common/include", 29 "$dsoftbus_root_path/core/discovery/interface", 30 "$dsoftbus_root_path/interfaces/kits/common", 31 "$dsoftbus_root_path/interfaces/kits/discovery", 32 "$dsoftbus_root_path/core/discovery/manager/include", 33 "$dsoftbus_root_path/core/discovery/coap/include", 34 "//commonlibrary/c_utils/base/include", 35 "unittest/common/", 36 "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface", 37 ] 38 39 deps = [ 40 "$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl", 41 "$dsoftbus_root_path/core/frame:softbus_server", 42 "//third_party/googletest:gtest_main", 43 ] 44 45 if (is_standard_system) { 46 external_deps = [ 47 "c_utils:utils", 48 "hiviewdfx_hilog_native:libhilog", 49 ] 50 } else { 51 external_deps = [ 52 "c_utils:utils", 53 "hilog:libhilog", 54 ] 55 } 56} 57 58ohos_unittest("DiscManagerMockTest") { 59 module_out_path = module_output_path 60 sources = [ 61 "$dsoftbus_core_path/discovery/manager/src/disc_manager.c", 62 "ble_mock.cpp", 63 "coap_mock.cpp", 64 "disc_manager_mock_test.cpp", 65 ] 66 sources += test_utils_src 67 68 include_dirs = [ 69 "$dsoftbus_root_path/interfaces/kits/common", 70 "$dsoftbus_root_path/interfaces/kits/discovery", 71 "$dsoftbus_core_path/common/include", 72 "$dsoftbus_core_path/common/dfx/hisysevent_adapter/include", 73 "$dsoftbus_core_path/common/dfx/hidumper_adapter/include", 74 "$softbus_adapter_common/include", 75 "$dsoftbus_core_path/discovery/interface", 76 "$dsoftbus_core_path/discovery/ipc/include", 77 "$dsoftbus_core_path/discovery/manager/include", 78 "$dsoftbus_core_path/discovery/ble/dispatcher/include", 79 "$dsoftbus_core_path/discovery/coap/include", 80 ] 81 include_dirs += test_utils_inc 82 83 deps = [ 84 "$dsoftbus_root_path/adapter:softbus_adapter", 85 "$dsoftbus_root_path/core/common:softbus_utils", 86 "//third_party/googletest:gmock", 87 "//third_party/googletest:gtest_main", 88 ] 89 90 if (is_standard_system) { 91 external_deps = [ 92 "c_utils:utils", 93 "hiviewdfx_hilog_native:libhilog", 94 ] 95 } else { 96 external_deps = [ 97 "c_utils:utils", 98 "hilog:libhilog", 99 ] 100 } 101} 102 103group("unittest") { 104 testonly = true 105 deps = [ 106 ":DiscManagerMockTest", 107 ":DiscManagerTest", 108 ] 109} 110