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