• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 #include <gtest/gtest.h>
17 #include <osal_mem.h>
18 #include "wifi_driver_client.h"
19 #ifdef OHOS_ARCH_LITE
20 #include "hostapd_client.h"
21 #include "wpa_client.h"
22 #endif
23 #include "securec.h"
24 
25 using namespace testing::ext;
26 
27 namespace ClientTest {
28 const uint32_t DEFAULT_COMBO_SIZE = 10;
29 const char *WLAN_IFNAME = "wlan0";
30 const std::string g_errlog = "wifitest";
31 const uint32_t RESET_TIME = 3;
32 class WifiClientTest : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36     void SetUp();
37     void TearDown();
38 };
39 
SetUpTestCase()40 void WifiClientTest::SetUpTestCase()
41 {
42 }
43 
TearDownTestCase()44 void WifiClientTest::TearDownTestCase()
45 {
46 }
47 
SetUp()48 void WifiClientTest::SetUp()
49 {
50     WifiDriverClientInit();
51 }
52 
TearDown()53 void WifiClientTest::TearDown()
54 {
55     WifiDriverClientDeinit();
56 }
57 
Hid2dFunCb(const uint8_t * recvMsg,uint32_t recvMsgLen)58 static int32_t Hid2dFunCb(const uint8_t *recvMsg, uint32_t recvMsgLen)
59 {
60     (void)recvMsg;
61     (void)recvMsgLen;
62     return RET_CODE_SUCCESS;
63 }
64 
65 /**
66  * @tc.name: WifiClientSetResetDriver001
67  * @tc.desc: Wifi client reset driver function test
68  * @tc.type: FUNC
69  * @tc.require:
70  */
71 HWTEST_F(WifiClientTest, WifiClientSetResetDriver001, TestSize.Level1)
72 {
73     int32_t ret;
74     uint8_t chipId = 0;
75 
76     ret = AcquireChipId(WLAN_IFNAME, &chipId);
77     ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
78     EXPECT_EQ(RET_CODE_SUCCESS, ret);
79 
80     ret = SetResetDriver(chipId, WLAN_IFNAME);
81     EXPECT_EQ(RET_CODE_SUCCESS, ret);
82     sleep(RESET_TIME);
83 }
84 
85 /**
86  * @tc.name: WifiClientSetCountryCode001
87  * @tc.desc: Wifi client set country code function test
88  * @tc.type: FUNC
89  * @tc.require: AR000FRMJC
90  */
91 HWTEST_F(WifiClientTest, WifiClientSetCountryCode001, TestSize.Level1)
92 {
93     int32_t ret;
94     const char *code = "CN";
95     const char *codeDigital = "99";
96     const char *ifNameInvalid = "wlanTest";
97     uint32_t len = 2;
98 
99     ret = WifiSetCountryCode(ifNameInvalid, code, len);
100     EXPECT_EQ(RET_CODE_FAILURE, ret);
101     ret = WifiSetCountryCode(WLAN_IFNAME, code, len);
102     EXPECT_EQ(RET_CODE_SUCCESS, ret);
103     ret = WifiSetCountryCode(WLAN_IFNAME, codeDigital, len);
104     bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
105     ASSERT_TRUE(flag);
106 }
107 
108 /**
109  * @tc.name: WifiClientGetUsableNetworkInfo001
110  * @tc.desc: Wifi client get usable networkInfo function test
111  * @tc.type: FUNC
112  * @tc.require: AR000FRMJC
113  */
114 HWTEST_F(WifiClientTest, WifiClientGetUsableNetworkInfo001, TestSize.Level1)
115 {
116     int32_t ret;
117     struct NetworkInfoResult networkInfo;
118 
119     ret = GetUsableNetworkInfo(&networkInfo);
120     EXPECT_EQ(RET_CODE_SUCCESS, ret);
121 }
122 
123 /**
124  * @tc.name: WifiClientIsSupportCombo001
125  * @tc.desc: Wifi client is support combo function test
126  * @tc.type: FUNC
127  * @tc.require: AR000FRMJC
128  */
129 HWTEST_F(WifiClientTest, WifiClientIsSupportCombo001, TestSize.Level1)
130 {
131     int32_t ret;
132     uint8_t isSupportCombo;
133 
134     ret = IsSupportCombo(&isSupportCombo);
135     EXPECT_EQ(RET_CODE_SUCCESS, ret);
136 }
137 
138 /**
139  * @tc.name: WifiClientGetComboInfo001
140  * @tc.desc: Wifi client get combo info function test
141  * @tc.type: FUNC
142  * @tc.require: AR000FRMJC
143  */
144 HWTEST_F(WifiClientTest, WifiClientGetComboInfo001, TestSize.Level1)
145 {
146     int32_t ret;
147     uint64_t comboInfo[DEFAULT_COMBO_SIZE] = {};
148 
149     ret = GetComboInfo(comboInfo, DEFAULT_COMBO_SIZE);
150     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
151     ASSERT_TRUE(flag);
152 }
153 
154 /**
155  * @tc.name: WifiClientSetMacAddr001
156  * @tc.desc: Wifi client set mac addr function test
157  * @tc.type: FUNC
158  * @tc.require: AR000FRMJC
159  */
160 HWTEST_F(WifiClientTest, WifiClientSetMacAddr001, TestSize.Level1)
161 {
162     int32_t ret;
163     const char *ifNameInvalid = "wlanTest";
164     unsigned char mac[ETH_ADDR_LEN] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
165     unsigned char errorMac[ETH_ADDR_LEN] = {0x11, 0x34, 0x56, 0x78, 0xab, 0xcd};
166 
167     ret = SetMacAddr(WLAN_IFNAME, mac, ETH_ADDR_LEN);
168     bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_ERR_DEVICE_BUSY);
169     ASSERT_TRUE(flag);
170     ret = SetMacAddr(WLAN_IFNAME, errorMac, ETH_ADDR_LEN);
171     EXPECT_NE(RET_CODE_SUCCESS, ret);
172     ret = SetMacAddr(ifNameInvalid, mac, ETH_ADDR_LEN);
173     EXPECT_NE(RET_CODE_SUCCESS, ret);
174 }
175 
176 /**
177  * @tc.name: WifiClientGetDevMacAddr001
178  * @tc.desc: Wifi client get mac addr function test
179  * @tc.type: FUNC
180  * @tc.require: AR000FRMJC
181  */
182 HWTEST_F(WifiClientTest, WifiClientGetDevMacAddr001, TestSize.Level1)
183 {
184     int32_t ret;
185     unsigned char mac[ETH_ADDR_LEN] = {};
186     int32_t type = WIFI_IFTYPE_STATION;
187     const char *ifNameInvalid = "wlanTest";
188 
189     ret = GetDevMacAddr(WLAN_IFNAME, type, mac, ETH_ADDR_LEN);
190     EXPECT_NE(RET_CODE_FAILURE, ret);
191     ret = GetDevMacAddr(ifNameInvalid, type, mac, ETH_ADDR_LEN);
192     EXPECT_NE(RET_CODE_SUCCESS, ret);
193 }
194 
195 /**
196  * @tc.name: WifiClientGetDevMacAddr002
197  * @tc.desc: Wifi client get mac addr function test
198  * @tc.type: FUNC
199  * @tc.require: AR000H603L
200  */
201 HWTEST_F(WifiClientTest, WifiClientGetDevMacAddr002, TestSize.Level1)
202 {
203     int32_t ret;
204     unsigned char mac[ETH_ADDR_LEN] = {};
205     int32_t type = WIFI_IFTYPE_AP;
206 
207     ret = GetDevMacAddr(WLAN_IFNAME, type, mac, ETH_ADDR_LEN);
208     EXPECT_NE(RET_CODE_FAILURE, ret);
209 }
210 
211 /**
212  * @tc.name: WifiClientGetValidFreqByBand001
213  * @tc.desc: Wifi client get valid freq function test
214  * @tc.type: FUNC
215  * @tc.require: AR000FRMJC
216  */
217 HWTEST_F(WifiClientTest, WifiClientGetValidFreqByBand001, TestSize.Level1)
218 {
219     int32_t ret;
220     int32_t band = IEEE80211_BAND_2GHZ;
221     int32_t bandNotSupport = IEEE80211_NUM_BANDS;
222     struct FreqInfoResult result;
223     uint32_t size = 14;
224     uint32_t i;
225     const char *ifNameInvalid = "wlanTest";
226 
227     result.freqs = (uint32_t *)OsalMemCalloc(35 * sizeof(uint32_t));
228     if (result.freqs == NULL) {
229         printf("%s: OsalMemCalloc failed", __FUNCTION__);
230         return;
231     }
232 
233     result.txPower = (uint32_t *)OsalMemCalloc(35 * sizeof(uint32_t));
234     if (result.txPower == NULL) {
235         printf("%s: OsalMemCalloc failed", __FUNCTION__);
236         OsalMemFree(result.freqs);
237         return;
238     }
239 
240     ret = GetValidFreqByBand(WLAN_IFNAME, bandNotSupport, &result, size);
241     EXPECT_NE(RET_CODE_SUCCESS, ret);
242     ret = GetValidFreqByBand(WLAN_IFNAME, band, nullptr, size);
243     EXPECT_NE(RET_CODE_SUCCESS, ret);
244     ret = GetValidFreqByBand(ifNameInvalid, band, &result, size);
245     EXPECT_NE(RET_CODE_SUCCESS, ret);
246     ret = GetValidFreqByBand(WLAN_IFNAME, band, &result, size);
247     EXPECT_EQ(RET_CODE_SUCCESS, ret);
248     if (ret == RET_CODE_SUCCESS) {
249         printf("%s: num = %u\n", __func__, result.nums);
250         for (i = 0; i < result.nums; i++) {
251             printf("%s: freq[%d] = %d\n", __func__, i, result.freqs[i]);
252         }
253     }
254 
255     OsalMemFree(result.txPower);
256     OsalMemFree(result.freqs);
257 }
258 
259 /**
260  * @tc.name: WifiClientSetTxPower001
261  * @tc.desc: Wifi client set tx power function test
262  * @tc.type: FUNC
263  * @tc.require: AR000FRMJC
264  */
265 HWTEST_F(WifiClientTest, WifiClientSetTxPower001, TestSize.Level1)
266 {
267     int32_t ret;
268     int32_t power = 10;
269     const char *ifNameInvalid = "wlanTest";
270 
271     ret = SetTxPower(ifNameInvalid, power);
272     EXPECT_NE(RET_CODE_SUCCESS, ret);
273     ret = SetTxPower(WLAN_IFNAME, power);
274     EXPECT_EQ(RET_CODE_SUCCESS, ret);
275 }
276 
277 /**
278  * @tc.name: WifiClientGetAssociatedStas001
279  * @tc.desc: Wifi client get associated status function test
280  * @tc.type: FUNC
281  * @tc.require: AR000H603L
282  */
283 HWTEST_F(WifiClientTest, WifiClientGetAssociatedStas001, TestSize.Level1)
284 {
285     int32_t ret;
286     struct AssocStaInfoResult result;
287 
288     ret = GetAssociatedStas(WLAN_IFNAME, &result);
289     EXPECT_EQ(RET_CODE_SUCCESS, ret);
290 }
291 
292 /**
293  * @tc.name: WifiClientSetScanMacAddr001
294  * @tc.desc: Wifi client set scan MAC address function test
295  * @tc.type: FUNC
296  * @tc.require: AR000H603L
297  */
298 HWTEST_F(WifiClientTest, WifiClientSetScanMacAddr001, TestSize.Level1)
299 {
300     int32_t ret;
301     const char *ifNameInvalid = "wlanTest";
302     unsigned char scanMac[ETH_ADDR_LEN] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
303 
304     ret = SetScanMacAddr(ifNameInvalid, scanMac, ETH_ADDR_LEN);
305     EXPECT_EQ(RET_CODE_FAILURE, ret);
306     ret = SetScanMacAddr(WLAN_IFNAME, scanMac, ETH_ADDR_LEN);
307     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
308     ASSERT_TRUE(flag);
309 }
310 
311 /**
312  * @tc.name: WifiClientAcquireChipId001
313  * @tc.desc: Wifi client get chipId function test
314  * @tc.type: FUNC
315  * @tc.require: AR000H603L
316  */
317 HWTEST_F(WifiClientTest, WifiClientAcquireChipId001, TestSize.Level1)
318 {
319     int32_t ret;
320     const char *ifNameInvalid = "wlanTest";
321     uint8_t chipId = 0;
322 
323     ret = AcquireChipId(nullptr, &chipId);
324     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
325     ret = AcquireChipId(WLAN_IFNAME, nullptr);
326     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
327     ret = AcquireChipId(ifNameInvalid, &chipId);
328     EXPECT_NE(RET_CODE_SUCCESS, ret);
329     ret = AcquireChipId(WLAN_IFNAME, &chipId);
330     ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
331     EXPECT_EQ(RET_CODE_SUCCESS, ret);
332 }
333 
334 /**
335  * @tc.name: WifiClientGetIfNamesByChipId001
336  * @tc.desc: Wifi client get ifName by chipId function test
337  * @tc.type: FUNC
338  * @tc.require: AR000H603L
339  */
340 HWTEST_F(WifiClientTest, WifiClientGetIfNamesByChipId001, TestSize.Level1)
341 {
342     int32_t ret;
343     uint8_t chipId = 0;
344     uint8_t chipIdInvalid = 100;
345     char *ifNames = nullptr;
346     uint32_t num = 0;
347 
348     ret = AcquireChipId(WLAN_IFNAME, &chipId);
349     ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
350     EXPECT_EQ(RET_CODE_SUCCESS, ret);
351     ret = GetIfNamesByChipId(chipIdInvalid, &ifNames, &num);
352     EXPECT_NE(RET_CODE_SUCCESS, ret);
353     ret = GetIfNamesByChipId(chipId, &ifNames, &num);
354     EXPECT_NE(ifNames, nullptr);
355     EXPECT_EQ(RET_CODE_SUCCESS, ret);
356     ret = GetIfNamesByChipId(chipId, &ifNames, nullptr);
357     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
358     ret = GetIfNamesByChipId(chipId, nullptr, &num);
359     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
360     free(ifNames);
361 }
362 
363 /**
364  * @tc.name: WifiClientGetNetDeviceInfo001
365  * @tc.desc: Wifi client get netDevice information function test
366  * @tc.type: FUNC
367  * @tc.require: AR000H603L
368  */
369 HWTEST_F(WifiClientTest, WifiClientGetNetDeviceInfo001, TestSize.Level1)
370 {
371     int32_t ret;
372     struct NetDeviceInfoResult netDeviceInfoResult;
373 
374     ret = GetNetDeviceInfo(&netDeviceInfoResult);
375     EXPECT_EQ(RET_CODE_SUCCESS, ret);
376 }
377 
378 /**
379  * @tc.name: WifiClientGetCurrentPowerMode001
380  * @tc.desc: Wifi client get current power mode function test
381  * @tc.type: FUNC
382  * @tc.require: AR000H603L
383  */
384 HWTEST_F(WifiClientTest, WifiClientGetCurrentPowerMode001, TestSize.Level1)
385 {
386     int32_t ret;
387     uint8_t mode = 0;
388     const char *ifNameInvalid = "wlanTest";
389 
390     ret = GetCurrentPowerMode(ifNameInvalid, &mode);
391     EXPECT_NE(RET_CODE_SUCCESS, ret);
392     ret = GetCurrentPowerMode(WLAN_IFNAME, &mode);
393     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
394     ASSERT_TRUE(flag);
395 }
396 
397 /**
398  * @tc.name: WifiClientSetPowerMode001
399  * @tc.desc: Wifi client set power mode function test
400  * @tc.type: FUNC
401  * @tc.require: AR000H603L
402  */
403 HWTEST_F(WifiClientTest, WifiClientSetPowerMode001, TestSize.Level1)
404 {
405     int32_t ret;
406     const char *ifNameInvalid = "wlanTest";
407 
408     ret = SetPowerMode(ifNameInvalid, WIFI_POWER_MODE_SLEEPING);
409     EXPECT_NE(RET_CODE_SUCCESS, ret);
410     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_SLEEPING);
411     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
412     ASSERT_TRUE(flag);
413 }
414 
415 /**
416  * @tc.name: WifiClientSetPowerMode002
417  * @tc.desc: Wifi client set power mode function test
418  * @tc.type: FUNC
419  * @tc.require: AR000H603L
420  */
421 HWTEST_F(WifiClientTest, WifiClientSetPowerMode002, TestSize.Level1)
422 {
423     int32_t ret;
424 
425     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_GENERAL);
426     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
427     ASSERT_TRUE(flag);
428 }
429 
430 /**
431  * @tc.name: WifiClientSetPowerMode003
432  * @tc.desc: Wifi client set power mode function test
433  * @tc.type: FUNC
434  * @tc.require: AR000H603L
435  */
436 HWTEST_F(WifiClientTest, WifiClientSetPowerMode003, TestSize.Level1)
437 {
438     int32_t ret;
439 
440     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_THROUGH_WALL);
441     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
442     ASSERT_TRUE(flag);
443 }
444 
445 /**
446  * @tc.name: WifiClientSetPowerMode004
447  * @tc.desc: Wifi client set power mode function test
448  * @tc.type: FUNC
449  * @tc.require: AR000H603L
450  */
451 HWTEST_F(WifiClientTest, WifiClientSetPowerMode004, TestSize.Level1)
452 {
453     int32_t ret;
454 
455     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_NUM);
456     EXPECT_NE(RET_CODE_SUCCESS, ret);
457 }
458 
459 /**
460  * @tc.name: WifiRegisterHid2dCallback001
461  * @tc.desc: Wifi register hid2d callback function test
462  * @tc.type: FUNC
463  * @tc.require:
464  */
465 HWTEST_F(WifiClientTest, WifiRegisterHid2dCallback001, TestSize.Level1)
466 {
467     int32_t ret;
468 
469     ret = WifiRegisterHid2dCallback(nullptr, WLAN_IFNAME);
470     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
471     ret = WifiRegisterHid2dCallback(Hid2dFunCb, nullptr);
472     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
473     ret = WifiRegisterHid2dCallback(Hid2dFunCb, WLAN_IFNAME);
474     EXPECT_EQ(RET_CODE_SUCCESS, ret);
475     WifiUnregisterHid2dCallback(nullptr, WLAN_IFNAME);
476     WifiUnregisterHid2dCallback(Hid2dFunCb, nullptr);
477 }
478 
479 /**
480  * @tc.name: WifiGetSignalPollInfo001
481  * @tc.desc: Wifi get signal poll info function test
482  * @tc.type: FUNC
483  * @tc.require:
484  */
485 HWTEST_F(WifiClientTest, WifiGetSignalPollInfo001, TestSize.Level1)
486 {
487     int32_t ret;
488     const char *ifNameInvalid = "wlanTest";
489     struct SignalResult signalResult;
490     (void)memset_s(&signalResult, sizeof(signalResult), 0, sizeof(signalResult));
491 
492     ret = WifiGetSignalPollInfo(nullptr, &signalResult);
493     EXPECT_EQ(RET_CODE_FAILURE, ret);
494     ret = WifiGetSignalPollInfo(ifNameInvalid, nullptr);
495     EXPECT_EQ(RET_CODE_FAILURE, ret);
496     ret = WifiGetSignalPollInfo(ifNameInvalid, &signalResult);
497     EXPECT_EQ(RET_CODE_FAILURE, ret);
498 }
499 
WifiEventCb(uint32_t event,void * respData,const char * ifName)500 static int32_t WifiEventCb(uint32_t event, void *respData, const char *ifName)
501 {
502     (void)event;
503     (void)respData;
504     (void)ifName;
505     return RET_CODE_SUCCESS;
506 }
507 
508 /**
509  * @tc.name: WifiRegisterEventCallback001
510  * @tc.desc: Wifi register event callback function test
511  * @tc.type: FUNC
512  * @tc.require:
513  */
514 HWTEST_F(WifiClientTest, WifiRegisterEventCallback001, TestSize.Level1)
515 {
516     int32_t ret;
517 
518     ret = WifiRegisterEventCallback(nullptr, WIFI_KERNEL_TO_HAL_CLIENT, WLAN_IFNAME);
519     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
520     ret = WifiRegisterEventCallback(WifiEventCb, WIFI_KERNEL_TO_HAL_CLIENT, nullptr);
521     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
522     WifiUnregisterEventCallback(nullptr, WIFI_KERNEL_TO_HAL_CLIENT, WLAN_IFNAME);
523     WifiUnregisterEventCallback(WifiEventCb, WIFI_KERNEL_TO_HAL_CLIENT, nullptr);
524 }
525 
526 /**
527  * @tc.name: WifiRegisterActionFrameReceiver001
528  * @tc.desc: Wifi register action frame function test
529  * @tc.type: FUNC
530  * @tc.require:
531  */
532 HWTEST_F(WifiClientTest, WifiRegisterActionFrameReceiver001, TestSize.Level1)
533 {
534     int32_t ret;
535     const char *ifNameInvalid = "wlanTest";
536     uint8_t mastch = 0;
537     uint32_t matchLen = RESET_TIME;
538 
539     ret = WifiRegisterActionFrameReceiver(nullptr, &mastch, matchLen);
540     EXPECT_EQ(RET_CODE_FAILURE, ret);
541     ret = WifiRegisterActionFrameReceiver(ifNameInvalid, 0, matchLen);
542     EXPECT_EQ(RET_CODE_FAILURE, ret);
543     ret = WifiRegisterActionFrameReceiver(ifNameInvalid, &mastch, 0);
544     EXPECT_EQ(RET_CODE_FAILURE, ret);
545     ret = WifiRegisterActionFrameReceiver(ifNameInvalid, &mastch, matchLen);
546     EXPECT_EQ(RET_CODE_FAILURE, ret);
547 }
548 
549 /**
550  * @tc.name: WifiSendActionFrame001
551  * @tc.desc: Wifi send action frame function test
552  * @tc.type: FUNC
553  * @tc.require:
554  */
555 HWTEST_F(WifiClientTest, WifiSendActionFrame001, TestSize.Level1)
556 {
557     int32_t ret;
558     const char *ifNameInvalid = "wlanTest";
559     uint8_t frameData = 0;
560     uint32_t freq = RESET_TIME;
561     uint32_t frameDataLen = RESET_TIME;
562 
563     ret = WifiSendActionFrame(nullptr, freq, &frameData, frameDataLen);
564     EXPECT_EQ(RET_CODE_FAILURE, ret);
565     ret = WifiSendActionFrame(ifNameInvalid, 0, &frameData, frameDataLen);
566     EXPECT_EQ(RET_CODE_FAILURE, ret);
567     ret = WifiSendActionFrame(ifNameInvalid, freq, &frameData, frameDataLen);
568     EXPECT_EQ(RET_CODE_FAILURE, ret);
569     ret = WifiSendActionFrame(ifNameInvalid, freq, &frameData, 0);
570     EXPECT_EQ(RET_CODE_FAILURE, ret);
571     ret = WifiSendActionFrame(ifNameInvalid, freq, &frameData, frameDataLen);
572     EXPECT_EQ(RET_CODE_FAILURE, ret);
573 }
574 
575 /**
576  * @tc.name: ClientGetApBandwidth001
577  * @tc.desc: client get ap bandwidth function test
578  * @tc.type: FUNC
579  * @tc.require:
580  */
581 HWTEST_F(WifiClientTest, ClientGetApBandwidth001, TestSize.Level1)
582 {
583     int32_t ret;
584     const char *ifNameInvalid = "wlanTest";
585     uint8_t bandwidth = 0;
586 
587     ret = ClientGetApBandwidth(nullptr, &bandwidth);
588     EXPECT_EQ(RET_CODE_FAILURE, ret);
589     ret = ClientGetApBandwidth(ifNameInvalid, nullptr);
590     EXPECT_EQ(RET_CODE_FAILURE, ret);
591     ret = ClientGetApBandwidth(ifNameInvalid, &bandwidth);
592     EXPECT_EQ(RET_CODE_FAILURE, ret);
593 }
594 
595 /**
596  * @tc.name: SetProjectionScreenParam001
597  * @tc.desc: set rx remain On channel test
598  * @tc.type: FUNC
599  * @tc.require:
600  */
601 HWTEST_F(WifiClientTest, SetProjectionScreenParam001, TestSize.Level1)
602 {
603     int32_t ret;
604     const char *ifNameInvalid = "wlanTest";
605     ProjectionScreenParam *param = nullptr;
606     param->cmdId = CMD_ID_RX_REMAIN_ON_CHANNEL;
607     param->buf[0] = 0;
608     param->bufLen = 40;
609     ret = SetProjectionScreenParam(ifNameInvalid, param);
610     EXPECT_EQ(RET_CODE_FAILURE, ret);
611 }
612 
613 /**
614  * @tc.name: SetProjectionScreenParam001
615  * @tc.desc: set rx remain On channel test
616  * @tc.type: FUNC
617  * @tc.require:
618  */
619 HWTEST_F(WifiClientTest, SetProjectionScreenParam002, TestSize.Level1)
620 {
621     int32_t ret;
622     const char *ifNameInvalid = "wlanTest";
623     ProjectionScreenParam *param = nullptr;
624     param->cmdId = CMD_ID_RX_REMAIN_ON_CHANNEL;
625     param->buf[0] = 0;
626     param->bufLen = 1;
627     ret = SetProjectionScreenParam(ifNameInvalid, param);
628     EXPECT_EQ(RET_CODE_FAILURE, ret);
629 }
630 /**
631  * @tc.name: WifiEapolPacketSend001
632  * @tc.desc: set rx remain On channel test
633  * @tc.type: FUNC
634  * @tc.require:
635  */
636 HWTEST_F(WifiClientTest, WifiEapolPacketSend001, TestSize.Level1)
637 {
638     int32_t ret;
639     int32_t length = 0;
640     const char *ifNameInvalid = "wlanTest";
641     uint8_t srcAddr = 0;
642     uint8_t dstAddr = 0;
643     uint8_t buf = 0;
644     ret = WifiEapolPacketSend(NULL, &srcAddr, &dstAddr, &buf, length);
645     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
646     WifiEapolPacketSend(ifNameInvalid, &srcAddr, &dstAddr, &buf, length);
647 }
648 /**
649  * @tc.name: WifiEapolPacketReceive002
650  * @tc.desc: set rx remain On channel test
651  * @tc.type: FUNC
652  * @tc.require:
653  */
654 HWTEST_F(WifiClientTest, WifiEapolPacketReceive002, TestSize.Level1)
655 {
656     int32_t ret;
657     const char *ifNameInvalid = "wlanTest";
658     WifiRxEapol *rxEapol = NULL;
659     ret = WifiEapolPacketReceive(NULL, rxEapol);
660     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
661     ret = WifiEapolPacketReceive(ifNameInvalid, rxEapol);
662     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
663 }
664 /**
665  * @tc.name: WifiEapolEnable003
666  * @tc.desc: set rx remain On channel test
667  * @tc.type: FUNC
668  * @tc.require:
669  */
670 HWTEST_F(WifiClientTest, WifiEapolEnable003, TestSize.Level1)
671 {
672     int32_t ret;
673     const char *ifNameInvalid = "wlanTest";
674     ret = WifiEapolEnable(NULL);
675     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
676     WifiEapolEnable(ifNameInvalid);
677 }
678 /**
679  * @tc.name: WifiEapolDisable004
680  * @tc.desc: set rx remain On channel test
681  * @tc.type: FUNC
682  * @tc.require:
683  */
684 HWTEST_F(WifiClientTest, WifiEapolDisable004, TestSize.Level1)
685 {
686     int32_t ret;
687     const char *ifNameInvalid = "wlanTest";
688     ret = WifiEapolDisable(NULL);
689     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
690     WifiEapolDisable(ifNameInvalid);
691 }
692 /**
693  * @tc.name: WifiCmdSetAp005
694  * @tc.desc: set rx remain On channel test
695  * @tc.type: FUNC
696  * @tc.require:
697  */
698 HWTEST_F(WifiClientTest, WifiCmdSetAp005, TestSize.Level1)
699 {
700     int32_t ret;
701     const char *ifNameInvalid = "wlanTest";
702     WifiApSetting *apsettings = NULL;
703     ret = WifiCmdSetAp(NULL, apsettings);
704     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
705     ret = WifiCmdSetAp(ifNameInvalid, apsettings);
706     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
707 }
708 /**
709  * @tc.name: WifiCmdChangeBeacon006
710  * @tc.desc: set rx remain On channel test
711  * @tc.type: FUNC
712  * @tc.require:
713  */
714 HWTEST_F(WifiClientTest, WifiCmdChangeBeacon006, TestSize.Level1)
715 {
716     int32_t ret;
717     const char *ifNameInvalid = "wlanTest";
718     WifiApSetting *apsettings = NULL;
719     ret = WifiCmdChangeBeacon(NULL, apsettings);
720     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
721     ret = WifiCmdChangeBeacon(ifNameInvalid, apsettings);
722     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
723 }
724 /**
725  * @tc.name: WifiCmdSendMlme007
726  * @tc.desc: set rx remain On channel test
727  * @tc.type: FUNC
728  * @tc.require:
729  */
730 HWTEST_F(WifiClientTest, WifiCmdSendMlme007, TestSize.Level1)
731 {
732     int32_t ret;
733     const char *ifNameInvalid = "wlanTest";
734     WifiMlmeData *mlme = NULL;
735     ret = WifiCmdSendMlme(NULL, mlme);
736     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
737     ret = WifiCmdSendMlme(ifNameInvalid, mlme);
738     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
739 }
740 /**
741  * @tc.name: WifiCmdDelKey008
742  * @tc.desc: set rx remain On channel test
743  * @tc.type: FUNC
744  * @tc.require:
745  */
746 HWTEST_F(WifiClientTest, WifiCmdDelKey008, TestSize.Level1)
747 {
748     int32_t ret;
749     const char *ifNameInvalid = "wlanTest";
750     WifiKeyExt *keyExt = NULL;
751     ret = WifiCmdDelKey(NULL, keyExt);
752     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
753     ret = WifiCmdDelKey(ifNameInvalid, keyExt);
754     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
755 }
756 /**
757  * @tc.name: WifiCmdNewKey009
758  * @tc.desc: set rx remain On channel test
759  * @tc.type: FUNC
760  * @tc.require:
761  */
762 HWTEST_F(WifiClientTest, WifiCmdNewKey009, TestSize.Level1)
763 {
764     const char *ifNameInvalid = "wlanTest";
765     WifiKeyExt keyExt;
766     WifiCmdNewKey(ifNameInvalid, &keyExt);
767     EXPECT_FALSE(g_errlog.find("cmd") != std::string::npos);
768 }
769 /**
770  * @tc.name: WifiCmdSetKey0010
771  * @tc.desc: set rx remain On channel test
772  * @tc.type: FUNC
773  * @tc.require:
774  */
775 HWTEST_F(WifiClientTest, WifiCmdSetKey0010, TestSize.Level1)
776 {
777     const char *ifNameInvalid = "wlanTest";
778     WifiKeyExt keyExt;
779     WifiCmdSetKey(ifNameInvalid, &keyExt);
780     EXPECT_FALSE(g_errlog.find("WifiCmdSetKey") != std::string::npos);
781 }
782 /**
783  * @tc.name: WifiCmdGetOwnMac0011
784  * @tc.desc: set rx remain On channel test
785  * @tc.type: FUNC
786  * @tc.require:
787  */
788 HWTEST_F(WifiClientTest, WifiCmdGetOwnMac0011, TestSize.Level1)
789 {
790     int32_t ret;
791     const char *ifNameInvalid = "wlanTest";
792     uint32_t len = 0;
793     ret = WifiCmdGetOwnMac(NULL, NULL, len);
794     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
795     ret = WifiCmdGetOwnMac(ifNameInvalid, NULL, len);
796     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
797     WifiCmdGetOwnMac(ifNameInvalid, NULL, len);
798 }
799 /**
800  * @tc.name: WifiCmdSetMode0012
801  * @tc.desc: set rx remain On channel test
802  * @tc.type: FUNC
803  * @tc.require:
804  */
805 HWTEST_F(WifiClientTest, WifiCmdSetMode0012, TestSize.Level1)
806 {
807     int32_t ret;
808     const char *ifNameInvalid = "wlanTest";
809     WifiSetMode *setMode = NULL;
810     ret = WifiCmdSetMode(NULL, setMode);
811     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
812     ret = WifiCmdSetMode(ifNameInvalid, setMode);
813     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
814 }
815 /**
816  * @tc.name: WifiCmdGetHwFeature0013
817  * @tc.desc: set rx remain On channel test
818  * @tc.type: FUNC
819  * @tc.require:
820  */
821 HWTEST_F(WifiClientTest, WifiCmdGetHwFeature0013, TestSize.Level1)
822 {
823     int32_t ret;
824     const char *ifNameInvalid = "wlanTest";
825     WifiHwFeatureData hwFeatureData;
826     ret = WifiCmdGetHwFeature(NULL, &hwFeatureData);
827     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
828     WifiCmdGetHwFeature(ifNameInvalid, &hwFeatureData);
829 }
830 /**
831  * @tc.name: WifiCmdDisconnet0014
832  * @tc.desc: set rx remain On channel test
833  * @tc.type: FUNC
834  * @tc.require:
835  */
836 HWTEST_F(WifiClientTest, WifiCmdDisconnet0014, TestSize.Level1)
837 {
838     int32_t ret;
839     const char *ifNameInvalid = "wlanTest";
840     int32_t reasonCode = 0;
841     ret = WifiCmdDisconnet(NULL, reasonCode);
842     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
843     WifiCmdDisconnet(ifNameInvalid, reasonCode);
844 }
845 /**
846  * @tc.name: WifiCmdAssoc0016
847  * @tc.desc: set rx remain On channel test
848  * @tc.type: FUNC
849  * @tc.require:
850  */
851 HWTEST_F(WifiClientTest, WifiCmdAssoc0016, TestSize.Level1)
852 {
853     int32_t ret;
854     const char *ifNameInvalid = "wlanTest";
855     WifiAssociateParams assocParams;
856     ret = WifiCmdAssoc(NULL, &assocParams);
857     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
858     WifiCmdAssoc(ifNameInvalid, &assocParams);
859 }
860 /**
861  * @tc.name: WifiCmdSetNetdev0017
862  * @tc.desc: set rx remain On channel test
863  * @tc.type: FUNC
864  * @tc.require:
865  */
866 HWTEST_F(WifiClientTest, WifiCmdSetNetdev0017, TestSize.Level1)
867 {
868     int32_t ret;
869     const char *ifNameInvalid = "wlanTest";
870     WifiSetNewDev info;
871     ret = WifiCmdSetNetdev(NULL, &info);
872     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
873     WifiCmdSetNetdev(ifNameInvalid, &info);
874 }
875 /**
876  * @tc.name: WifiCmdStaRemove0018
877  * @tc.desc: set rx remain On channel test
878  * @tc.type: FUNC
879  * @tc.require:
880  */
881 HWTEST_F(WifiClientTest, WifiCmdStaRemove0018, TestSize.Level1)
882 {
883     int32_t ret;
884     const char *ifNameInvalid = "wlanTest";
885     uint8_t *addr = NULL;
886     uint32_t addrLen = 0;
887     ret = WifiCmdStaRemove(NULL, addr, addrLen);
888     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
889     WifiCmdStaRemove(ifNameInvalid, addr, addrLen);
890 }
891 /**
892  * @tc.name: WifiCmdSendAction0019
893  * @tc.desc: set rx remain On channel test
894  * @tc.type: FUNC
895  * @tc.require:
896  */
897 HWTEST_F(WifiClientTest, WifiCmdSendAction0019, TestSize.Level1)
898 {
899     int32_t ret;
900     const char *ifNameInvalid = "wlanTest";
901     WifiActionData actionData;
902     ret = WifiCmdSendAction(NULL, &actionData);
903     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
904     WifiCmdSendAction(ifNameInvalid, &actionData);
905 }
906 /**
907  * @tc.name: WifiCmdSetClient0020
908  * @tc.desc: set rx remain On channel test
909  * @tc.type: FUNC
910  * @tc.require:
911  */
912 HWTEST_F(WifiClientTest, WifiCmdSetClient0020, TestSize.Level1)
913 {
914     uint32_t clientNum = 0;
915     WifiCmdSetClient(clientNum);
916     EXPECT_FALSE(g_errlog.find("WifiCmdSetClient") != std::string::npos);
917 }
918 /**
919  * @tc.name: WifiCmdProbeReqReport0021
920  * @tc.desc: set rx remain On channel test
921  * @tc.type: FUNC
922  * @tc.require:
923  */
924 HWTEST_F(WifiClientTest, WifiCmdProbeReqReport0021, TestSize.Level1)
925 {
926     int32_t ret;
927     const char *ifNameInvalid = "wlanTest";
928     int32_t *report = NULL;
929     ret = WifiCmdProbeReqReport(NULL, report);
930     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
931     WifiCmdProbeReqReport(ifNameInvalid, report);
932 }
933 /**
934  * @tc.name: WifiCmdRemainOnChannel0022
935  * @tc.desc: set rx remain On channel test
936  * @tc.type: FUNC
937  * @tc.require:
938  */
939 HWTEST_F(WifiClientTest, WifiCmdRemainOnChannel0022, TestSize.Level1)
940 {
941     int32_t ret;
942     const char *ifNameInvalid = "wlanTest";
943     WifiOnChannel onChannel;
944     ret = WifiCmdRemainOnChannel(NULL, &onChannel);
945     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
946     WifiCmdRemainOnChannel(ifNameInvalid, &onChannel);
947 }
948 /**
949  * @tc.name: WifiCmdCancelRemainOnChannel0023
950  * @tc.desc: set rx remain On channel test
951  * @tc.type: FUNC
952  * @tc.require:
953  */
954 HWTEST_F(WifiClientTest, WifiCmdCancelRemainOnChannel0023, TestSize.Level1)
955 {
956     int32_t ret;
957     const char *ifNameInvalid = "wlanTest";
958     ret = WifiCmdCancelRemainOnChannel(NULL);
959     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
960     WifiCmdCancelRemainOnChannel(ifNameInvalid);
961 }
962 /**
963  * @tc.name: WifiCmdAddIf024
964  * @tc.desc: set rx remain On channel test
965  * @tc.type: FUNC
966  * @tc.require:
967  */
968 HWTEST_F(WifiClientTest, WifiCmdAddIf024, TestSize.Level1)
969 {
970     int32_t ret;
971     const char *ifNameInvalid = "wlanTest";
972     WifiIfAdd ifAdd;
973     ret = WifiCmdAddIf(NULL, &ifAdd);
974     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
975     WifiCmdAddIf(ifNameInvalid, &ifAdd);
976 }
977 /**
978  * @tc.name: WifiCmdRemoveIf025
979  * @tc.desc: set rx remain On channel test
980  * @tc.type: FUNC
981  * @tc.require:
982  */
983 HWTEST_F(WifiClientTest, WifiCmdRemoveIf025, TestSize.Level1)
984 {
985     int32_t ret;
986     const char *ifNameInvalid = "wlanTest";
987     WifiIfRemove ifRemove;
988     ret = WifiCmdRemoveIf(NULL, &ifRemove);
989     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
990     WifiCmdRemoveIf(ifNameInvalid, &ifRemove);
991 }
992 /**
993  * @tc.name: WifiCmdSetApWpsP2pIe026
994  * @tc.desc: set rx remain On channel test
995  * @tc.type: FUNC
996  * @tc.require:
997  */
998 HWTEST_F(WifiClientTest, WifiCmdSetApWpsP2pIe026, TestSize.Level1)
999 {
1000     int32_t ret;
1001     const char *ifNameInvalid = "wlanTest";
1002     WifiAppIe appIe;
1003     ret = WifiCmdSetApWpsP2pIe(NULL, &appIe);
1004     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
1005     WifiCmdSetApWpsP2pIe(ifNameInvalid, &appIe);
1006 }
1007 /**
1008  * @tc.name: WifiCmdGetDrvFlags027
1009  * @tc.desc: set rx remain On channel test
1010  * @tc.type: FUNC
1011  * @tc.require:
1012  */
1013 HWTEST_F(WifiClientTest, WifiCmdGetDrvFlags027, TestSize.Level1)
1014 {
1015     int32_t ret;
1016     const char *ifNameInvalid = "wlanTest";
1017     WifiGetDrvFlags params;
1018     ret = WifiCmdGetDrvFlags(NULL, &params);
1019     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
1020     WifiCmdGetDrvFlags(ifNameInvalid, &params);
1021 }
1022 /**
1023  * @tc.name: WifiSetDpiMarkRule028
1024  * @tc.desc: set rx remain On channel test
1025  * @tc.type: FUNC
1026  * @tc.require:
1027  */
1028 HWTEST_F(WifiClientTest, WifiSetDpiMarkRule028, TestSize.Level1)
1029 {
1030     int32_t srcAddr = 0;
1031     int32_t dstAddr = 0;
1032     int32_t buf = 0;
1033     WifiSetDpiMarkRule(srcAddr, dstAddr, buf);
1034     EXPECT_FALSE(g_errlog.find("enter") != std::string::npos);
1035 }
1036 /**
1037  * @tc.name: WifiInstallWlanExtParam029
1038  * @tc.desc: install wlan ext param
1039  * @tc.type: FUNC
1040  * @tc.require:
1041  */
1042 HWTEST_F(WifiClientTest, WifiInstallWlanExtParam029, TestSize.Level1)
1043 {
1044     int32_t ret;
1045     const char *ifNameInvalid = "wlanTest";
1046     InstallWlanParam param;
1047     param.id = 0;
1048     param.suite = 0;
1049     param.len = 0;
1050     ret = WifiInstallWlanExtParam(ifNameInvalid, &param);
1051     EXPECT_EQ(RET_CODE_FAILURE, ret);
1052 }
1053 /**
1054  * @tc.name: WpaEventReport
1055  * @tc.desc: set rx remain On channel test
1056  * @tc.type: FUNC
1057  * @tc.require:
1058  */
1059 #ifdef OHOS_ARCH_LITE
WpaEventCb(uint32_t event,void * respData,const char * ifName)1060 static int32_t WpaEventCb(uint32_t event, void *respData, const char *ifName)
1061 {
1062     (void)event;
1063     (void)respData;
1064     (void)ifName;
1065     return RET_CODE_SUCCESS;
1066 }
1067 
1068 /**
1069  * @tc.name: GetChannelMeasResult027
1070  * @tc.desc: set rx remain On channel test
1071  * @tc.type: FUNC
1072  * @tc.require:
1073  */
1074 HWTEST_F(WifiClientTest, GetChannelMeasResult027, TestSize.Level1)
1075 {
1076     int32_t ret;
1077     const char *ifNameInvalid = "wlanTest";
1078     MeasResult measResult;
1079     ret = GetChannelMeasResult(NULL, &measResult);
1080     EXPECT_EQ(RET_CODE_NOT_SUPPORT, ret);
1081     GetChannelMeasResult(ifNameInvalid, &measResult);
1082 }
1083  /**
1084  * @tc.name: WpaRegisterEventCallback01
1085  * @tc.desc: wpa register event callback function test
1086  * @tc.type: FUNC
1087  * @tc.require:
1088  */
1089 HWTEST_F(WifiClientTest, WpaRegisterEventCallback01, TestSize.Level1)
1090 {
1091     int32_t ret;
1092 
1093     ret = WpaRegisterEventCallback(nullptr, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1094     EXPECT_EQ(RET_CODE_FAILURE, ret);
1095     ret = WpaRegisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, nullptr);
1096     EXPECT_EQ(RET_CODE_FAILURE, ret);
1097     WpaRegisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1098     WpaUnregisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1099     WpaUnregisterEventCallback(nullptr, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1100     WpaUnregisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, nullptr);
1101 }
1102 
1103 /**
1104  * @tc.name: WpaEventReport02
1105  * @tc.desc: wpa cb interface test
1106  * @tc.type: FUNC
1107  * @tc.require:
1108  */
1109 HWTEST_F(WifiClientTest, WpaEventReport02, TestSize.Level1)
1110 {
1111     struct WpaStateChangedParam wpaStateChangedParma = {0};
1112     WpaEventReport(WLAN_IFNAME, WPA_EVENT_STATE_CHANGED, (void *) &wpaStateChangedParma);
1113     WpaEventReport(WLAN_IFNAME, WPA_EVENT_STATE_CHANGED, nullptr);
1114     WpaEventReport(nullptr, WPA_EVENT_STATE_CHANGED, (void *) &wpaStateChangedParma);
1115     EXPECT_FALSE(g_errlog.find("wlan0") != std::string::npos);
1116 }
1117 
1118 /**
1119  * @tc.name: HostapdRegisterEventCallback03
1120  * @tc.desc: hostapd register event callback function test
1121  * @tc.type: FUNC
1122  * @tc.require:
1123  */
1124 HWTEST_F(WifiClientTest, HostapdRegisterEventCallback03, TestSize.Level1)
1125 {
1126     int32_t ret;
1127 
1128     ret = HostapdRegisterEventCallback(nullptr, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1129     EXPECT_EQ(RET_CODE_FAILURE, ret);
1130     ret = HostapdRegisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, nullptr);
1131     EXPECT_EQ(RET_CODE_FAILURE, ret);
1132     HostapdRegisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1133     HostapdUnregisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1134     HostapdUnregisterEventCallback(nullptr, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1135     HostapdUnregisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, nullptr);
1136 }
1137 
1138 /**
1139  * @tc.name: HostapdEventReport04
1140  * @tc.desc: hostapd cb interface test
1141  * @tc.type: FUNC
1142  * @tc.require:
1143  */
1144 HWTEST_F(WifiClientTest, HostapdEventReport04, TestSize.Level1)
1145 {
1146     struct HostapdApCbParm hostapdApCbParm = {};
1147     HostapdEventReport(WLAN_IFNAME, HOSTAPD_EVENT_AP_STATE, (void *) &hostapdApCbParm);
1148     HostapdEventReport(WLAN_IFNAME, HOSTAPD_EVENT_AP_STATE, nullptr);
1149     HostapdEventReport(nullptr, HOSTAPD_EVENT_AP_STATE, (void *) &hostapdApCbParm);
1150     EXPECT_FALSE(g_errlog.find("HostapdEventReport") != std::string::npos);
1151 }
1152 
1153 /**
1154  * @tc.name: WifiSetPowerSaveMode029
1155  * @tc.desc: set rx remain On channel test
1156  * @tc.type: FUNC
1157  * @tc.require:
1158  */
1159 HWTEST_F(WifiClientTest, WifiSetPowerSaveMode029, TestSize.Level1)
1160 {
1161     int32_t frequency = 0;
1162     int32_t mode = 0;
1163     const char *ifName = "wlanTest";
1164     WifiSetPowerSaveMode(ifName, frequency, mode);
1165     EXPECT_FALSE(g_errlog.find("save") != std::string::npos);
1166 }
1167 
1168 /**
1169  * @tc.name: ReleaseEventCallback01
1170  * @tc.desc: Release Event Callback test
1171  * @tc.type: FUNC
1172  * @tc.require:
1173  */
1174 HWTEST_F(WifiClientTest, ReleaseEventCallback01, TestSize.Level1)
1175 {
1176     ReleaseEventCallback();
1177     EXPECT_FALSE(g_errlog.find("wlan0") != std::string::npos);
1178 }
1179 
1180 /**
1181  * @tc.name: SendCmdIoctl01
1182  * @tc.desc: Send Cmd Ioctl test
1183  * @tc.type: FUNC
1184  * @tc.require:
1185  */
1186 HWTEST_F(WifiClientTest, SendCmdIoctl01, TestSize.Level1)
1187 {
1188     const char *ifName = "wlanTest";
1189     int32_t cmdId = 1;
1190     int8_t *paramBuf = nullptr;
1191     uint32_t paramBufLen = 1;
1192     EXPECT_NE(SendCmdIoctl(ifName, cmdId, paramBuf, paramBufLen), RET_CODE_UNKNOW);
1193 }
1194 
1195 /**
1196  * @tc.name: StartChannelMeas01
1197  * @tc.desc: Start Channel Meas test
1198  * @tc.type: FUNC
1199  * @tc.require:
1200  */
1201 HWTEST_F(WifiClientTest, StartChannelMeas01, TestSize.Level1)
1202 {
1203     const char *ifName = "wlanTest";
1204     struct MeasParam measParam = {0};
1205     EXPECT_NE(StartChannelMeas(ifName, &measParam), RET_CODE_UNKNOW);
1206 }
1207 }
1208 }
1209 #endif
1210 };