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 LNN_WIFISERVICE_MONITOR_MOCK_H 17 #define LNN_WIFISERVICE_MONITOR_MOCK_H 18 19 #include <gmock/gmock.h> 20 #include <mutex> 21 #include "message_handler.h" 22 #include "softbus_wifi_api_adapter.h" 23 24 typedef void (*LnnAsyncCallbackFunc)(void *para); 25 26 namespace OHOS { 27 class LnnWifiServiceMonitorInterface { 28 public: LnnWifiServiceMonitorInterface()29 LnnWifiServiceMonitorInterface() {}; ~LnnWifiServiceMonitorInterface()30 virtual ~LnnWifiServiceMonitorInterface() {}; 31 32 virtual SoftBusLooper *GetLooper(int32_t looper) = 0; 33 virtual void LnnNotifyWlanStateChangeEvent(void *state) = 0; 34 virtual int32_t LnnAsyncCallbackHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback, void *para) = 0; 35 virtual bool SoftBusIsWifiActive(void) = 0; 36 virtual int32_t SoftBusGetLinkedInfo(SoftBusWifiLinkedInfo *info) = 0; 37 virtual int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback, 38 void *para, uint64_t delayMillis) = 0; 39 }; 40 class LnnWifiServiceMonitorInterfaceMock : public LnnWifiServiceMonitorInterface { 41 public: 42 LnnWifiServiceMonitorInterfaceMock(); 43 ~LnnWifiServiceMonitorInterfaceMock() override; 44 45 MOCK_METHOD1(GetLooper, SoftBusLooper*(int32_t)); 46 MOCK_METHOD1(LnnNotifyWlanStateChangeEvent, void(void *)); 47 MOCK_METHOD3(LnnAsyncCallbackHelper, int32_t(SoftBusLooper *, LnnAsyncCallbackFunc, void *)); 48 MOCK_METHOD0(SoftBusIsWifiActive, bool(void)); 49 MOCK_METHOD1(SoftBusGetLinkedInfo, int32_t(SoftBusWifiLinkedInfo *)); 50 MOCK_METHOD4(LnnAsyncCallbackDelayHelper, int32_t(SoftBusLooper *, LnnAsyncCallbackFunc, void *, uint64_t)); 51 }; 52 } // namespace OHOS 53 #endif // LNN_WIFISERVICE_MONITOR_MOCK_H