1 /* 2 * Copyright (c) 2025 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 AUTH_AUTH_SESSION_FSM_MOCK_H 17 #define AUTH_AUTH_SESSION_FSM_MOCK_H 18 19 #include <gmock/gmock.h> 20 21 #include "auth_request.h" 22 #include "auth_session_fsm_struct.h" 23 #include "lnn_distributed_net_ledger.h" 24 #include "lnn_node_info_struct.h" 25 26 namespace OHOS { 27 class AuthSessionFsmInterface { 28 public: AuthSessionFsmInterface()29 AuthSessionFsmInterface() {}; ~AuthSessionFsmInterface()30 virtual ~AuthSessionFsmInterface() {}; 31 32 virtual int32_t SoftBusGetBrState(void) = 0; 33 virtual bool GetUdidShortHash(const AuthSessionInfo *info, char *udidBuf, uint32_t bufLen) = 0; 34 virtual int32_t LnnRetrieveDeviceInfoPacked(const char *udid, NodeInfo *deviceInfo) = 0; 35 virtual bool IsSupportFeatureByCapaBit(uint32_t feature, AuthCapability capaBit) = 0; 36 virtual int32_t GetAuthRequest(uint32_t requestId, AuthRequest *request) = 0; 37 virtual int32_t LnnRetrieveDeviceInfoByUdidPacked(const char *udid, NodeInfo *deviceInfo) = 0; 38 virtual int32_t LnnGetRemoteNodeInfoById(const char *id, IdCategory type, NodeInfo *info) = 0; 39 virtual int32_t PostDeviceInfoMessage(int64_t authSeq, const AuthSessionInfo *info) = 0; 40 virtual int32_t ProcessDeviceIdMessage(AuthSessionInfo *info, const uint8_t *data, uint32_t len, 41 int64_t authSeq) = 0; 42 virtual int32_t PostDeviceIdMessage(int64_t authSeq, const AuthSessionInfo *info) = 0; 43 virtual bool LnnIsNeedInterceptBroadcast(bool disableGlass) = 0; 44 }; 45 46 class AuthSessionFsmInterfaceMock : public AuthSessionFsmInterface { 47 public: 48 AuthSessionFsmInterfaceMock(); 49 ~AuthSessionFsmInterfaceMock() override; 50 51 MOCK_METHOD0(SoftBusGetBrState, int32_t (void)); 52 MOCK_METHOD3(GetUdidShortHash, bool (const AuthSessionInfo *, char *, uint32_t)); 53 MOCK_METHOD2(LnnRetrieveDeviceInfoPacked, int32_t (const char *, NodeInfo *)); 54 MOCK_METHOD2(IsSupportFeatureByCapaBit, bool (uint32_t, AuthCapability)); 55 MOCK_METHOD2(GetAuthRequest, int32_t (uint32_t, AuthRequest *)); 56 MOCK_METHOD2(LnnRetrieveDeviceInfoByUdidPacked, int32_t (const char *, NodeInfo *)); 57 MOCK_METHOD3(LnnGetRemoteNodeInfoById, int32_t (const char *, IdCategory, NodeInfo *)); 58 MOCK_METHOD2(PostDeviceInfoMessage, int32_t (int64_t, const AuthSessionInfo *)); 59 MOCK_METHOD4(ProcessDeviceIdMessage, int32_t (AuthSessionInfo *, const uint8_t *, uint32_t, int64_t)); 60 MOCK_METHOD2(PostDeviceIdMessage, int32_t (int64_t, const AuthSessionInfo *)); 61 MOCK_METHOD1(LnnIsNeedInterceptBroadcast, bool (bool)); 62 }; 63 } 64 #endif // AUTH_AUTH_SESSION_FSM_MOCK_H 65