1# Copyright (c) 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("//build/lite/config/component/lite_component.gni")
15import("//build/ohos.gni")
16import("//build/test.gni")
17import("../../../adapter/common/net/bluetooth/net_bluetooth.gni")
18import("../../../core/common/dfx/dsoftbus_dfx.gni")
19import("../../../dsoftbus.gni")
20
21dsoftbus_root_path = "../../.."
22
23if (!defined(ohos_lite)) {
24  module_output_path = "dsoftbus/adapter"
25  bt_test_sources = [ "bluetooth_mock.cpp" ]
26  bt_test_sources += adapter_ble_src
27
28  bt_test_inc = [ "../../../adapter/common/net/bluetooth/include" ]
29  bt_test_inc += adapter_ble_inc
30
31  bt_test_deps = [
32    "$dsoftbus_dfx_path/log:softbus_dfx_log",
33    "$dsoftbus_root_path/core/common:softbus_utils",
34  ]
35
36  bt_test_external_deps = [
37    "c_utils:utils",
38    "googletest:gmock_main",
39    "googletest:gtest_main",
40    "hilog:libhilog",
41  ]
42
43  if (support_bluetooth &&
44      (dsoftbus_feature_conn_ble || dsoftbus_feature_conn_br)) {
45    bt_test_external_deps += [ "bluetooth:btframework" ]
46  }
47
48  ohos_unittest("AdapterBleGattServerTest") {
49    module_out_path = module_output_path
50    sources = bt_test_sources
51    sources += [ "softbus_adapter_ble_gatt_server_test.cpp" ]
52
53    include_dirs = bt_test_inc
54    deps = bt_test_deps
55    external_deps = bt_test_external_deps
56  }
57
58  ohos_unittest("AdapterBleGattClientTest") {
59    module_out_path = module_output_path
60    sources = bt_test_sources
61    sources += [ "softbus_adapter_ble_gatt_client_test.cpp" ]
62
63    include_dirs = bt_test_inc
64    deps = bt_test_deps
65    external_deps = bt_test_external_deps
66  }
67
68  ohos_unittest("AdapterBtUtilsTest") {
69    module_out_path = module_output_path
70    sources = [ "adapter_bt_utils_test.cpp" ]
71    sources += adapter_ble_src
72
73    include_dirs = bt_test_inc
74    deps = bt_test_deps
75    external_deps = bt_test_external_deps
76  }
77
78  ohos_unittest("AdapterBtCommonTest") {
79    module_out_path = module_output_path
80    sources = bt_test_sources
81    sources += [ "softbus_adapter_bt_common_test.cpp" ]
82
83    include_dirs = bt_test_inc
84    deps = bt_test_deps
85    external_deps = bt_test_external_deps
86  }
87
88  group("unittest") {
89    testonly = true
90    deps = []
91    if (support_bluetooth &&
92        (dsoftbus_feature_conn_ble || dsoftbus_feature_conn_br)) {
93      deps += [
94        ":AdapterBleGattClientTest",
95        ":AdapterBleGattServerTest",
96        ":AdapterBtCommonTest",
97        ":AdapterBtUtilsTest",
98        "broadcast:unittest",
99      ]
100    }
101  }
102}
103