• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_LANE_QUERY_DEPS_MOCK_H
17 #define LNN_LANE_QUERY_DEPS_MOCK_H
18 
19 #include <gmock/gmock.h>
20 
21 #include "bus_center_manager.h"
22 #include "lnn_distributed_net_ledger.h"
23 #include "lnn_feature_capability.h"
24 #include "lnn_lane_interface.h"
25 #include "softbus_wifi_api_adapter.h"
26 #include "wifi_direct_manager.h"
27 
28 namespace OHOS {
29 class LaneQueryDepsInterface {
30 public:
LaneQueryDepsInterface()31     LaneQueryDepsInterface() {};
~LaneQueryDepsInterface()32     virtual ~LaneQueryDepsInterface() {};
33 
34     virtual int32_t LnnGetRemoteNodeInfoById(const char *id, IdCategory type, NodeInfo *info) = 0;
35     virtual bool LnnHasDiscoveryType(const NodeInfo *info, DiscoveryType type) = 0;
36     virtual struct WifiDirectManager* GetWifiDirectManager(void) = 0;
37     virtual int32_t LnnGetRemoteNumU32Info(const char *networkId, InfoKey key, uint32_t *info) = 0;
38     virtual int32_t LnnGetLocalNumU32Info(InfoKey key, uint32_t *info) = 0;
39     virtual SoftBusWifiDetailState SoftBusGetWifiState(void) = 0;
40     virtual bool SoftBusIsWifiActive(void) = 0;
41     virtual bool IsFeatureSupport(uint64_t feature, FeatureCapability capaBit) = 0;
42     virtual int32_t LnnGetRemoteBoolInfo(const char *networkId, InfoKey key, bool *info) = 0;
43     virtual uint64_t LnnGetFeatureCapabilty(void) = 0;
44     virtual bool LnnGetOnlineStateById(const char *id, IdCategory type) = 0;
45     virtual int32_t CheckStaticNetCap(const char *networkId, LaneLinkType linkType) = 0;
46     virtual int32_t CheckDynamicNetCap(const char *networkId, LaneLinkType linkType) = 0;
47 };
48 
49 class LaneQueryDepsInterfaceMock : public LaneQueryDepsInterface {
50 public:
51     LaneQueryDepsInterfaceMock();
52     ~LaneQueryDepsInterfaceMock() override;
53 
54     MOCK_METHOD3(LnnGetRemoteNodeInfoById, int32_t (const char *id, IdCategory type, NodeInfo *info));
55     MOCK_METHOD2(LnnHasDiscoveryType, bool (const NodeInfo *info, DiscoveryType type));
56     MOCK_METHOD0(GetWifiDirectManager, struct WifiDirectManager* (void));
57     MOCK_METHOD3(LnnGetRemoteNumU32Info, int32_t (const char *networkId, InfoKey key, uint32_t *info));
58     MOCK_METHOD2(LnnGetLocalNumU32Info, int32_t (InfoKey key, uint32_t *info));
59     MOCK_METHOD0(SoftBusGetWifiState, SoftBusWifiDetailState (void));
60     MOCK_METHOD0(SoftBusIsWifiActive, bool (void));
61     MOCK_METHOD2(IsFeatureSupport, bool (uint64_t feature, FeatureCapability capaBit));
62     MOCK_METHOD3(LnnGetRemoteBoolInfo, int32_t (const char *networkId, InfoKey key, bool *info));
63     MOCK_METHOD0(LnnGetFeatureCapabilty, uint64_t (void));
64     MOCK_METHOD2(LnnGetOnlineStateById, bool(const char *, IdCategory));
65     MOCK_METHOD2(CheckStaticNetCap, int32_t (const char *networkId, LaneLinkType linkType));
66     MOCK_METHOD2(CheckDynamicNetCap, int32_t (const char *networkId, LaneLinkType linkType));
67 };
68 } // namespace OHOS
69 #endif // LNN_LANE_QUERY_DEPS_MOCK_H