1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SOFTBUS_BLE_MGR_MOCK_H 17 #define SOFTBUS_BLE_MGR_MOCK_H 18 19 #include "gmock/gmock.h" 20 21 #include "softbus_adapter_bt_common.h" 22 #include "softbus_ble_gatt.h" 23 #include "softbus_broadcast_adapter_interface.h" 24 #include "softbus_broadcast_manager.h" 25 26 class BleGattInterface { 27 public: 28 virtual void SoftbusBleAdapterInit() = 0; 29 virtual int SoftBusAddBtStateListener(const SoftBusBtStateListener *listener) = 0; 30 virtual int SoftBusRemoveBtStateListener(int listenerId) = 0; 31 }; 32 33 class ManagerMock : public BleGattInterface { 34 public: 35 static ManagerMock* GetMock(); 36 37 ManagerMock(); 38 ~ManagerMock(); 39 40 MOCK_METHOD(void, SoftbusBleAdapterInit, (), (override)); 41 MOCK_METHOD(int, SoftBusAddBtStateListener, (const SoftBusBtStateListener *listener), (override)); 42 MOCK_METHOD(int, SoftBusRemoveBtStateListener, (int listenerId), (override)); 43 44 static const SoftbusBroadcastCallback *broadcastCallback; 45 static const SoftbusScanCallback *scanCallback; 46 static inline const SoftbusScanCallback *softbusScanCallback {}; 47 static inline const SoftbusBroadcastCallback *softbusBroadcastCallback {}; 48 49 private: 50 static ManagerMock *managerMock; 51 }; 52 53 #endif /* SOFTBUS_BLE_MGR_MOCK_H */