• 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 #ifndef OHOS_WIFI_HAL_DEVICE_MANAGE_TEST_H
16 #define OHOS_WIFI_HAL_DEVICE_MANAGE_TEST_H
17 #ifdef HDI_CHIP_INTERFACE_SUPPORT
18 
19 #include <gtest/gtest.h>
20 #include "hal_device_manage.h"
21 
22 namespace OHOS {
23 namespace Wifi {
24 class WifiHalDeviceManagerTest : public testing::Test {
25 public:
SetUpTestCase()26     static void SetUpTestCase()
27     {}
TearDownTestCase()28     static void TearDownTestCase()
29     {}
SetUp()30     virtual void SetUp()
31     {
32         DelayedSingleton<HalDeviceManager>::GetInstance()->StartChipHdi();
33     }
TearDown()34     virtual void TearDown()
35     {
36         DelayedSingleton<HalDeviceManager>::GetInstance()->StopChipHdi();
37     }
38 
39     static void DestoryCallback(std::string &destoryIfaceName, int createIfaceType);
40     static void OnRssiReportCallback(int index, int antRssi);
41 };
42 
43 class IChipIfaceTest : public IChipIface {
44 public:
45     IChipIfaceTest() = default;
46     ~IChipIfaceTest() = default;
GetIfaceType(IfaceType & type)47     virtual int32_t GetIfaceType(IfaceType& type)
48     {
49         return 0;
50     }
GetIfaceName(std::string & name)51     virtual int32_t GetIfaceName(std::string& name)
52     {
53         return 0;
54     }
GetIfaceCap(uint32_t & capabilities)55     virtual int32_t GetIfaceCap(uint32_t& capabilities)
56     {
57         return 0;
58     }
GetSupportFreqs(int32_t band,std::vector<uint32_t> & frequencies)59     virtual int32_t GetSupportFreqs(int32_t band, std::vector<uint32_t>& frequencies)
60     {
61         return 0;
62     }
SetMacAddress(const std::string & mac)63     virtual int32_t SetMacAddress(const std::string& mac)
64     {
65         return 0;
66     }
SetCountryCode(const std::string & code)67     virtual int32_t SetCountryCode(const std::string& code)
68     {
69         return 0;
70     }
GetPowerMode(int32_t & powerMode)71     virtual int32_t GetPowerMode(int32_t& powerMode)
72     {
73         return 0;
74     }
RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback> & chipIfaceCallback)75     virtual int32_t RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback)
76     {
77         return 0;
78     }
UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback> & chipIfaceCallback)79     virtual int32_t UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback)
80     {
81         return 0;
82     }
StartScan(const ScanParams & scanParam)83     virtual int32_t StartScan(const ScanParams& scanParam)
84     {
85         return 0;
86     }
GetScanInfos(std::vector<ScanResultsInfo> & scanResultsInfo)87     virtual int32_t GetScanInfos(std::vector<ScanResultsInfo>& scanResultsInfo)
88     {
89         return 0;
90     }
StartPnoScan(const PnoScanParams & pnoParams)91     virtual int32_t StartPnoScan(const PnoScanParams& pnoParams)
92     {
93         return 0;
94     }
StopPnoScan()95     virtual int32_t StopPnoScan()
96     {
97         return 0;
98     }
GetSignalPollInfo(SignalPollResult & signalPollresult)99     virtual int32_t GetSignalPollInfo(SignalPollResult& signalPollresult)
100     {
101         return 0;
102     }
EnablePowerMode(int32_t mode)103     virtual int32_t EnablePowerMode(int32_t mode)
104     {
105         return 0;
106     }
SetDpiMarkRule(int32_t uid,int32_t protocol,int32_t enable)107     virtual int32_t SetDpiMarkRule(int32_t uid, int32_t protocol, int32_t enable)
108     {
109         return 0;
110     }
SetTxPower(int32_t power)111     virtual int32_t SetTxPower(int32_t power)
112     {
113         return 0;
114     }
SetPowerMode(int32_t powerMode)115     virtual int32_t SetPowerMode(int32_t powerMode)
116     {
117         return 0;
118     }
119 };
120 
121 class IConcreteChipTest : public IConcreteChip {
122 public:
123     IConcreteChipTest() = default;
124     ~IConcreteChipTest() = default;
GetChipId(int32_t & id)125     virtual int32_t GetChipId(int32_t& id)
126     {
127         return 0;
128     }
RegisterChipEventCallback(const sptr<IConcreteChipCallback> & chipEventcallback)129     virtual int32_t RegisterChipEventCallback(const sptr<IConcreteChipCallback>& chipEventcallback)
130     {
131         return 0;
132     }
GetChipModes(std::vector<UsableMode> & modes)133     virtual int32_t GetChipModes(std::vector<UsableMode>& modes)
134     {
135         return 0;
136     }
GetChipCaps(uint32_t & capabilities)137     virtual int32_t GetChipCaps(uint32_t& capabilities)
138     {
139         return 0;
140     }
GetCurrentMode(uint32_t & modeId)141     virtual int32_t GetCurrentMode(uint32_t& modeId)
142     {
143         return 0;
144     }
CreateApService(sptr<IChipIface> & iface)145     virtual int32_t CreateApService(sptr<IChipIface>& iface)
146     {
147         return 0;
148     }
GetApServiceIfNames(std::vector<std::string> & ifnames)149     virtual int32_t GetApServiceIfNames(std::vector<std::string>& ifnames)
150     {
151         return 0;
152     }
GetApService(const std::string & ifname,sptr<IChipIface> & iface)153     virtual int32_t GetApService(const std::string& ifname, sptr<IChipIface>& iface)
154     {
155         return 0;
156     }
RemoveApService(const std::string & ifname)157     virtual int32_t RemoveApService(const std::string& ifname)
158     {
159         return 0;
160     }
CreateP2pService(sptr<IChipIface> & iface)161     virtual int32_t CreateP2pService(sptr<IChipIface>& iface)
162     {
163         return 0;
164     }
GetP2pServiceIfNames(std::vector<std::string> & ifnames)165     virtual int32_t GetP2pServiceIfNames(std::vector<std::string>& ifnames)
166     {
167         return 0;
168     }
GetP2pService(const std::string & ifname,sptr<IChipIface> & iface)169     virtual int32_t GetP2pService(const std::string& ifname, sptr<IChipIface>& iface)
170     {
171         return 0;
172     }
RemoveP2pService(const std::string & ifname)173     virtual int32_t RemoveP2pService(const std::string& ifname)
174     {
175         return 0;
176     }
CreateStaService(sptr<IChipIface> & iface)177     virtual int32_t CreateStaService(sptr<IChipIface>& iface)
178     {
179         return 0;
180     }
GetStaServiceIfNames(std::vector<std::string> & ifnames)181     virtual int32_t GetStaServiceIfNames(std::vector<std::string>& ifnames)
182     {
183         return 0;
184     }
GetStaService(const std::string & ifname,sptr<IChipIface> & iface)185     virtual int32_t GetStaService(const std::string& ifname, sptr<IChipIface>& iface)
186     {
187         return 0;
188     }
RemoveStaService(const std::string & ifname)189     virtual int32_t RemoveStaService(const std::string& ifname)
190     {
191         return 0;
192     }
SetChipMode(uint32_t modeId)193     virtual int32_t SetChipMode(uint32_t modeId)
194     {
195         return 0;
196     }
197 };
198 }  // namespace Wifi
199 }  // namespace OHOS
200 #endif
201 #endif