1 /*
2  * Copyright (C) 2021 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 #include "scan_service.h"
16 #include <gtest/gtest.h>
17 #include "mock_wifi_manager.h"
18 #include "mock_wifi_config_center.h"
19 #include "mock_wifi_settings.h"
20 #include "mock_scan_state_machine.h"
21 
22 using ::testing::_;
23 using ::testing::AtLeast;
24 using ::testing::DoAll;
25 using ::testing::Eq;
26 using ::testing::Return;
27 using ::testing::SetArgReferee;
28 using ::testing::StrEq;
29 using ::testing::TypedEq;
30 using ::testing::ext::TestSize;
31 
32 namespace OHOS {
33 namespace Wifi {
34 constexpr int FREQ_2_DOT_4_GHZ = 2450;
35 constexpr int FREQ_5_GHZ = 5200;
36 constexpr int TWO = 2;
37 constexpr int THREE = 3;
38 constexpr int FOUR = 4;
39 constexpr int FAILEDNUM = 6;
40 constexpr int STANDER = 5;
41 constexpr int STATUS = 17;
42 constexpr int MAX_SCAN_CONFIG = 10000;
43 constexpr int INVAL = 0x0fffff;
44 constexpr int MAX_THROUGH = -90;
45 constexpr int TIMES_TAMP = 1000;
46 
47 
48 class ScanServiceTest : public testing::Test {
49 public:
SetUpTestCase()50     static void SetUpTestCase() {}
TearDownTestCase()51     static void TearDownTestCase() {}
SetUp()52     virtual void SetUp()
53     {
54         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetHid2dUpperScene(_, _)).Times(AtLeast(0));
55         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetP2pBusinessType(_)).Times(AtLeast(0));
56         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return(""));
57         pScanService = std::make_unique<ScanService>();
58         pScanService->pScanStateMachine = new MockScanStateMachine();
59         pScanService->RegisterScanCallbacks(WifiManager::GetInstance().GetScanCallback());
60     }
TearDown()61     virtual void TearDown()
62     {
63         pScanService.reset();
64     }
65 
66 public:
67     std::unique_ptr<ScanService> pScanService;
68     std::vector<TrustListPolicy> refVecTrustList;
69     MovingFreezePolicy defaultValue;
70 
InitScanServiceSuccess1()71     void InitScanServiceSuccess1()
72     {
73         std::vector<int32_t> band_2G_channel = { 1, 2, 3, 4, 5, 6, 7 };
74         std::vector<int32_t> band_5G_channel = { 149, 168, 169 };
75         ChannelsTable temp = { { BandType::BAND_2GHZ, band_2G_channel }, { BandType::BAND_5GHZ, band_5G_channel } };
76         EXPECT_CALL(WifiSettings::GetInstance(), GetSupportHwPnoFlag(_)).Times(AtLeast(1));
77         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScanControlInfo(_, _)).Times(AtLeast(1));
78         EXPECT_CALL(WifiManager::GetInstance(), DealScanOpenRes(_)).Times(AtLeast(0));
79         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
80         EXPECT_CALL(WifiSettings::GetInstance(), ReloadMovingFreezePolicy())
81             .WillRepeatedly(Return(defaultValue));
82         pScanService->InitScanService(WifiManager::GetInstance().GetScanCallback());
83     }
84 
InitScanServiceSuccess2()85     void InitScanServiceSuccess2()
86     {
87         std::vector<int32_t> band_2G_channel = { 1, 2, 3, 4, 5, 6, 7 };
88         std::vector<int32_t> band_5G_channel = { 149, 168, 169 };
89         ChannelsTable temp = { { BandType::BAND_2GHZ, band_2G_channel }, { BandType::BAND_5GHZ, band_5G_channel } };
90         EXPECT_CALL(WifiSettings::GetInstance(), GetSupportHwPnoFlag(_)).Times(AtLeast(1));
91         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScanControlInfo(_, _)).Times(AtLeast(1));
92         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScreenState()).Times(AtLeast(1));
93         EXPECT_CALL(WifiManager::GetInstance(), DealScanOpenRes(_)).Times(AtLeast(0));
94         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
95         EXPECT_CALL(WifiSettings::GetInstance(), ReloadTrustListPolicies())
96             .WillRepeatedly(Return(refVecTrustList));
97         pScanService->InitScanService(WifiManager::GetInstance().GetScanCallback());
98     }
99 
UnInitScanServiceSuccess()100     void UnInitScanServiceSuccess()
101     {
102         if (pScanService->InitScanService(WifiManager::GetInstance().GetScanCallback()) == true) {
103             pScanService->UnInitScanService();
104         }
105     }
106 
HandleScanStatusReportSuccess1()107     void HandleScanStatusReportSuccess1()
108     {
109         EXPECT_CALL(WifiManager::GetInstance(), DealScanOpenRes(_)).Times(AtLeast(1));
110         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
111         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
112         ScanStatusReport scanStatusReport;
113         scanStatusReport.status = SCAN_STARTED_STATUS;
114         pScanService->HandleScanStatusReport(scanStatusReport);
115         pScanService->pScanStateMachine = nullptr;
116         pScanService->HandleScanStatusReport(scanStatusReport);
117     }
118 
HandleScanStatusReportSuccess2()119     void HandleScanStatusReportSuccess2()
120     {
121         EXPECT_CALL(WifiManager::GetInstance(), DealScanCloseRes(_)).Times(AtLeast(1));
122         ScanStatusReport scanStatusReport;
123         scanStatusReport.status = SCAN_FINISHED_STATUS;
124         pScanService->HandleScanStatusReport(scanStatusReport);
125     }
126 
HandleScanStatusReportSuccess3()127     void HandleScanStatusReportSuccess3()
128     {
129         EXPECT_CALL(WifiManager::GetInstance(), DealScanFinished(_, _)).Times(AtLeast(0));
130         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).Times(AtLeast(0));
131         EXPECT_CALL(WifiManager::GetInstance(), DealScanInfoNotify(_, _)).Times(AtLeast(1));
132         ScanStatusReport scanStatusReport;
133         scanStatusReport.status = COMMON_SCAN_SUCCESS;
134         pScanService->HandleScanStatusReport(scanStatusReport);
135     }
136 
HandleScanStatusReportSuccess4()137     void HandleScanStatusReportSuccess4()
138     {
139         EXPECT_CALL(WifiManager::GetInstance(), DealScanFinished(_, _)).Times(AtLeast(0));
140         ScanStatusReport scanStatusReport;
141         scanStatusReport.status = COMMON_SCAN_FAILED;
142         pScanService->HandleScanStatusReport(scanStatusReport);
143     }
144 
HandleScanStatusReportSuccess5()145     void HandleScanStatusReportSuccess5()
146     {
147         EXPECT_CALL(WifiManager::GetInstance(), DealScanInfoNotify(_, _)).Times(AtLeast(1));
148         ScanStatusReport scanStatusReport;
149         scanStatusReport.status = PNO_SCAN_INFO;
150         pScanService->HandleScanStatusReport(scanStatusReport);
151     }
152 
HandleScanStatusReportSuccess6()153     void HandleScanStatusReportSuccess6()
154     {
155         ScanStatusReport scanStatusReport;
156         scanStatusReport.status = PNO_SCAN_FAILED;
157         pScanService->HandleScanStatusReport(scanStatusReport);
158         pScanService->pScanStateMachine = nullptr;
159         pScanService->HandleScanStatusReport(scanStatusReport);
160     }
161 
HandleScanStatusReportSuccess7()162     void HandleScanStatusReportSuccess7()
163     {
164         ScanStatusReport scanStatusReport;
165         scanStatusReport.status = SCAN_INNER_EVENT;
166         pScanService->HandleScanStatusReport(scanStatusReport);
167     }
168 
HandleScanStatusReportFail()169     void HandleScanStatusReportFail()
170     {
171         ScanStatusReport scanStatusReport;
172         scanStatusReport.status = SCAN_STATUS_INVALID;
173         pScanService->HandleScanStatusReport(scanStatusReport);
174     }
175 
HandleInnerEventReportSuccess1()176     void HandleInnerEventReportSuccess1()
177     {
178         ScanInnerEventType innerEvent;
179         innerEvent = SYSTEM_SCAN_TIMER;
180         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
181         pScanService->HandleInnerEventReport(innerEvent);
182     }
183 
HandleInnerEventReportSuccess2()184     void HandleInnerEventReportSuccess2()
185     {
186         ScanInnerEventType innerEvent;
187         innerEvent = DISCONNECTED_SCAN_TIMER;
188         pScanService->HandleInnerEventReport(innerEvent);
189     }
190 
HandleInnerEventReportSuccess3()191     void HandleInnerEventReportSuccess3()
192     {
193         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
194         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi2Dot4Ghz(_)).Times(AtLeast(0));
195         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi5Ghz(_)).Times(AtLeast(0));
196         ScanInnerEventType innerEvent;
197         innerEvent = RESTART_PNO_SCAN_TIMER;
198         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
199         pScanService->HandleInnerEventReport(innerEvent);
200     }
201 
HandleInnerEventReportFail()202     void HandleInnerEventReportFail()
203     {
204         ScanInnerEventType innerEvent;
205         innerEvent = SCAN_INNER_EVENT_INVALID;
206         pScanService->HandleInnerEventReport(innerEvent);
207     }
208 
ScanSuccess()209     void ScanSuccess()
210     {
211         pScanService->scanStartedFlag = false;
212         EXPECT_TRUE(pScanService->Scan(ScanType::SCAN_TYPE_NATIVE_EXTERN) == WIFI_OPT_FAILED);
213     }
214 
ScanFail()215     void ScanFail()
216     {
217         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetThermalLevel()).WillRepeatedly(Return(FOUR));
218         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(THREE)
219             .WillOnce(Return(1))
220             .WillOnce(Return(0));
221         pScanService->scanStartedFlag = true;
222         EXPECT_TRUE(pScanService->Scan(ScanType::SCAN_TYPE_EXTERN) == WIFI_OPT_SUCCESS);
223         EXPECT_TRUE(pScanService->Scan(ScanType::SCAN_TYPE_NATIVE_EXTERN) == WIFI_OPT_SUCCESS);
224         pScanService->pScanStateMachine = nullptr;
225         EXPECT_TRUE(pScanService->Scan(ScanType::SCAN_TYPE_EXTERN) == WIFI_OPT_FAILED);
226     }
227 
ScanWithParamSuccess()228     void ScanWithParamSuccess()
229     {
230         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).WillRepeatedly(Return(true));
231         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetThermalLevel()).WillRepeatedly(Return(1));
232         pScanService->scanStartedFlag = true;
233         WifiScanParams params;
234         params.band = SCAN_BAND_BOTH_WITH_DFS;
235         EXPECT_EQ(WIFI_OPT_SUCCESS, pScanService->ScanWithParam(params, ScanType::SCAN_TYPE_NATIVE_EXTERN));
236     }
237 
ScanWithParamFail1()238     void ScanWithParamFail1()
239     {
240         pScanService->scanStartedFlag = false;
241         WifiScanParams params;
242         params.band = SCAN_BAND_BOTH_WITH_DFS;
243         EXPECT_EQ(WIFI_OPT_FAILED, pScanService->ScanWithParam(params, ScanType::SCAN_TYPE_NATIVE_EXTERN));
244     }
245 
ScanWithParamFail2()246     void ScanWithParamFail2()
247     {
248         pScanService->scanStartedFlag = true;
249         WifiScanParams params;
250         params.band = -1;
251         EXPECT_EQ(WIFI_OPT_FAILED, pScanService->ScanWithParam(params, ScanType::SCAN_TYPE_NATIVE_EXTERN));
252     }
253 
ScanWithParamFail3()254     void ScanWithParamFail3()
255     {
256         pScanService->scanStartedFlag = true;
257         WifiScanParams params;
258         params.band = SCAN_BAND_UNSPECIFIED;
259         EXPECT_EQ(WIFI_OPT_FAILED, pScanService->ScanWithParam(params, ScanType::SCAN_TYPE_NATIVE_EXTERN));
260     }
261 
ScanWithParamFail4()262     void ScanWithParamFail4()
263     {
264         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).WillRepeatedly(Return(false));
265         pScanService->scanStartedFlag = true;
266         WifiScanParams params;
267         params.band = SCAN_BAND_UNSPECIFIED;
268         EXPECT_EQ(WIFI_OPT_FAILED, pScanService->ScanWithParam(params, ScanType::SCAN_TYPE_NATIVE_EXTERN));
269     }
270 
SingleScanSuccess1()271     void SingleScanSuccess1()
272     {
273         ScanConfig scanConfig;
274         scanConfig.scanBand = SCAN_BAND_BOTH_WITH_DFS;
275         scanConfig.scanType = ScanType::SCAN_TYPE_EXTERN;
276         scanConfig.scanStyle = SCAN_TYPE_HIGH_ACCURACY;
277         EXPECT_EQ(true, pScanService->SingleScan(scanConfig));
278     }
279 
SingleScanSuccess2()280     void SingleScanSuccess2()
281     {
282         ScanConfig scanConfig;
283         scanConfig.scanBand = SCAN_BAND_UNSPECIFIED;
284         scanConfig.scanType = ScanType::SCAN_TYPE_EXTERN;
285         scanConfig.scanStyle = SCAN_TYPE_HIGH_ACCURACY;
286         scanConfig.scanFreqs.push_back(0);
287         EXPECT_EQ(true, pScanService->SingleScan(scanConfig));
288     }
289 
SingleScanSuccess3()290     void SingleScanSuccess3()
291     {
292         ScanConfig scanConfig;
293         scanConfig.scanBand = SCAN_BAND_24_GHZ;
294         scanConfig.scanType = ScanType::SCAN_TYPE_EXTERN;
295         scanConfig.scanStyle = SCAN_TYPE_HIGH_ACCURACY;
296         EXPECT_EQ(true, pScanService->SingleScan(scanConfig));
297     }
298 
SingleScanFail1()299     void SingleScanFail1()
300     {
301         ScanConfig scanConfig;
302         scanConfig.scanBand = SCAN_BAND_UNSPECIFIED;
303         scanConfig.scanType = ScanType::SCAN_TYPE_EXTERN;
304         scanConfig.scanStyle = SCAN_TYPE_HIGH_ACCURACY;
305         EXPECT_EQ(false, pScanService->SingleScan(scanConfig));
306     }
307 
SingleScanFail2()308     void SingleScanFail2()
309     {
310         ScanConfig scanConfig;
311         scanConfig.scanBand = static_cast<ScanBandType>(-1);
312         scanConfig.scanType = ScanType::SCAN_TYPE_EXTERN;
313         scanConfig.scanStyle = SCAN_TYPE_HIGH_ACCURACY;
314         EXPECT_EQ(false, pScanService->SingleScan(scanConfig));
315     }
316 
GetBandFreqsSuccess1()317     void GetBandFreqsSuccess1()
318     {
319         ScanBandType band = SCAN_BAND_24_GHZ;
320         std::vector<int> freqs;
321         EXPECT_EQ(true, pScanService->GetBandFreqs(band, freqs));
322     }
323 
GetBandFreqsSuccess2()324     void GetBandFreqsSuccess2()
325     {
326         ScanBandType band = SCAN_BAND_5_GHZ;
327         std::vector<int> freqs;
328         EXPECT_EQ(true, pScanService->GetBandFreqs(band, freqs));
329     }
330 
GetBandFreqsSuccess3()331     void GetBandFreqsSuccess3()
332     {
333         ScanBandType band = SCAN_BAND_BOTH;
334         std::vector<int> freqs;
335         EXPECT_EQ(true, pScanService->GetBandFreqs(band, freqs));
336     }
337 
GetBandFreqsSuccess4()338     void GetBandFreqsSuccess4()
339     {
340         ScanBandType band = SCAN_BAND_5_GHZ_DFS_ONLY;
341         std::vector<int> freqs;
342         EXPECT_EQ(true, pScanService->GetBandFreqs(band, freqs));
343     }
344 
GetBandFreqsSuccess5()345     void GetBandFreqsSuccess5()
346     {
347         ScanBandType band = SCAN_BAND_5_GHZ_WITH_DFS;
348         std::vector<int> freqs;
349         EXPECT_EQ(true, pScanService->GetBandFreqs(band, freqs));
350     }
351 
GetBandFreqsSuccess6()352     void GetBandFreqsSuccess6()
353     {
354         ScanBandType band = SCAN_BAND_BOTH_WITH_DFS;
355         std::vector<int> freqs;
356         EXPECT_EQ(true, pScanService->GetBandFreqs(band, freqs));
357     }
358 
GetBandFreqsFail()359     void GetBandFreqsFail()
360     {
361         ScanBandType band = SCAN_BAND_UNSPECIFIED;
362         std::vector<int> freqs;
363         EXPECT_EQ(false, pScanService->GetBandFreqs(band, freqs));
364     }
365 
AddScanMessageBodySuccess()366     void AddScanMessageBodySuccess()
367     {
368         InternalMessagePtr msg = std::make_shared<InternalMessage>();
369         InterScanConfig interConfig;
370         interConfig.hiddenNetworkSsid.push_back("hmwifi");
371         interConfig.scanFreqs.push_back(FREQ_2_DOT_4_GHZ);
372         EXPECT_EQ(true, pScanService->AddScanMessageBody(msg, interConfig));
373     }
374 
AddScanMessageBodyFail()375     void AddScanMessageBodyFail()
376     {
377         InterScanConfig interConfig;
378         EXPECT_EQ(false, pScanService->AddScanMessageBody(nullptr, interConfig));
379     }
380 
StoreRequestScanConfigSuccess()381     void StoreRequestScanConfigSuccess()
382     {
383         ScanConfig scanConfig;
384         InterScanConfig interConfig;
385         pScanService->StoreRequestScanConfig(scanConfig, interConfig);
386     }
387 
StoreRequestScanConfigFail()388     void StoreRequestScanConfigFail()
389     {
390         ScanConfig scanConfig;
391         InterScanConfig interConfig;
392         pScanService->scanConfigMap.clear();
393         pScanService->scanConfigStoreIndex = MAX_SCAN_CONFIG;
394         EXPECT_TRUE(pScanService->StoreRequestScanConfig(scanConfig, interConfig) == 0);
395     }
396 
HandleCommonScanFailedSuccess1()397     void HandleCommonScanFailedSuccess1()
398     {
399         EXPECT_CALL(WifiManager::GetInstance(), DealScanFinished(_, _)).Times(AtLeast(0));
400         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_CONNECTING);
401         std::vector<int> requestIndexList;
402         pScanService->HandleCommonScanFailed(requestIndexList);
403     }
404 
HandleCommonScanFailedSuccess2()405     void HandleCommonScanFailedSuccess2()
406     {
407         EXPECT_CALL(WifiManager::GetInstance(), DealScanFinished(_, _)).Times(AtLeast(0));
408         pScanService->staStatus = static_cast<int>(OperateResState::DISCONNECT_DISCONNECTED);
409         std::vector<int> requestIndexList;
410         requestIndexList.push_back(0);
411         pScanService->HandleCommonScanFailed(requestIndexList);
412     }
413 
HandleCommonScanFailedSuccess3()414     void HandleCommonScanFailedSuccess3()
415     {
416         EXPECT_CALL(WifiManager::GetInstance(), DealScanFinished(_, _));
417         pScanService->staStatus = static_cast<int>(OperateResState::DISCONNECT_DISCONNECTED);
418         StoreScanConfig storeScanConfig;
419         storeScanConfig.fullScanFlag = true;
420         pScanService->scanConfigMap.emplace(0, storeScanConfig);
421         std::vector<int> requestIndexList;
422         requestIndexList.push_back(0);
423         pScanService->HandleCommonScanFailed(requestIndexList);
424     }
425 
HandleCommonScanFailedSuccess4()426     void HandleCommonScanFailedSuccess4()
427     {
428         EXPECT_CALL(WifiManager::GetInstance(), DealScanFinished(_, _)).Times(AtLeast(0));
429         pScanService->staStatus = static_cast<int>(OperateResState::DISCONNECT_DISCONNECTED);
430         StoreScanConfig storeScanConfig;
431         storeScanConfig.fullScanFlag = false;
432         pScanService->scanConfigMap.emplace(0, storeScanConfig);
433         std::vector<int> requestIndexList;
434         requestIndexList.push_back(0);
435         pScanService->HandleCommonScanFailed(requestIndexList);
436     }
437 
HandleCommonScanInfoSuccess1()438     void HandleCommonScanInfoSuccess1()
439     {
440         std::vector<int> requestIndexList;
441         requestIndexList.push_back(0);
442         std::vector<InterScanInfo> scanInfoList;
443         pScanService->HandleCommonScanInfo(requestIndexList, scanInfoList);
444     }
445 
HandleCommonScanInfoSuccess2()446     void HandleCommonScanInfoSuccess2()
447     {
448         ON_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).WillByDefault(Return(0));
449         StoreScanConfig storeScanConfig0;
450         storeScanConfig0.fullScanFlag = true;
451         StoreScanConfig storeScanConfig1;
452         storeScanConfig1.fullScanFlag = true;
453         pScanService->scanConfigMap.emplace(0, storeScanConfig0);
454         pScanService->scanConfigMap.emplace(1, storeScanConfig1);
455         std::vector<int> requestIndexList { 0, 1 };
456         std::vector<InterScanInfo> scanInfoList;
457         pScanService->HandleCommonScanInfo(requestIndexList, scanInfoList);
458     }
459 
HandleCommonScanInfoSuccess3()460     void HandleCommonScanInfoSuccess3()
461     {
462         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).Times(AtLeast(0));
463         StoreScanConfig storeScanConfig;
464         storeScanConfig.fullScanFlag = false;
465         pScanService->scanConfigMap.emplace(0, storeScanConfig);
466         std::vector<int> requestIndexList { 0 };
467         std::vector<InterScanInfo> scanInfoList;
468         pScanService->HandleCommonScanInfo(requestIndexList, scanInfoList);
469     }
470 
StoreFullScanInfoSuccess()471     void StoreFullScanInfoSuccess()
472     {
473         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).WillRepeatedly(Return(0));
474         StoreScanConfig scanConfig;
475         std::vector<InterScanInfo> scanInfoList { InterScanInfo() };
476         EXPECT_EQ(true, pScanService->StoreFullScanInfo(scanConfig, scanInfoList));
477     }
478 
StoreFullScanInfoFail()479     void StoreFullScanInfoFail()
480     {
481         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).WillRepeatedly(Return(-1));
482         StoreScanConfig scanConfig;
483         std::vector<InterScanInfo> scanInfoList { InterScanInfo() };
484         EXPECT_EQ(true, pScanService->StoreFullScanInfo(scanConfig, scanInfoList));
485     }
486 
StoreUserScanInfoSuccess1()487     void StoreUserScanInfoSuccess1()
488     {
489         StoreScanConfig scanConfig;
490         std::vector<InterScanInfo> scanInfoList { InterScanInfo() };
491         EXPECT_EQ(true, pScanService->StoreUserScanInfo(scanConfig, scanInfoList));
492     }
493 
StoreUserScanInfoSuccess2()494     void StoreUserScanInfoSuccess2()
495     {
496         StoreScanConfig scanConfig;
497         scanConfig.scanFreqs.push_back(FREQ_2_DOT_4_GHZ);
498         std::vector<InterScanInfo> scanInfoList;
499         InterScanInfo interScanInfo;
500         interScanInfo.timestamp = 1;
501         scanInfoList.push_back(interScanInfo);
502         EXPECT_EQ(false, pScanService->StoreUserScanInfo(scanConfig, scanInfoList));
503     }
504 
ReportScanInfosSuccess()505     void ReportScanInfosSuccess()
506     {
507         EXPECT_CALL(WifiManager::GetInstance(), DealScanInfoNotify(_, _));
508         std::vector<InterScanInfo> scanInfoList;
509         pScanService->ReportScanInfos(scanInfoList);
510     }
511 
BeginPnoScanSuccess1()512     void BeginPnoScanSuccess1()
513     {
514         pScanService->isPnoScanBegined = false;
515         std::vector<WifiDeviceConfig> results;
516         WifiDeviceConfig cfg;
517         cfg.status = static_cast<int>(WifiDeviceConfigStatus::ENABLED);
518         cfg.isPasspoint = false;
519         cfg.isEphemeral = false;
520         results.push_back(cfg);
521         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_))
522             .WillRepeatedly(DoAll(SetArgReferee<0>(results), Return(0)));
523         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).WillRepeatedly(Return(0));
524         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi2Dot4Ghz(_));
525         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi5Ghz(_));
526         pScanService->BeginPnoScan();
527     }
528 
BeginPnoScanFail1()529     void BeginPnoScanFail1()
530     {
531         pScanService->isPnoScanBegined = false;
532         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(1));
533         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).WillRepeatedly(Return(0));
534         EXPECT_EQ(false, pScanService->BeginPnoScan());
535     }
536 
BeginPnoScanFail2()537     void BeginPnoScanFail2()
538     {
539         pScanService->isPnoScanBegined = false;
540         pScanService->staStatus = static_cast<int>(OperateResState::OPEN_WIFI_OPENING);
541         EXPECT_CALL(WifiConfigCenter::GetInstance(), SaveScanInfoList(_)).WillRepeatedly(Return(0));
542         EXPECT_EQ(false, pScanService->BeginPnoScan());
543     }
544 
BeginPnoScanFail3()545     void BeginPnoScanFail3()
546     {
547         pScanService->isPnoScanBegined = true;
548         EXPECT_EQ(false, pScanService->BeginPnoScan());
549     }
550 
PnoScanSuccess()551     void PnoScanSuccess()
552     {
553         PnoScanConfig pnoScanConfig;
554         InterScanConfig interScanConfig;
555         EXPECT_EQ(true, pScanService->PnoScan(pnoScanConfig, interScanConfig));
556     }
557 
PnoScanFail()558     void PnoScanFail()
559     {
560         PnoScanConfig pnoScanConfig;
561         InterScanConfig interScanConfig;
562         pScanService->pScanStateMachine = nullptr;
563         EXPECT_EQ(false, pScanService->PnoScan(pnoScanConfig, interScanConfig));
564     }
565 
AddPnoScanMessageBodySuccess()566     void AddPnoScanMessageBodySuccess()
567     {
568         InternalMessagePtr interMessage = std::make_shared<InternalMessage>();
569         PnoScanConfig pnoScanConfig;
570         EXPECT_EQ(true, pScanService->AddPnoScanMessageBody(interMessage, pnoScanConfig));
571     }
572 
AddPnoScanMessageBodyFail()573     void AddPnoScanMessageBodyFail()
574     {
575         PnoScanConfig pnoScanConfig;
576         EXPECT_EQ(false, pScanService->AddPnoScanMessageBody(nullptr, pnoScanConfig));
577     }
578 
HandlePnoScanInfoSuccess()579     void HandlePnoScanInfoSuccess()
580     {
581         EXPECT_CALL(WifiManager::GetInstance(), DealScanInfoNotify(_, _));
582         std::vector<InterScanInfo> scanInfoList;
583         InterScanInfo interScanInfo;
584         interScanInfo.timestamp = TIMES_TAMP;
585         scanInfoList.push_back(interScanInfo);
586         pScanService->pnoScanStartTime = 0;
587         pScanService->HandlePnoScanInfo(scanInfoList);
588     }
589 
EndPnoScanSuccess()590     void EndPnoScanSuccess()
591     {
592         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
593         pScanService->isPnoScanBegined = true;
594         pScanService->EndPnoScan();
595     }
596 
EndPnoScanFail()597     void EndPnoScanFail()
598     {
599         pScanService->EndPnoScan();
600     }
601 
EndPnoScanFail2()602     void EndPnoScanFail2()
603     {
604         pScanService->isPnoScanBegined = true;
605         pScanService->pScanStateMachine = nullptr;
606         pScanService->EndPnoScan();
607     }
608 
HandleScreenStatusChangedSuccess()609     void HandleScreenStatusChangedSuccess()
610     {
611         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return(""));
612         pScanService->HandleScreenStatusChanged();
613     }
614 
HandleStaStatusChangedSuccess1()615     void HandleStaStatusChangedSuccess1()
616     {
617         int status = static_cast<int>(OperateResState::DISCONNECT_DISCONNECTED);
618         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return(""));
619         pScanService->HandleStaStatusChanged(status);
620     }
621 
HandleStaStatusChangedSuccess2()622     void HandleStaStatusChangedSuccess2()
623     {
624         int status = static_cast<int>(OperateResState::CONNECT_AP_CONNECTED);
625         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return(""));
626         pScanService->HandleStaStatusChanged(status);
627     }
628 
HandleStaStatusChangedFail()629     void HandleStaStatusChangedFail()
630     {
631         int status = static_cast<int>(OperateResState::OPEN_WIFI_FAILED);
632         pScanService->HandleStaStatusChanged(status);
633     }
634 
HandleCustomStatusChangedSuccess1()635     void HandleCustomStatusChangedSuccess1()
636     {
637         int customScene = 0;
638         int customSceneStatus = MODE_STATE_CLOSE;
639         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
640         pScanService->HandleCustomStatusChanged(customScene, customSceneStatus);
641     }
642 
HandleCustomStatusChangedSuccess2()643     void HandleCustomStatusChangedSuccess2()
644     {
645         int customScene = 0;
646         int customSceneStatus = MODE_STATE_OPEN;
647         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
648         pScanService->HandleCustomStatusChanged(customScene, customSceneStatus);
649     }
650 
SystemScanProcessSuccess1()651     void SystemScanProcessSuccess1()
652     {
653         ScanIntervalMode mode;
654         mode.scanScene = SCAN_SCENE_ALL;
655         mode.scanMode = ScanMode::SYSTEM_TIMER_SCAN;
656         mode.isSingle = false;
657         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
658         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
659         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScreenState()).WillRepeatedly(Return(1));
660         pScanService->SystemScanProcess(true);
661     }
662 
SystemScanProcessSuccess2()663     void SystemScanProcessSuccess2()
664     {
665         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi2Dot4Ghz(_)).Times(AtLeast(0));
666         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi5Ghz(_)).Times(AtLeast(0));
667         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
668         pScanService->SystemScanProcess(true);
669     }
670 
SystemScanProcessSuccess3()671     void SystemScanProcessSuccess3()
672     {
673         ScanIntervalMode mode;
674         mode.scanScene = SCAN_SCENE_MAX;
675         mode.scanMode = ScanMode::SYSTEM_TIMER_SCAN;
676         mode.isSingle = false;
677         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
678         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScreenState()).WillRepeatedly(Return(1));
679         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
680         pScanService->SystemScanProcess(true);
681     }
682 
StopSystemScanSuccess()683     void StopSystemScanSuccess()
684     {
685         pScanService->StopSystemScan();
686         pScanService->pScanStateMachine = nullptr;
687         pScanService->StopSystemScan();
688     }
689 
StartSystemTimerScanFail1()690     void StartSystemTimerScanFail1()
691     {
692         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetThermalLevel()).WillRepeatedly(Return(FOUR));
693         pScanService->staStatus = 0;
694         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
695         pScanService->StartSystemTimerScan(true);
696     }
697 
StartSystemTimerScanFail2()698     void StartSystemTimerScanFail2()
699     {
700         pScanService->lastSystemScanTime = 1;
701         pScanService->systemScanIntervalMode.scanIntervalMode.interval = 1;
702         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
703         pScanService->StartSystemTimerScan(true);
704     }
705 
StartSystemTimerScanFail3()706     void StartSystemTimerScanFail3()
707     {
708         pScanService->lastSystemScanTime = 1;
709         pScanService->systemScanIntervalMode.scanIntervalMode.interval = INVAL;
710         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
711         pScanService->StartSystemTimerScan(false);
712     }
713 
StartSystemTimerScanFail4()714     void StartSystemTimerScanFail4()
715     {
716         pScanService->lastSystemScanTime = 1;
717         pScanService->systemScanIntervalMode.scanIntervalMode.interval = 1;
718         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
719         pScanService->StartSystemTimerScan(false);
720     }
721 
StartSystemTimerScanSuccess()722     void StartSystemTimerScanSuccess()
723     {
724         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return(""));
725         pScanService->lastSystemScanTime = 0;
726         pScanService->systemScanIntervalMode.scanIntervalMode.interval = MAX_SCAN_CONFIG;
727         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
728         pScanService->StartSystemTimerScan(false);
729     }
730 
HandleSystemScanTimeoutSuccess()731     void HandleSystemScanTimeoutSuccess()
732     {
733         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
734         pScanService->HandleSystemScanTimeout();
735     }
736 
DisconnectedTimerScanSuccess()737     void DisconnectedTimerScanSuccess()
738     {
739         pScanService->DisconnectedTimerScan();
740         pScanService->pScanStateMachine = nullptr;
741         pScanService->DisconnectedTimerScan();
742     }
743 
HandleDisconnectedScanTimeoutSuccess()744     void HandleDisconnectedScanTimeoutSuccess()
745     {
746         pScanService->HandleDisconnectedScanTimeout();
747         pScanService->staStatus = 0;
748         pScanService->HandleDisconnectedScanTimeout();
749     }
750 
HandleDisconnectedScanTimeoutFail1()751     void HandleDisconnectedScanTimeoutFail1()
752     {
753         pScanService->pScanStateMachine = nullptr;
754         pScanService->HandleDisconnectedScanTimeout();
755     }
756 
HandleDisconnectedScanTimeoutFail2()757     void HandleDisconnectedScanTimeoutFail2()
758     {
759         pScanService->scanStartedFlag = false;
760         pScanService->HandleDisconnectedScanTimeout();
761     }
762 
RestartPnoScanTimeOutSuccess()763     void RestartPnoScanTimeOutSuccess()
764     {
765         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi2Dot4Ghz(_)).Times(AtLeast(0));
766         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi5Ghz(_)).Times(AtLeast(0));
767         pScanService->RestartPnoScanTimeOut();
768     }
769 
RestartPnoScanTimeOutFail()770     void RestartPnoScanTimeOutFail()
771     {
772         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi2Dot4Ghz(_)).Times(AtLeast(0));
773         EXPECT_CALL(WifiSettings::GetInstance(), GetMinRssi5Ghz(_)).Times(AtLeast(0));
774         pScanService->pnoScanFailedNum = FAILEDNUM;
775         pScanService->RestartPnoScanTimeOut();
776     }
777 
GetScanControlInfoSuccess()778     void GetScanControlInfoSuccess()
779     {
780         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScanControlInfo(_, _)).WillRepeatedly(Return(0));
781         pScanService->GetScanControlInfo();
782     }
783 
GetScanControlInfoFail()784     void GetScanControlInfoFail()
785     {
786         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetScanControlInfo(_, _)).WillRepeatedly(Return(-1));
787         pScanService->GetScanControlInfo();
788     }
789 
AllowExternScanSuccess()790     void AllowExternScanSuccess()
791     {
792         pScanService->AllowExternScan();
793     }
794 
AllowExternScanFail1()795     void AllowExternScanFail1()
796     {
797         int staScene = 0;
798         StoreScanConfig cfg;
799         pScanService->scanConfigMap.emplace(staScene, cfg);
800 
801         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
802         ScanForbidMode forbidMode;
803         forbidMode.scanScene = SCAN_SCENE_SCANNING;
804         forbidMode.scanMode = scanMode;
805         pScanService->scanControlInfo.scanForbidList.push_back(forbidMode);
806 
807         pScanService->AllowExternScan();
808     }
809 
AllowExternScanFail2()810     void AllowExternScanFail2()
811     {
812         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppRunningState())
813             .WillRepeatedly(Return(ScanMode::SYS_FOREGROUND_SCAN));
814         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetThermalLevel()).WillRepeatedly(Return(FOUR));
815         EXPECT_EQ(pScanService->AllowExternScan(), WIFI_OPT_SUCCESS);
816     }
817 
AllowExternScanFail3()818     void AllowExternScanFail3()
819     {
820         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
821         ScanForbidMode forbidMode;
822         forbidMode.scanScene = SCAN_SCENE_CONNECTED;
823         forbidMode.scanMode = scanMode;
824         forbidMode.forbidTime = 0;
825         forbidMode.forbidCount = 0;
826         pScanService->scanControlInfo.scanForbidList.push_back(forbidMode);
827         pScanService->staStatus = STATUS;
828         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppRunningState())
829             .WillRepeatedly(Return(ScanMode::SYS_FOREGROUND_SCAN));
830         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetThermalLevel()).WillRepeatedly(Return(FOUR));
831         EXPECT_EQ(pScanService->AllowExternScan(), WIFI_OPT_SUCCESS);
832     }
833 
AllowExternScanFail4()834     void AllowExternScanFail4()
835     {
836         pScanService->disableScanFlag = true;
837         EXPECT_CALL(WifiConfigCenter::GetInstance(), SetThermalLevel(TWO)).Times(AtLeast(0));
838         EXPECT_EQ(pScanService->AllowExternScan(), WIFI_OPT_FAILED);
839     }
840 
AllowSystemTimerScanSuccess()841     void AllowSystemTimerScanSuccess()
842     {
843         ScanIntervalMode mode;
844         mode.scanScene = SCAN_SCENE_ALL;
845         mode.scanMode = ScanMode::SYSTEM_TIMER_SCAN;
846         mode.isSingle = false;
847         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
848         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
849         pScanService->AllowSystemTimerScan();
850     }
851 
AllowSystemTimerScanFail1()852     void AllowSystemTimerScanFail1()
853     {
854         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
855         pScanService->AllowSystemTimerScan();
856     }
857 
AllowSystemTimerScanFail3()858     void AllowSystemTimerScanFail3()
859     {
860         pScanService->staStatus = FREQ_2_DOT_4_GHZ;
861         EXPECT_EQ(pScanService->AllowSystemTimerScan(), WIFI_OPT_FAILED);
862     }
863 
AllowSystemTimerScanFail5()864     void AllowSystemTimerScanFail5()
865     {
866         const int staScene = 17;
867         time_t now = time(nullptr);
868         if (now < 0) {
869             return;
870         }
871         pScanService->customSceneTimeMap.emplace(staScene, now);
872         ScanMode scanMode = ScanMode::SYSTEM_TIMER_SCAN;
873         ScanForbidMode forbidMode;
874         forbidMode.scanScene = static_cast<int>(OperateResState::CONNECT_AP_CONNECTED);
875         forbidMode.scanMode = scanMode;
876         forbidMode.forbidTime = 0;
877         forbidMode.forbidCount = 0;
878         pScanService->scanControlInfo.scanForbidList.push_back(forbidMode);
879         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
880         pScanService->scanTrustMode = false;
881         EXPECT_EQ(pScanService->AllowSystemTimerScan(), WIFI_OPT_FAILED);
882     }
883 
AllowPnoScanSuccess()884     void AllowPnoScanSuccess()
885     {
886         ScanIntervalMode mode;
887         mode.scanScene = SCAN_SCENE_ALL;
888         mode.scanMode = ScanMode::PNO_SCAN;
889         mode.isSingle = false;
890         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
891         pScanService->AllowPnoScan();
892     }
893 
GetStaSceneSuccess1()894     void GetStaSceneSuccess1()
895     {
896         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_AP_CONNECTED);
897         EXPECT_EQ(SCAN_SCENE_CONNECTED, pScanService->GetStaScene());
898     }
899 
GetStaSceneSuccess2()900     void GetStaSceneSuccess2()
901     {
902         pScanService->staStatus = static_cast<int>(OperateResState::DISCONNECT_DISCONNECTED);
903         EXPECT_EQ(SCAN_SCENE_DISCONNCTED, pScanService->GetStaScene());
904     }
905 
GetStaSceneSuccess3()906     void GetStaSceneSuccess3()
907     {
908         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_CONNECTING);
909         EXPECT_EQ(SCAN_SCENE_CONNECTING, pScanService->GetStaScene());
910     }
911 
GetStaSceneSuccess4()912     void GetStaSceneSuccess4()
913     {
914         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_OBTAINING_IP);
915         EXPECT_EQ(SCAN_SCENE_OBTAINING_IP, pScanService->GetStaScene());
916     }
917 
GetStaSceneSuccess5()918     void GetStaSceneSuccess5()
919     {
920         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_ASSOCIATING);
921         EXPECT_EQ(SCAN_SCENE_ASSOCIATING, pScanService->GetStaScene());
922     }
923 
GetStaSceneSuccess6()924     void GetStaSceneSuccess6()
925     {
926         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_ASSOCIATED);
927         EXPECT_EQ(SCAN_SCENE_ASSOCIATED, pScanService->GetStaScene());
928     }
929 
GetStaSceneFail()930     void GetStaSceneFail()
931     {
932         pScanService->staStatus = static_cast<int>(OperateResState::OPEN_WIFI_FAILED);
933         EXPECT_EQ(SCAN_SCENE_MAX, pScanService->GetStaScene());
934     }
935 
IsExternScanningSuccess()936     void IsExternScanningSuccess()
937     {
938         StoreScanConfig storeScanConfig;
939         storeScanConfig.scanType = ScanType::SCAN_TYPE_EXTERN;
940         pScanService->scanConfigMap.emplace(0, storeScanConfig);
941         EXPECT_EQ(true, pScanService->IsExternScanning());
942     }
943 
IsScanningWithParamTest()944     void IsScanningWithParamTest()
945     {
946         StoreScanConfig storeScanConfig;
947         storeScanConfig.scanningWithParamFlag = true;
948         pScanService->scanConfigMap.emplace(0, storeScanConfig);
949         EXPECT_EQ(true, pScanService->IsScanningWithParam());
950 
951         pScanService->scanConfigMap.clear();
952         EXPECT_EQ(false, pScanService->IsScanningWithParam());
953     }
954 
IsExternScanningFail()955     void IsExternScanningFail()
956     {
957         StoreScanConfig storeScanConfig;
958         storeScanConfig.scanType = ScanType::SCAN_TYPE_SYSTEMTIMER;
959         pScanService->scanConfigMap.emplace(0, storeScanConfig);
960         EXPECT_EQ(false, pScanService->IsExternScanning());
961     }
962 
GetAllowBandFreqsControlInfoSuccess()963     void GetAllowBandFreqsControlInfoSuccess()
964     {
965         std::vector<int> freqs;
966         freqs.push_back(FREQ_2_DOT_4_GHZ);
967         ScanBandType scanBand = SCAN_BAND_24_GHZ;
968         ScanForbidMode scanForbidMode, forbidMode;
969         scanForbidMode.scanScene = SCAN_SCENE_ALL;
970         scanForbidMode.scanMode = ScanMode::BAND_24GHZ_SCAN;
971         forbidMode.scanScene = SCAN_SCENE_ALL;
972         forbidMode.scanMode = ScanMode::BAND_5GHZ_SCAN;
973         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
974         pScanService->scanControlInfo.scanForbidList.push_back(forbidMode);
975         pScanService->GetAllowBandFreqsControlInfo(scanBand, freqs);
976     }
977 
GetAllowBandFreqsControlInfoSuccess1()978     void GetAllowBandFreqsControlInfoSuccess1()
979     {
980         std::vector<int> freqs;
981         freqs.push_back(FREQ_2_DOT_4_GHZ);
982         time_t now = time(nullptr);
983         ScanBandType scanBand = SCAN_BAND_24_GHZ;
984         ScanForbidMode scanForbidMode;
985         scanForbidMode.scanScene = SCAN_SCENE_CONNECTED;
986         scanForbidMode.scanMode = ScanMode::BAND_24GHZ_SCAN;
987         scanForbidMode.forbidTime = 0;
988         scanForbidMode.forbidCount = 0;
989         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
990         pScanService->customSceneTimeMap.emplace(SCAN_SCENE_CONNECTED, now);
991         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_AP_CONNECTED);
992         pScanService->GetAllowBandFreqsControlInfo(scanBand, freqs);
993     }
994 
GetAllowBandFreqsControlInfoSuccess2()995     void GetAllowBandFreqsControlInfoSuccess2()
996     {
997         std::vector<int> freqs;
998         freqs.push_back(FREQ_5_GHZ);
999         time_t now = time(nullptr);
1000         ScanBandType scanBand = SCAN_BAND_5_GHZ;
1001         ScanForbidMode scanForbidMode;
1002         scanForbidMode.scanScene = SCAN_SCENE_CONNECTED;
1003         scanForbidMode.scanMode = ScanMode::BAND_5GHZ_SCAN;
1004         scanForbidMode.forbidTime = 0;
1005         scanForbidMode.forbidCount = 0;
1006         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1007         pScanService->customSceneTimeMap.emplace(SCAN_SCENE_CONNECTED, now);
1008         pScanService->staStatus = static_cast<int>(OperateResState::CONNECT_AP_CONNECTED);
1009         pScanService->GetAllowBandFreqsControlInfo(scanBand, freqs);
1010     }
1011 
ConvertBandNotAllow24GSuccess1()1012     void ConvertBandNotAllow24GSuccess1()
1013     {
1014         ScanBandType scanBand = SCAN_BAND_24_GHZ;
1015         EXPECT_EQ(SCAN_BAND_UNSPECIFIED, pScanService->ConvertBandNotAllow24G(scanBand));
1016     }
1017 
ConvertBandNotAllow24GSuccess2()1018     void ConvertBandNotAllow24GSuccess2()
1019     {
1020         ScanBandType scanBand = SCAN_BAND_BOTH;
1021         EXPECT_EQ(SCAN_BAND_5_GHZ, pScanService->ConvertBandNotAllow24G(scanBand));
1022     }
1023 
ConvertBandNotAllow24GSuccess3()1024     void ConvertBandNotAllow24GSuccess3()
1025     {
1026         ScanBandType scanBand = SCAN_BAND_BOTH_WITH_DFS;
1027         EXPECT_EQ(SCAN_BAND_5_GHZ_WITH_DFS, pScanService->ConvertBandNotAllow24G(scanBand));
1028     }
1029 
ConvertBandNotAllow24GSuccess4()1030     void ConvertBandNotAllow24GSuccess4()
1031     {
1032         ScanBandType scanBand = SCAN_BAND_5_GHZ;
1033         EXPECT_EQ(SCAN_BAND_5_GHZ, pScanService->ConvertBandNotAllow24G(scanBand));
1034     }
1035 
ConvertBandNotAllow24GFail()1036     void ConvertBandNotAllow24GFail()
1037     {
1038         ScanBandType scanBand = SCAN_BAND_UNSPECIFIED;
1039         EXPECT_EQ(SCAN_BAND_UNSPECIFIED, pScanService->ConvertBandNotAllow24G(scanBand));
1040     }
1041 
ConvertBandNotAllow5GSuccess()1042     void ConvertBandNotAllow5GSuccess()
1043     {
1044         ScanBandType scanBand = SCAN_BAND_24_GHZ;
1045         EXPECT_EQ(SCAN_BAND_24_GHZ, pScanService->ConvertBandNotAllow5G(scanBand));
1046     }
1047 
ConvertBandNotAllow5GFail()1048     void ConvertBandNotAllow5GFail()
1049     {
1050         ScanBandType scanBand = SCAN_BAND_5_GHZ;
1051         EXPECT_EQ(SCAN_BAND_UNSPECIFIED, pScanService->ConvertBandNotAllow5G(scanBand));
1052     }
1053 
Delete24GhzFreqsSuccess()1054     void Delete24GhzFreqsSuccess()
1055     {
1056         std::vector<int> freqs;
1057         freqs.push_back(FREQ_2_DOT_4_GHZ);
1058         pScanService->Delete24GhzFreqs(freqs);
1059     }
1060 
Delete5GhzFreqsSuccess()1061     void Delete5GhzFreqsSuccess()
1062     {
1063         std::vector<int> freqs;
1064         freqs.push_back(FREQ_5_GHZ);
1065         pScanService->Delete5GhzFreqs(freqs);
1066     }
1067 
GetSavedNetworkSsidListSuccess()1068     void GetSavedNetworkSsidListSuccess()
1069     {
1070         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).WillRepeatedly(Return(0));
1071         std::vector<std::string> savedNetworkSsid;
1072         EXPECT_EQ(true, pScanService->GetSavedNetworkSsidList(savedNetworkSsid));
1073     }
1074 
GetSavedNetworkSsidListFail()1075     void GetSavedNetworkSsidListFail()
1076     {
1077         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).WillRepeatedly(Return(-1));
1078         std::vector<std::string> savedNetworkSsid;
1079         EXPECT_EQ(false, pScanService->GetSavedNetworkSsidList(savedNetworkSsid));
1080     }
1081 
GetHiddenNetworkSsidListSuccess1()1082     void GetHiddenNetworkSsidListSuccess1()
1083     {
1084         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).WillRepeatedly(Return(0));
1085         std::vector<std::string> hiddenNetworkSsid;
1086         EXPECT_EQ(true, pScanService->GetHiddenNetworkSsidList(hiddenNetworkSsid));
1087     }
1088 
GetHiddenNetworkSsidListSuccess2()1089     void GetHiddenNetworkSsidListSuccess2()
1090     {
1091         std::vector<WifiDeviceConfig> deviceConfigs;
1092         WifiDeviceConfig cfg;
1093         cfg.hiddenSSID = true;
1094         deviceConfigs.push_back(cfg);
1095         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_))
1096             .WillRepeatedly(DoAll(SetArgReferee<0>(deviceConfigs), Return(0)));
1097         std::vector<std::string> hiddenNetworkSsid;
1098         EXPECT_EQ(true, pScanService->GetHiddenNetworkSsidList(hiddenNetworkSsid));
1099     }
1100 
GetHiddenNetworkSsidListFail()1101     void GetHiddenNetworkSsidListFail()
1102     {
1103         EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).WillRepeatedly(Return(-1));
1104         std::vector<std::string> hiddenNetworkSsid;
1105         EXPECT_EQ(false, pScanService->GetHiddenNetworkSsidList(hiddenNetworkSsid));
1106     }
1107 
SetStaCurrentTimeSuccess()1108     void SetStaCurrentTimeSuccess()
1109     {
1110         EXPECT_CALL(WifiConfigCenter::GetInstance(), SetScreenState(TWO));
1111         pScanService->ClearScanControlValue();
1112         pScanService->SetStaCurrentTime();
1113     }
1114 
AllowScanDuringScanningSuccess()1115     void AllowScanDuringScanningSuccess()
1116     {
1117         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1118         EXPECT_EQ(pScanService->AllowScanDuringScanning(scanMode), true);
1119     }
1120 
AllowScanDuringScanningFail()1121     void AllowScanDuringScanningFail()
1122     {
1123         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1124         ScanForbidMode forbidMode;
1125         forbidMode.scanScene = SCAN_SCENE_SCANNING;
1126         forbidMode.scanMode = scanMode;
1127         pScanService->scanControlInfo.scanForbidList.push_back(forbidMode);
1128         EXPECT_EQ(pScanService->AllowScanDuringScanning(scanMode), false);
1129     }
1130 
AllowScanDuringStaSceneSuccess1()1131     void AllowScanDuringStaSceneSuccess1()
1132     {
1133         const int staScene = 0;
1134         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1135         ScanForbidMode scanForbidMode;
1136         scanForbidMode.scanScene = staScene;
1137         scanForbidMode.scanMode = scanMode;
1138         scanForbidMode.forbidTime = 1;
1139         scanForbidMode.forbidCount = 1;
1140         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1141         EXPECT_EQ(pScanService->AllowScanDuringStaScene(staScene, scanMode), false);
1142     }
1143 
AllowScanDuringStaSceneFail1()1144     void AllowScanDuringStaSceneFail1()
1145     {
1146         const int staScene = 0;
1147         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1148         ScanForbidMode scanForbidMode;
1149         scanForbidMode.scanScene = staScene;
1150         scanForbidMode.scanMode = scanMode;
1151         scanForbidMode.forbidTime = 0;
1152         scanForbidMode.forbidCount = 0;
1153         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1154         EXPECT_EQ(pScanService->AllowScanDuringStaScene(staScene, scanMode), false);
1155     }
1156 
AllowScanDuringStaSceneFail2()1157     void AllowScanDuringStaSceneFail2()
1158     {
1159         const int staScene = 0;
1160         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1161         ScanForbidMode scanForbidMode;
1162         scanForbidMode.scanScene = staScene;
1163         scanForbidMode.scanMode = scanMode;
1164         scanForbidMode.forbidTime = 1;
1165         scanForbidMode.forbidCount = 1;
1166         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1167         EXPECT_EQ(pScanService->AllowScanDuringStaScene(staScene, scanMode), false);
1168     }
1169 
AllowScanDuringStaSceneFail3()1170     void AllowScanDuringStaSceneFail3()
1171     {
1172         const int staScene = 0;
1173         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1174         ScanForbidMode scanForbidMode;
1175         scanForbidMode.scanScene = staScene;
1176         scanForbidMode.scanMode = scanMode;
1177         scanForbidMode.forbidTime = 1;
1178         scanForbidMode.forbidCount = 1;
1179         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1180         EXPECT_EQ(pScanService->AllowScanDuringStaScene(staScene, scanMode), false);
1181     }
1182 
AllowScanDuringCustomSceneSuccess()1183     void AllowScanDuringCustomSceneSuccess()
1184     {
1185         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1186         EXPECT_EQ(pScanService->AllowScanDuringCustomScene(scanMode), true);
1187     }
1188 
AllowScanDuringCustomSceneSuccess1()1189     void AllowScanDuringCustomSceneSuccess1()
1190     {
1191         const int staScene = 0;
1192         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1193         time_t now = time(nullptr);
1194         if (now < 0) {
1195             return;
1196         }
1197         pScanService->customSceneTimeMap.emplace(staScene, now);
1198         pScanService->SetScanTrustMode();
1199         pScanService->scanTrustSceneIds.emplace(0);
1200         EXPECT_EQ(pScanService->AllowScanDuringCustomScene(scanMode), true);
1201     }
1202 
AllowScanDuringCustomSceneSuccess2()1203     void AllowScanDuringCustomSceneSuccess2()
1204     {
1205         const int staScene = 0;
1206         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1207         time_t now = time(nullptr);
1208         if (now < 0) {
1209             return;
1210         }
1211         pScanService->customSceneTimeMap.emplace(staScene, now);
1212         pScanService->SetScanTrustMode();
1213         pScanService->scanTrustSceneIds.emplace(1);
1214         EXPECT_EQ(pScanService->AllowScanDuringCustomScene(scanMode), true);
1215     }
1216 
AllowScanDuringCustomSceneFail1()1217     void AllowScanDuringCustomSceneFail1()
1218     {
1219         const int staScene = 0;
1220         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1221         time_t now = time(nullptr);
1222         if (now < 0) {
1223             return;
1224         }
1225         pScanService->customSceneTimeMap.emplace(staScene, now);
1226         ScanForbidMode scanForbidMode;
1227         scanForbidMode.scanScene = staScene;
1228         scanForbidMode.scanMode = scanMode;
1229         scanForbidMode.forbidTime = 0;
1230         scanForbidMode.forbidCount = 0;
1231         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1232         EXPECT_EQ(pScanService->AllowScanDuringCustomScene(scanMode), false);
1233     }
1234 
AllowScanDuringCustomSceneFail2()1235     void AllowScanDuringCustomSceneFail2()
1236     {
1237         const int staScene = 0;
1238         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1239         time_t now = time(nullptr);
1240         if (now < 0) {
1241             return;
1242         }
1243         pScanService->customSceneTimeMap.emplace(staScene, now);
1244         ScanForbidMode scanForbidMode;
1245         scanForbidMode.scanScene = staScene;
1246         scanForbidMode.scanMode = scanMode;
1247         scanForbidMode.forbidTime = 1;
1248         scanForbidMode.forbidCount = 1;
1249         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1250         EXPECT_EQ(pScanService->AllowScanDuringCustomScene(scanMode), false);
1251     }
1252 
AllowScanDuringCustomSceneFail3()1253     void AllowScanDuringCustomSceneFail3()
1254     {
1255         const int staScene = 0;
1256         ScanMode scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1257         time_t now = time(nullptr);
1258         if (now < 0) {
1259             return;
1260         }
1261         pScanService->customSceneTimeMap.emplace(staScene, now);
1262         ScanForbidMode scanForbidMode;
1263         scanForbidMode.scanScene = staScene;
1264         scanForbidMode.scanMode = scanMode;
1265         scanForbidMode.forbidTime = 1;
1266         scanForbidMode.forbidCount = 1;
1267         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1268         EXPECT_EQ(pScanService->AllowScanDuringCustomScene(scanMode), false);
1269     }
1270 
AllowExternScanByIntervalModeFail1()1271     void AllowExternScanByIntervalModeFail1()
1272     {
1273         pScanService->SetScanTrustMode();
1274         pScanService->AddScanTrustSceneId(0);
1275         EXPECT_EQ(pScanService->AllowExternScanByIntervalMode(0, 0, ScanMode::SYSTEM_TIMER_SCAN), true);
1276     }
1277 
AllowExternScanByIntervalModeFail2()1278     void AllowExternScanByIntervalModeFail2()
1279     {
1280         ScanIntervalMode mode;
1281         mode.scanScene = 0;
1282         mode.scanMode = ScanMode::SYSTEM_TIMER_SCAN;
1283         mode.isSingle = true;
1284         mode.interval = 1;
1285         mode.count = 0;
1286         mode.intervalMode = IntervalMode::INTERVAL_FIXED;
1287         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
1288         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
1289         pScanService->scanTrustMode = false;
1290         EXPECT_EQ(pScanService->AllowExternScanByIntervalMode(0, 0, ScanMode::SYSTEM_TIMER_SCAN), false);
1291     }
1292 
AllowExternScanByIntervalModeFail3()1293     void AllowExternScanByIntervalModeFail3()
1294     {
1295         ScanIntervalMode mode;
1296         mode.scanScene = 0;
1297         mode.scanMode = ScanMode::SYSTEM_TIMER_SCAN;
1298         mode.isSingle = false;
1299         mode.interval = 1;
1300         mode.count = 0;
1301         mode.intervalMode = IntervalMode::INTERVAL_FIXED;
1302         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
1303         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
1304         pScanService->scanTrustMode = false;
1305         EXPECT_EQ(pScanService->AllowExternScanByIntervalMode(0, 0, ScanMode::SYSTEM_TIMER_SCAN), false);
1306     }
1307 
AllowExternScanByIntervalModeSuccess()1308     void AllowExternScanByIntervalModeSuccess()
1309     {
1310         ScanIntervalMode mode;
1311         mode.scanScene = 1;
1312         mode.scanMode = ScanMode::SYSTEM_TIMER_SCAN;
1313         mode.isSingle = false;
1314         pScanService->scanControlInfo.scanIntervalList.push_back(mode);
1315         pScanService->scanTrustMode = false;
1316         EXPECT_EQ(pScanService->AllowExternScanByIntervalMode(0, 0, ScanMode::SYSTEM_TIMER_SCAN), true);
1317     }
1318 
AllowExternScanByIntervalModeSuccess1()1319     void AllowExternScanByIntervalModeSuccess1()
1320     {
1321         pScanService->scanTrustMode = false;
1322         pScanService->scanTrustSceneIds.emplace(0);
1323         EXPECT_EQ(pScanService->AllowExternScanByIntervalMode(0, 0, ScanMode::SYSTEM_TIMER_SCAN), true);
1324     }
1325 
PnoScanByIntervalSuccess1()1326     void PnoScanByIntervalSuccess1()
1327     {
1328         int fixedScanCount = 0;
1329         time_t fixedScanTime = 0;
1330         int interval = 0;
1331         int count = 0;
1332         EXPECT_EQ(pScanService->PnoScanByInterval(fixedScanCount, fixedScanTime, interval, count), true);
1333     }
1334 
PnoScanByIntervalSuccess2()1335     void PnoScanByIntervalSuccess2()
1336     {
1337         int fixedScanCount = 1;
1338         time_t fixedScanTime = time(nullptr) - 1;
1339         int interval = 0;
1340         int count = 0;
1341         EXPECT_EQ(pScanService->PnoScanByInterval(fixedScanCount, fixedScanTime, interval, count), true);
1342     }
1343 
PnoScanByIntervalSuccess3()1344     void PnoScanByIntervalSuccess3()
1345     {
1346         int fixedScanCount = 1;
1347         time_t fixedScanTime = time(nullptr) + 1;
1348         int interval = 1;
1349         int count = 1;
1350         EXPECT_EQ(pScanService->PnoScanByInterval(fixedScanCount, fixedScanTime, interval, count), true);
1351     }
1352 
PnoScanByIntervalFail1()1353     void PnoScanByIntervalFail1()
1354     {
1355         int fixedScanCount = 2;
1356         time_t fixedScanTime = time(nullptr) + 1;
1357         int interval = 1;
1358         int count = 1;
1359         EXPECT_EQ(pScanService->PnoScanByInterval(fixedScanCount, fixedScanTime, interval, count), false);
1360     }
1361 
SystemScanByIntervalSuccess()1362     void SystemScanByIntervalSuccess()
1363     {
1364         int expScanCount = 1;
1365         int interval = 1;
1366         const int constTest = 2;
1367         int count = constTest;
1368         EXPECT_EQ(pScanService->SystemScanByInterval(expScanCount, interval, count), true);
1369     }
1370 
ExternScanByIntervalSuccess1()1371     void ExternScanByIntervalSuccess1()
1372     {
1373         SingleAppForbid singleAppForbid;
1374         singleAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_FIXED;
1375         EXPECT_EQ(pScanService->ExternScanByInterval(0, singleAppForbid), true);
1376     }
1377 
ExternScanByIntervalSuccess2()1378     void ExternScanByIntervalSuccess2()
1379     {
1380         SingleAppForbid singleAppForbid;
1381         singleAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_EXP;
1382         EXPECT_EQ(pScanService->ExternScanByInterval(0, singleAppForbid), true);
1383     }
1384 
ExternScanByIntervalSuccess3()1385     void ExternScanByIntervalSuccess3()
1386     {
1387         SingleAppForbid singleAppForbid;
1388         singleAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_CONTINUE;
1389         EXPECT_EQ(pScanService->ExternScanByInterval(0, singleAppForbid), true);
1390     }
1391 
ExternScanByIntervalSuccess4()1392     void ExternScanByIntervalSuccess4()
1393     {
1394         SingleAppForbid singleAppForbid;
1395         singleAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_BLOCKLIST;
1396         EXPECT_EQ(pScanService->ExternScanByInterval(0, singleAppForbid), true);
1397     }
1398 
ExternScanByIntervalSuccess5()1399     void ExternScanByIntervalSuccess5()
1400     {
1401         SingleAppForbid singleAppForbid;
1402         singleAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_MAX;
1403         EXPECT_EQ(pScanService->ExternScanByInterval(0, singleAppForbid), true);
1404     }
1405 
AllowSingleAppScanByIntervalSuccess1()1406     void AllowSingleAppScanByIntervalSuccess1()
1407     {
1408         int appId = 0;
1409         ScanIntervalMode scanIntervalMode;
1410         EXPECT_EQ(pScanService->AllowSingleAppScanByInterval(appId, scanIntervalMode), true);
1411     }
1412 
AllowSingleAppScanByIntervalSuccess2()1413     void AllowSingleAppScanByIntervalSuccess2()
1414     {
1415         int appId = 0;
1416         SingleAppForbid sAppForbid;
1417         sAppForbid.appID = appId;
1418         sAppForbid.scanIntervalMode.scanScene = SCAN_SCENE_ALL;
1419         sAppForbid.scanIntervalMode.scanMode = ScanMode::SCAN_MODE_MAX;
1420         pScanService->appForbidList.push_back(sAppForbid);
1421         ScanIntervalMode scanIntervalMode = sAppForbid.scanIntervalMode;
1422         EXPECT_EQ(pScanService->AllowSingleAppScanByInterval(appId, scanIntervalMode), true);
1423     }
1424 
AllowSingleAppScanByIntervalFail1()1425     void AllowSingleAppScanByIntervalFail1()
1426     {
1427         int appId = 0;
1428         SingleAppForbid sAppForbid;
1429         sAppForbid.appID = appId;
1430         sAppForbid.scanIntervalMode.scanScene = SCAN_SCENE_ALL;
1431         sAppForbid.scanIntervalMode.scanMode = ScanMode::SCAN_MODE_MAX;
1432 
1433         sAppForbid.fixedScanCount = 1;
1434         sAppForbid.fixedCurrentTime = time(nullptr) - 1;
1435         const int intervalOrCount = 2;
1436         sAppForbid.scanIntervalMode.interval = intervalOrCount;
1437         sAppForbid.scanIntervalMode.count = 1;
1438         sAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_FIXED;
1439 
1440         pScanService->appForbidList.push_back(sAppForbid);
1441 
1442         ScanIntervalMode scanIntervalMode = sAppForbid.scanIntervalMode;
1443         EXPECT_EQ(pScanService->AllowSingleAppScanByInterval(appId, scanIntervalMode), false);
1444     }
1445 
AllowFullAppScanByIntervalSuccess1()1446     void AllowFullAppScanByIntervalSuccess1()
1447     {
1448         int appId = 0;
1449         ScanIntervalMode scanIntervalMode;
1450         EXPECT_EQ(pScanService->AllowFullAppScanByInterval(appId, scanIntervalMode), true);
1451     }
1452 
AllowFullAppScanByIntervalSuccess2()1453     void AllowFullAppScanByIntervalSuccess2()
1454     {
1455         int appId = 0;
1456         SingleAppForbid sAppForbid;
1457         sAppForbid.appID = appId;
1458         sAppForbid.scanIntervalMode.scanScene = SCAN_SCENE_ALL;
1459         sAppForbid.scanIntervalMode.scanMode = ScanMode::SCAN_MODE_MAX;
1460         pScanService->fullAppForbidList.push_back(sAppForbid);
1461         ScanIntervalMode scanIntervalMode = sAppForbid.scanIntervalMode;
1462         EXPECT_EQ(pScanService->AllowFullAppScanByInterval(appId, scanIntervalMode), true);
1463     }
1464 
AllowFullAppScanByIntervalFail1()1465     void AllowFullAppScanByIntervalFail1()
1466     {
1467         int appId = 0;
1468         SingleAppForbid sAppForbid;
1469         sAppForbid.appID = appId;
1470         sAppForbid.scanIntervalMode.scanScene = SCAN_SCENE_ALL;
1471         sAppForbid.scanIntervalMode.scanMode = ScanMode::SCAN_MODE_MAX;
1472 
1473         sAppForbid.fixedScanCount = 1;
1474         sAppForbid.fixedCurrentTime = time(nullptr) - 1;
1475         const int intervalOrCount = 2;
1476         sAppForbid.scanIntervalMode.interval = intervalOrCount;
1477         sAppForbid.scanIntervalMode.count = 1;
1478         sAppForbid.scanIntervalMode.intervalMode = IntervalMode::INTERVAL_FIXED;
1479 
1480         pScanService->fullAppForbidList.push_back(sAppForbid);
1481 
1482         ScanIntervalMode scanIntervalMode = sAppForbid.scanIntervalMode;
1483         EXPECT_EQ(pScanService->AllowFullAppScanByInterval(appId, scanIntervalMode), false);
1484     }
1485 
AllowScanByIntervalFixedSuccess1()1486     void AllowScanByIntervalFixedSuccess1()
1487     {
1488         int fixedScanCount = 0;
1489         time_t fixedScanTime = 0;
1490         int interval = 0;
1491         int count = 0;
1492         bool rlt = pScanService->AllowScanByIntervalFixed(fixedScanCount, fixedScanTime, interval, count);
1493         EXPECT_EQ(rlt, true);
1494     }
1495 
AllowScanByIntervalFixedSuccess2()1496     void AllowScanByIntervalFixedSuccess2()
1497     {
1498         int fixedScanCount = 1;
1499         time_t fixedScanTime = 0;
1500         int interval = 0;
1501         int count = 0;
1502         bool rlt = pScanService->AllowScanByIntervalFixed(fixedScanCount, fixedScanTime, interval, count);
1503         EXPECT_EQ(rlt, true);
1504         fixedScanTime = time(nullptr);
1505         interval = 0;
1506         count = 1;
1507         rlt = pScanService->AllowScanByIntervalFixed(fixedScanCount, fixedScanTime, interval, count);
1508         EXPECT_EQ(rlt, true);
1509     }
1510 
AllowScanByIntervalFixedSuccess3()1511     void AllowScanByIntervalFixedSuccess3()
1512     {
1513         int fixedScanCount = 1;
1514         time_t fixedScanTime = time(nullptr) - 1;
1515         const int intervalOrCount = 2;
1516         int interval = intervalOrCount;
1517         int count = intervalOrCount;
1518         bool rlt = pScanService->AllowScanByIntervalFixed(fixedScanCount, fixedScanTime, interval, count);
1519         EXPECT_EQ(rlt, true);
1520     }
1521 
AllowScanByIntervalFixedFail1()1522     void AllowScanByIntervalFixedFail1()
1523     {
1524         int fixedScanCount = 1;
1525         time_t fixedScanTime = time(nullptr) - 1;
1526         const int intervalOrCount = 2;
1527         int interval = intervalOrCount;
1528         int count = 1;
1529         bool rlt = pScanService->AllowScanByIntervalFixed(fixedScanCount, fixedScanTime, interval, count);
1530         EXPECT_EQ(rlt, false);
1531     }
1532 
AllowScanByIntervalExpSuccess()1533     void AllowScanByIntervalExpSuccess()
1534     {
1535         int expScanCount = 1;
1536         int interval = 1;
1537         const int conutTest = 2;
1538         int count = conutTest;
1539         EXPECT_EQ(pScanService->AllowScanByIntervalExp(expScanCount, interval, count), true);
1540     }
1541 
AllowScanByIntervalContinueSuccess1()1542     void AllowScanByIntervalContinueSuccess1()
1543     {
1544         time_t continueScanTime = 0;
1545         int lessThanIntervalCount = 0;
1546         int interval = 0;
1547         int count = 0;
1548         bool rlt = pScanService->AllowScanByIntervalContinue(continueScanTime, lessThanIntervalCount, interval, count);
1549         EXPECT_EQ(rlt, true);
1550     }
1551 
AllowScanByIntervalContinueSuccess2()1552     void AllowScanByIntervalContinueSuccess2()
1553     {
1554         const int timeTest = 2;
1555         time_t continueScanTime = time(nullptr) - timeTest;
1556         const int intervalTest = 5;
1557         int interval = intervalTest;
1558         int lessThanIntervalCount = 0;
1559         const int countTest = 2;
1560         int count = countTest;
1561         bool rlt = pScanService->AllowScanByIntervalContinue(continueScanTime, lessThanIntervalCount, interval, count);
1562         EXPECT_EQ(rlt, true);
1563     }
1564 
AllowScanByIntervalContinueSuccess3()1565     void AllowScanByIntervalContinueSuccess3()
1566     {
1567         const int timeTest = 5;
1568         time_t continueScanTime = time(nullptr) - timeTest;
1569         int lessThanIntervalCount = 0;
1570         const int intervalTest = 1;
1571         int interval = intervalTest;
1572         int count = 0;
1573         bool rlt = pScanService->AllowScanByIntervalContinue(continueScanTime, lessThanIntervalCount, interval, count);
1574         EXPECT_EQ(rlt, true);
1575     }
1576 
AllowScanByIntervalContinueFail1()1577     void AllowScanByIntervalContinueFail1()
1578     {
1579         const int timeTest = 2;
1580         time_t continueScanTime = time(nullptr) - timeTest;
1581         const int intervalTest = 5;
1582         int interval = intervalTest;
1583         int lessThanIntervalCount = 0;
1584         const int countTest = 1;
1585         int count = countTest;
1586         bool rlt = pScanService->AllowScanByIntervalContinue(continueScanTime, lessThanIntervalCount, interval, count);
1587         EXPECT_EQ(rlt, false);
1588     }
1589 
AllowScanByIntervalBlocklistSuccess1()1590     void AllowScanByIntervalBlocklistSuccess1()
1591     {
1592         int appId = 0;
1593         const int timeTest = 2;
1594         time_t blockListScanTime = time(nullptr) - timeTest;
1595         int lessThanIntervalCount = 0;
1596         int interval = 0;
1597         int count = 0;
1598         pScanService->scanBlocklist.push_back(appId);
1599         pScanService->scanBlocklist.push_back(1);
1600         bool rlt = pScanService->AllowScanByIntervalBlocklist(
1601             appId, blockListScanTime, lessThanIntervalCount, interval, count);
1602         EXPECT_EQ(rlt, true);
1603     }
1604 
AllowScanByIntervalBlocklistSuccess2()1605     void AllowScanByIntervalBlocklistSuccess2()
1606     {
1607         int appId = 0;
1608         const int timeTest = 2;
1609         time_t blockListScanTime = 0;
1610         int lessThanIntervalCount = 0;
1611         int interval = time(nullptr) + timeTest;
1612         int count = 0;
1613         bool rlt = pScanService->AllowScanByIntervalBlocklist(
1614             appId, blockListScanTime, lessThanIntervalCount, interval, count);
1615         EXPECT_EQ(rlt, true);
1616     }
1617 
AllowScanByIntervalBlocklistSuccess3()1618     void AllowScanByIntervalBlocklistSuccess3()
1619     {
1620         int appId = 0;
1621         const int timeTest = 5;
1622         time_t blockListScanTime = time(nullptr) - timeTest;
1623         int lessThanIntervalCount = 0;
1624         const int intervalTest = 10;
1625         int interval = intervalTest;
1626         const int countTest = 2;
1627         int count = countTest;
1628         bool rlt = pScanService->AllowScanByIntervalBlocklist(
1629             appId, blockListScanTime, lessThanIntervalCount, interval, count);
1630         EXPECT_EQ(rlt, true);
1631     }
1632 
AllowScanByIntervalBlocklistFail1()1633     void AllowScanByIntervalBlocklistFail1()
1634     {
1635         int appId = 0;
1636         const int timeTest = 5;
1637         time_t blockListScanTime = time(nullptr) - timeTest;
1638         int lessThanIntervalCount = 0;
1639         const int intervalTest = 10;
1640         int interval = intervalTest;
1641         int count = 0;
1642         pScanService->scanBlocklist.push_back(appId);
1643         bool rlt = pScanService->AllowScanByIntervalBlocklist(
1644             appId, blockListScanTime, lessThanIntervalCount, interval, count);
1645         EXPECT_EQ(rlt, false);
1646     }
1647 
AllowScanByIntervalBlocklistFail2()1648     void AllowScanByIntervalBlocklistFail2()
1649     {
1650         int appId = 0;
1651         const int timeTest = 5;
1652         time_t blockListScanTime = time(nullptr) - timeTest;
1653         int lessThanIntervalCount = 0;
1654         const int intervalTest = 10;
1655         int interval = intervalTest;
1656         int count = 0;
1657         bool rlt = pScanService->AllowScanByIntervalBlocklist(
1658             appId, blockListScanTime, lessThanIntervalCount, interval, count);
1659         EXPECT_EQ(rlt, false);
1660     }
1661 
HandleMovingFreezeChangedTest()1662     void HandleMovingFreezeChangedTest()
1663     {
1664         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppRunningState()).Times(AtLeast(0));
1665         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetFreezeModeState()).Times(AtLeast(0));
1666         std::map<int, time_t> sceneMap;
1667         pScanService->HandleGetCustomSceneState(sceneMap);
1668         pScanService->HandleMovingFreezeChanged();
1669     }
1670 
HandleAutoConnectStateChangedTest()1671     void HandleAutoConnectStateChangedTest()
1672     {
1673         pScanService->HandleAutoConnectStateChanged(true);
1674     }
1675 
HandleNetworkQualityChangedTest()1676     void HandleNetworkQualityChangedTest()
1677     {
1678         int status = static_cast<int>(OperateResState::CONNECT_NETWORK_ENABLED);
1679         pScanService->staStatus = static_cast<int>(OperateResState::CLOSE_WIFI_FAILED);
1680         pScanService->HandleNetworkQualityChanged(status);
1681         status = static_cast<int>(OperateResState::CONNECT_NETWORK_DISABLED);
1682         pScanService->HandleNetworkQualityChanged(status);
1683     }
1684 
WifiMaxThroughputTest()1685     void WifiMaxThroughputTest()
1686     {
1687         int channelUtilization = 10;
1688         std::vector<int> freqVector = {11, 51, -1, 69, 138, 92, 184, 366, 618, 0};
1689         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1690             WifiMaxThroughput(0, false, WifiChannelWidth::WIDTH_160MHZ, 0, 0, channelUtilization)) != 0);
1691         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1692             WifiMaxThroughput(1, false, WifiChannelWidth::WIDTH_160MHZ, MAX_THROUGH, 1, channelUtilization)) != 0);
1693         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1694             WifiMaxThroughput(FOUR, false, WifiChannelWidth::WIDTH_20MHZ, 0, 0, channelUtilization)) != 0);
1695         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1696             WifiMaxThroughput(FOUR, false, WifiChannelWidth::WIDTH_40MHZ, 0, 0, channelUtilization)) != 0);
1697         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1698             WifiMaxThroughput(STANDER, false, WifiChannelWidth::WIDTH_20MHZ, 0, 0, channelUtilization)) != 0);
1699         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1700             WifiMaxThroughput(STANDER, false, WifiChannelWidth::WIDTH_40MHZ, 0, 0, channelUtilization)) != 0);
1701         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1702             WifiMaxThroughput(STANDER, false, WifiChannelWidth::WIDTH_80MHZ, 0, 0, channelUtilization)) != 0);
1703             WifiMaxThroughput(STANDER, false, WifiChannelWidth::WIDTH_INVALID, 0, 0, channelUtilization);
1704         EXPECT_TRUE(count(freqVector.begin(), freqVector.end(),
1705             WifiMaxThroughput(FAILEDNUM, true, WifiChannelWidth::WIDTH_20MHZ, 0, 0, channelUtilization))!= 0);
1706             WifiMaxThroughput(FAILEDNUM, true, WifiChannelWidth::WIDTH_40MHZ, 0, 0, channelUtilization);
1707             WifiMaxThroughput(FAILEDNUM, true, WifiChannelWidth::WIDTH_80MHZ, 0, 0, channelUtilization);
1708             WifiMaxThroughput(FAILEDNUM, true, WifiChannelWidth::WIDTH_INVALID, 0, 0, channelUtilization);
1709     }
1710 
IsPackageInTrustListTest()1711     void IsPackageInTrustListTest()
1712     {
1713         EXPECT_TRUE(pScanService->IsPackageInTrustList("123456|", 0, "123456") == true);
1714         EXPECT_TRUE(pScanService->IsPackageInTrustList("123456|", 0, "1234") == false);
1715     }
1716 
IsAppInFilterListTest()1717     void IsAppInFilterListTest()
1718     {
1719         std::vector<std::string> packageFilter;
1720         packageFilter.push_back("com.test.test");
1721         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return("com.test.test"));
1722         EXPECT_TRUE(pScanService->IsAppInFilterList(packageFilter) == false);
1723         EXPECT_CALL(WifiConfigCenter::GetInstance(), GetAppPackageName()).WillRepeatedly(Return("com.test.test1"));
1724         EXPECT_TRUE(pScanService->IsAppInFilterList(packageFilter) == false);
1725     }
1726 
SetScanTrustModeTest()1727     void SetScanTrustModeTest()
1728     {
1729         pScanService->SetScanTrustMode();
1730         EXPECT_EQ(pScanService->scanTrustMode, true);
1731     }
1732 
ResetToNonTrustModeTest()1733     void ResetToNonTrustModeTest()
1734     {
1735         pScanService->ResetToNonTrustMode();
1736         EXPECT_EQ(pScanService->scanTrustMode, false);
1737     }
1738 
AllowScanByMovingFreezeTest1()1739     void AllowScanByMovingFreezeTest1()
1740     {
1741         pScanService->scanTrustMode = true;
1742         pScanService->scanTrustSceneIds.insert(-1);
1743         EXPECT_TRUE(pScanService->AllowScanByMovingFreeze(ScanMode::SYSTEM_TIMER_SCAN) == true);
1744     }
1745 
AllowScanByMovingFreezeTest2()1746     void AllowScanByMovingFreezeTest2()
1747     {
1748         pScanService->lastFreezeState = true;
1749         pScanService->isAbsFreezeScaned = false;
1750         EXPECT_FALSE(pScanService->AllowScanByMovingFreeze(ScanMode::SYSTEM_TIMER_SCAN) == false);
1751         pScanService->isAbsFreezeScaned = true;
1752         EXPECT_FALSE(pScanService->AllowScanByMovingFreeze(ScanMode::SYSTEM_TIMER_SCAN) == false);
1753     }
1754 
AllowScanByHid2dStateTest()1755     void AllowScanByHid2dStateTest()
1756     {
1757         EXPECT_CALL(WifiConfigCenter::GetInstance(), SetP2pBusinessType(P2pBusinessType::P2P_TYPE_HID2D));
1758         EXPECT_TRUE(pScanService->AllowScanByHid2dState() == true);
1759         EXPECT_CALL(WifiConfigCenter::GetInstance(), SetP2pBusinessType(P2pBusinessType::P2P_TYPE_CLASSIC));
1760         EXPECT_TRUE(pScanService->AllowScanByHid2dState() == true);
1761     }
1762 
AllowCustomSceneCheckTest1()1763     void AllowCustomSceneCheckTest1()
1764     {
1765         std::map<int, time_t> customIter;
1766         ScanForbidMode scanForbidMode;
1767         scanForbidMode.scanScene = SCAN_SCENE_SCANNING;
1768         scanForbidMode.scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1769         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1770         time_t now = time(nullptr);
1771         customIter.emplace(SCAN_SCENE_SCANNING, now);
1772         auto customIters = customIter.begin();
1773         EXPECT_TRUE(pScanService->AllowCustomSceneCheck(customIters, ScanMode::SYSTEM_TIMER_SCAN) == true);
1774     }
1775 
AllowCustomSceneCheckTest2()1776     void AllowCustomSceneCheckTest2()
1777     {
1778         std::map<int, time_t> customIter;
1779         ScanForbidMode scanForbidMode;
1780         scanForbidMode.scanScene = SCAN_SCENE_SCANNING;
1781         scanForbidMode.scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1782         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1783         time_t now = time(nullptr);
1784         customIter.emplace(SCAN_SCENE_SCANNING, now);
1785         auto customIters = customIter.begin();
1786         EXPECT_TRUE(pScanService->AllowCustomSceneCheck(customIters, ScanMode::SYSTEM_TIMER_SCAN) == true);
1787     }
1788 
AllowCustomSceneCheckTest3()1789     void AllowCustomSceneCheckTest3()
1790     {
1791         std::map<int, time_t> customIter;
1792         ScanForbidMode scanForbidMode;
1793         scanForbidMode.scanScene = SCAN_SCENE_SCANNING;
1794         scanForbidMode.scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1795         scanForbidMode.forbidCount = -1;
1796         scanForbidMode.forbidTime = 0;
1797         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1798         time_t now = time(nullptr);
1799         customIter.emplace(SCAN_SCENE_SCANNING, now);
1800         auto customIters = customIter.begin();
1801         EXPECT_TRUE(pScanService->AllowCustomSceneCheck(customIters, ScanMode::SYS_FOREGROUND_SCAN) == true);
1802     }
1803 
AllowCustomSceneCheckTest4()1804     void AllowCustomSceneCheckTest4()
1805     {
1806         std::map<int, time_t> customIter;
1807         ScanForbidMode scanForbidMode;
1808         scanForbidMode.scanScene = SCAN_SCENE_SCANNING;
1809         scanForbidMode.scanMode = ScanMode::SYS_FOREGROUND_SCAN;
1810         scanForbidMode.forbidCount = 1;
1811         scanForbidMode.forbidTime = STATUS;
1812         pScanService->scanControlInfo.scanForbidList.push_back(scanForbidMode);
1813         time_t now = time(nullptr);
1814         customIter.emplace(SCAN_SCENE_SCANNING, now);
1815         pScanService->customSceneForbidCount = STATUS;
1816         auto customIters = customIter.begin();
1817         EXPECT_TRUE(pScanService->AllowCustomSceneCheck(customIters, ScanMode::SYS_FOREGROUND_SCAN) == false);
1818     }
1819 
GetScanControlInfoTest()1820     void GetScanControlInfoTest()
1821     {
1822         pScanService->GetScanControlInfo();
1823     }
1824 
ClearScanTrustSceneIdsTest()1825     void ClearScanTrustSceneIdsTest()
1826     {
1827         pScanService->ClearScanTrustSceneIds();
1828     }
1829 
ApplyTrustListPolicyTest()1830     void ApplyTrustListPolicyTest()
1831     {
1832         ScanType scanType = ScanType::SCAN_TYPE_EXTERN;
1833         pScanService->ApplyTrustListPolicy(scanType);
1834     }
1835 
SetNetworkInterfaceUpDownTest()1836     void SetNetworkInterfaceUpDownTest()
1837     {
1838         pScanService->SetNetworkInterfaceUpDown(false);
1839     }
1840 
SystemScanConnectedPolicyTest()1841     void SystemScanConnectedPolicyTest()
1842     {
1843         int interval = 0;
1844         pScanService->SystemScanConnectedPolicy(interval);
1845     }
1846 
SystemScanDisconnectedPolicyTest()1847     void SystemScanDisconnectedPolicyTest()
1848     {
1849         int interval = 0;
1850         int count = 0;
1851         pScanService->SystemScanDisconnectedPolicy(interval, count);
1852     }
1853 
OnWifiCountryCodeChangedTest()1854     void OnWifiCountryCodeChangedTest()
1855     {
1856         std::string countryCode = "CN";
1857         if (pScanService->InitScanService(WifiManager::GetInstance().GetScanCallback()) == true) {
1858             EXPECT_EQ(ErrCode::WIFI_OPT_SUCCESS, pScanService->m_scanObserver->OnWifiCountryCodeChanged(countryCode));
1859         }
1860     }
1861 };
1862 
1863 HWTEST_F(ScanServiceTest, InitScanServiceSuccess1, TestSize.Level1)
1864 {
1865     InitScanServiceSuccess1();
1866 }
1867 
1868 HWTEST_F(ScanServiceTest, InitScanServiceSuccess2, TestSize.Level1)
1869 {
1870     InitScanServiceSuccess2();
1871 }
1872 
1873 HWTEST_F(ScanServiceTest, UnInitScanServiceSuccess, TestSize.Level1)
1874 {
1875     UnInitScanServiceSuccess();
1876 }
1877 
1878 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess1, TestSize.Level1)
1879 {
1880     HandleScanStatusReportSuccess1();
1881 }
1882 
1883 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess2, TestSize.Level1)
1884 {
1885     HandleScanStatusReportSuccess2();
1886 }
1887 
1888 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess3, TestSize.Level1)
1889 {
1890     HandleScanStatusReportSuccess3();
1891 }
1892 
1893 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess4, TestSize.Level1)
1894 {
1895     HandleScanStatusReportSuccess4();
1896 }
1897 
1898 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess5, TestSize.Level1)
1899 {
1900     HandleScanStatusReportSuccess5();
1901 }
1902 
1903 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess6, TestSize.Level1)
1904 {
1905     HandleScanStatusReportSuccess6();
1906 }
1907 
1908 HWTEST_F(ScanServiceTest, HandleScanStatusReportSuccess7, TestSize.Level1)
1909 {
1910     HandleScanStatusReportSuccess7();
1911 }
1912 
1913 HWTEST_F(ScanServiceTest, HandleScanStatusReportFail, TestSize.Level1)
1914 {
1915     HandleScanStatusReportFail();
1916 }
1917 
1918 HWTEST_F(ScanServiceTest, HandleInnerEventReportSuccess1, TestSize.Level1)
1919 {
1920     HandleInnerEventReportSuccess1();
1921 }
1922 
1923 HWTEST_F(ScanServiceTest, HandleInnerEventReportSuccess2, TestSize.Level1)
1924 {
1925     HandleInnerEventReportSuccess2();
1926 }
1927 
1928 HWTEST_F(ScanServiceTest, HandleInnerEventReportSuccess3, TestSize.Level1)
1929 {
1930     HandleInnerEventReportSuccess3();
1931 }
1932 
1933 HWTEST_F(ScanServiceTest, HandleInnerEventReportFail, TestSize.Level1)
1934 {
1935     HandleInnerEventReportFail();
1936 }
1937 
1938 HWTEST_F(ScanServiceTest, ScanSuccess, TestSize.Level1)
1939 {
1940     ScanSuccess();
1941 }
1942 
1943 HWTEST_F(ScanServiceTest, ScanFail, TestSize.Level1)
1944 {
1945     ScanFail();
1946 }
1947 
1948 HWTEST_F(ScanServiceTest, ScanWithParamSuccess, TestSize.Level1)
1949 {
1950     ScanWithParamSuccess();
1951 }
1952 
1953 HWTEST_F(ScanServiceTest, ScanWithParamFail1, TestSize.Level1)
1954 {
1955     ScanWithParamFail1();
1956 }
1957 
1958 HWTEST_F(ScanServiceTest, ScanWithParamFail2, TestSize.Level1)
1959 {
1960     ScanWithParamFail2();
1961 }
1962 
1963 HWTEST_F(ScanServiceTest, ScanWithParamFail3, TestSize.Level1)
1964 {
1965     ScanWithParamFail3();
1966 }
1967 
1968 HWTEST_F(ScanServiceTest, ScanWithParamFail4, TestSize.Level1)
1969 {
1970     ScanWithParamFail4();
1971 }
1972 
1973 HWTEST_F(ScanServiceTest, SingleScanSuccess1, TestSize.Level1)
1974 {
1975     SingleScanSuccess1();
1976 }
1977 
1978 HWTEST_F(ScanServiceTest, SingleScanSuccess2, TestSize.Level1)
1979 {
1980     SingleScanSuccess2();
1981 }
1982 
1983 HWTEST_F(ScanServiceTest, SingleScanFail1, TestSize.Level1)
1984 {
1985     SingleScanFail1();
1986 }
1987 
1988 HWTEST_F(ScanServiceTest, GetBandFreqsSuccess1, TestSize.Level1)
1989 {
1990     GetBandFreqsSuccess1();
1991 }
1992 
1993 HWTEST_F(ScanServiceTest, GetBandFreqsSuccess2, TestSize.Level1)
1994 {
1995     GetBandFreqsSuccess2();
1996 }
1997 
1998 HWTEST_F(ScanServiceTest, GetBandFreqsSuccess3, TestSize.Level1)
1999 {
2000     GetBandFreqsSuccess3();
2001 }
2002 
2003 HWTEST_F(ScanServiceTest, GetBandFreqsSuccess4, TestSize.Level1)
2004 {
2005     GetBandFreqsSuccess4();
2006 }
2007 
2008 HWTEST_F(ScanServiceTest, GetBandFreqsSuccess5, TestSize.Level1)
2009 {
2010     GetBandFreqsSuccess5();
2011 }
2012 
2013 HWTEST_F(ScanServiceTest, GetBandFreqsSuccess6, TestSize.Level1)
2014 {
2015     GetBandFreqsSuccess6();
2016 }
2017 
2018 HWTEST_F(ScanServiceTest, GetBandFreqsFail, TestSize.Level1)
2019 {
2020     GetBandFreqsFail();
2021 }
2022 
2023 HWTEST_F(ScanServiceTest, AddScanMessageBodySuccess, TestSize.Level1)
2024 {
2025     AddScanMessageBodySuccess();
2026 }
2027 
2028 HWTEST_F(ScanServiceTest, AddScanMessageBodyFail, TestSize.Level1)
2029 {
2030     AddScanMessageBodyFail();
2031 }
2032 
2033 HWTEST_F(ScanServiceTest, StoreRequestScanConfigSuccess, TestSize.Level1)
2034 {
2035     StoreRequestScanConfigSuccess();
2036 }
2037 /**
2038  * @tc.name: StoreRequestScanConfigFail
2039  * @tc.desc: StoreRequestScanConfig()
2040  * @tc.type: FUNC
2041  * @tc.require: issue
2042 */
2043 HWTEST_F(ScanServiceTest, StoreRequestScanConfigFail, TestSize.Level1)
2044 {
2045     StoreRequestScanConfigFail();
2046 }
2047 
2048 HWTEST_F(ScanServiceTest, HandleCommonScanFailedSuccess1, TestSize.Level1)
2049 {
2050     HandleCommonScanFailedSuccess1();
2051 }
2052 
2053 HWTEST_F(ScanServiceTest, HandleCommonScanFailedSuccess2, TestSize.Level1)
2054 {
2055     HandleCommonScanFailedSuccess2();
2056 }
2057 
2058 HWTEST_F(ScanServiceTest, HandleCommonScanFailedSuccess3, TestSize.Level1)
2059 {
2060     HandleCommonScanFailedSuccess3();
2061 }
2062 
2063 HWTEST_F(ScanServiceTest, HandleCommonScanFailedSuccess4, TestSize.Level1)
2064 {
2065     HandleCommonScanFailedSuccess4();
2066 }
2067 
2068 HWTEST_F(ScanServiceTest, HandleCommonScanInfoSuccess1, TestSize.Level1)
2069 {
2070     HandleCommonScanInfoSuccess1();
2071 }
2072 
2073 HWTEST_F(ScanServiceTest, HandleCommonScanInfoSuccess2, TestSize.Level1)
2074 {
2075     HandleCommonScanInfoSuccess2();
2076 }
2077 
2078 HWTEST_F(ScanServiceTest, HandleCommonScanInfoSuccess3, TestSize.Level1)
2079 {
2080     HandleCommonScanInfoSuccess3();
2081 }
2082 
2083 HWTEST_F(ScanServiceTest, StoreFullScanInfoSuccess, TestSize.Level1)
2084 {
2085     StoreFullScanInfoSuccess();
2086 }
2087 
2088 HWTEST_F(ScanServiceTest, StoreFullScanInfoFail, TestSize.Level1)
2089 {
2090     StoreFullScanInfoFail();
2091 }
2092 
2093 HWTEST_F(ScanServiceTest, StoreUserScanInfoSuccess1, TestSize.Level1)
2094 {
2095     StoreUserScanInfoSuccess1();
2096 }
2097 
2098 HWTEST_F(ScanServiceTest, StoreUserScanInfoSuccess2, TestSize.Level1)
2099 {
2100     StoreUserScanInfoSuccess2();
2101 }
2102 
2103 HWTEST_F(ScanServiceTest, ReportScanInfosSuccess, TestSize.Level1)
2104 {
2105     ReportScanInfosSuccess();
2106 }
2107 
2108 HWTEST_F(ScanServiceTest, BeginPnoScanSuccess1, TestSize.Level1)
2109 {
2110     BeginPnoScanSuccess1();
2111 }
2112 
2113 HWTEST_F(ScanServiceTest, BeginPnoScanFail1, TestSize.Level1)
2114 {
2115     BeginPnoScanFail1();
2116 }
2117 
2118 HWTEST_F(ScanServiceTest, BeginPnoScanFail2, TestSize.Level1)
2119 {
2120     BeginPnoScanFail2();
2121 }
2122 
2123 HWTEST_F(ScanServiceTest, BeginPnoScanFail3, TestSize.Level1)
2124 {
2125     BeginPnoScanFail3();
2126 }
2127 
2128 HWTEST_F(ScanServiceTest, PnoScanSuccess, TestSize.Level1)
2129 {
2130     PnoScanSuccess();
2131 }
2132 
2133 HWTEST_F(ScanServiceTest, AddPnoScanMessageBodySuccess, TestSize.Level1)
2134 {
2135     AddPnoScanMessageBodySuccess();
2136 }
2137 
2138 HWTEST_F(ScanServiceTest, AddPnoScanMessageBodyFail, TestSize.Level1)
2139 {
2140     AddPnoScanMessageBodyFail();
2141 }
2142 
2143 HWTEST_F(ScanServiceTest, HandlePnoScanInfoSuccess, TestSize.Level1)
2144 {
2145     HandlePnoScanInfoSuccess();
2146 }
2147 
2148 HWTEST_F(ScanServiceTest, EndPnoScanSuccess, TestSize.Level1)
2149 {
2150     EndPnoScanSuccess();
2151 }
2152 
2153 HWTEST_F(ScanServiceTest, EndPnoScanFail, TestSize.Level1)
2154 {
2155     EndPnoScanFail();
2156 }
2157 
2158 HWTEST_F(ScanServiceTest, EndPnoScanFail2, TestSize.Level1)
2159 {
2160     EndPnoScanFail2();
2161 }
2162 
2163 HWTEST_F(ScanServiceTest, HandleScreenStatusChangedSuccess, TestSize.Level1)
2164 {
2165     HandleScreenStatusChangedSuccess();
2166 }
2167 
2168 HWTEST_F(ScanServiceTest, HandleStaStatusChangedSuccess1, TestSize.Level1)
2169 {
2170     HandleStaStatusChangedSuccess1();
2171 }
2172 
2173 HWTEST_F(ScanServiceTest, HandleStaStatusChangedSuccess2, TestSize.Level1)
2174 {
2175     HandleStaStatusChangedSuccess2();
2176 }
2177 
2178 HWTEST_F(ScanServiceTest, HandleStaStatusChangedFail, TestSize.Level1)
2179 {
2180     HandleStaStatusChangedFail();
2181 }
2182 
2183 HWTEST_F(ScanServiceTest, HandleCustomStatusChangedSuccess1, TestSize.Level1)
2184 {
2185     HandleCustomStatusChangedSuccess1();
2186 }
2187 
2188 HWTEST_F(ScanServiceTest, HandleCustomStatusChangedSuccess2, TestSize.Level1)
2189 {
2190     HandleCustomStatusChangedSuccess2();
2191 }
2192 
2193 HWTEST_F(ScanServiceTest, SystemScanProcessSuccess1, TestSize.Level1)
2194 {
2195     SystemScanProcessSuccess1();
2196 }
2197 
2198 HWTEST_F(ScanServiceTest, SystemScanProcessSuccess2, TestSize.Level1)
2199 {
2200     SystemScanProcessSuccess2();
2201 }
2202 /**
2203  * @tc.name: SystemScanProcessSuccess3
2204  * @tc.desc: SystemScanProcessSuccess()
2205  * @tc.type: FUNC
2206  * @tc.require: issue
2207 */
2208 HWTEST_F(ScanServiceTest, SystemScanProcessSuccess3, TestSize.Level1)
2209 {
2210     SystemScanProcessSuccess3();
2211 }
2212 
2213 HWTEST_F(ScanServiceTest, StopSystemScanSuccess, TestSize.Level1)
2214 {
2215     StopSystemScanSuccess();
2216 }
2217 
2218 HWTEST_F(ScanServiceTest, StartSystemTimerScanFail1, TestSize.Level1)
2219 {
2220     StartSystemTimerScanFail1();
2221 }
2222 /**
2223  * @tc.name: StartSystemTimerScanFail2
2224  * @tc.desc: StartSystemTimerScan()
2225  * @tc.type: FUNC
2226  * @tc.require: issue
2227 */
2228 HWTEST_F(ScanServiceTest, StartSystemTimerScanFail2, TestSize.Level1)
2229 {
2230     StartSystemTimerScanFail2();
2231 }
2232 /**
2233  * @tc.name: StartSystemTimerScanFail3
2234  * @tc.desc: StartSystemTimerScan()
2235  * @tc.type: FUNC
2236  * @tc.require: issue
2237 */
2238 HWTEST_F(ScanServiceTest, StartSystemTimerScanFail3, TestSize.Level1)
2239 {
2240     StartSystemTimerScanFail3();
2241 }
2242 /**
2243  * @tc.name: StartSystemTimerScanFail4
2244  * @tc.desc: StartSystemTimerScan()
2245  * @tc.type: FUNC
2246  * @tc.require: issue
2247 */
2248 HWTEST_F(ScanServiceTest, StartSystemTimerScanFail4, TestSize.Level1)
2249 {
2250     StartSystemTimerScanFail4();
2251 }
2252 
2253 HWTEST_F(ScanServiceTest, HandleSystemScanTimeoutSuccess, TestSize.Level1)
2254 {
2255     HandleSystemScanTimeoutSuccess();
2256 }
2257 
2258 HWTEST_F(ScanServiceTest, DisconnectedTimerScanSuccess, TestSize.Level1)
2259 {
2260     DisconnectedTimerScanSuccess();
2261 }
2262 
2263 HWTEST_F(ScanServiceTest, HandleDisconnectedScanTimeoutSuccess, TestSize.Level1)
2264 {
2265     HandleDisconnectedScanTimeoutSuccess();
2266 }
2267 /**
2268  * @tc.name: HandleDisconnectedScanTimeoutFail1
2269  * @tc.desc: HandleDisconnectedScanTimeout()
2270  * @tc.type: FUNC
2271  * @tc.require: issue
2272 */
2273 HWTEST_F(ScanServiceTest, HandleDisconnectedScanTimeoutFail1, TestSize.Level1)
2274 {
2275     HandleDisconnectedScanTimeoutFail1();
2276 }
2277 /**
2278  * @tc.name: HandleDisconnectedScanTimeoutFail2
2279  * @tc.desc: HandleDisconnectedScanTimeout()
2280  * @tc.type: FUNC
2281  * @tc.require: issue
2282 */
2283 HWTEST_F(ScanServiceTest, HandleDisconnectedScanTimeoutFail2, TestSize.Level1)
2284 {
2285     HandleDisconnectedScanTimeoutFail2();
2286 }
2287 
2288 HWTEST_F(ScanServiceTest, RestartPnoScanTimeOutSuccess, TestSize.Level1)
2289 {
2290     RestartPnoScanTimeOutSuccess();
2291 }
2292 
2293 HWTEST_F(ScanServiceTest, RestartPnoScanTimeOutFail, TestSize.Level1)
2294 {
2295     RestartPnoScanTimeOutFail();
2296 }
2297 
2298 HWTEST_F(ScanServiceTest, GetScanControlInfoSuccess, TestSize.Level1)
2299 {
2300     GetScanControlInfoSuccess();
2301 }
2302 
2303 HWTEST_F(ScanServiceTest, GetScanControlInfoFail, TestSize.Level1)
2304 {
2305     GetScanControlInfoFail();
2306 }
2307 
2308 HWTEST_F(ScanServiceTest, AllowExternScanSuccess, TestSize.Level1)
2309 {
2310     AllowExternScanSuccess();
2311 }
2312 
2313 HWTEST_F(ScanServiceTest, AllowExternScanFail1, TestSize.Level1)
2314 {
2315     AllowExternScanFail1();
2316 }
2317 
2318 HWTEST_F(ScanServiceTest, AllowExternScanFail2, TestSize.Level1)
2319 {
2320     AllowExternScanFail2();
2321 }
2322 
2323 HWTEST_F(ScanServiceTest, AllowExternScanFail3, TestSize.Level1)
2324 {
2325     AllowExternScanFail3();
2326 }
2327 
2328 HWTEST_F(ScanServiceTest, AllowExternScanFail4, TestSize.Level1)
2329 {
2330     AllowExternScanFail4();
2331 }
2332 
2333 HWTEST_F(ScanServiceTest, AllowSystemTimerScanSuccess, TestSize.Level1)
2334 {
2335     AllowSystemTimerScanSuccess();
2336 }
2337 
2338 HWTEST_F(ScanServiceTest, AllowSystemTimerScanFail1, TestSize.Level1)
2339 {
2340     AllowSystemTimerScanFail1();
2341 }
2342 
2343 HWTEST_F(ScanServiceTest, AllowSystemTimerScanFail3, TestSize.Level1)
2344 {
2345     AllowSystemTimerScanFail3();
2346 }
2347 
2348 HWTEST_F(ScanServiceTest, AllowSystemTimerScanFail5, TestSize.Level1)
2349 {
2350     AllowSystemTimerScanFail5();
2351 }
2352 
2353 HWTEST_F(ScanServiceTest, AllowPnoScanSuccess, TestSize.Level1)
2354 {
2355     AllowPnoScanSuccess();
2356 }
2357 
2358 HWTEST_F(ScanServiceTest, GetStaSceneSuccess1, TestSize.Level1)
2359 {
2360     GetStaSceneSuccess1();
2361 }
2362 
2363 HWTEST_F(ScanServiceTest, GetStaSceneSuccess2, TestSize.Level1)
2364 {
2365     GetStaSceneSuccess2();
2366 }
2367 
2368 HWTEST_F(ScanServiceTest, GetStaSceneSuccess3, TestSize.Level1)
2369 {
2370     GetStaSceneSuccess3();
2371 }
2372 
2373 HWTEST_F(ScanServiceTest, GetStaSceneSuccess4, TestSize.Level1)
2374 {
2375     GetStaSceneSuccess4();
2376 }
2377 
2378 HWTEST_F(ScanServiceTest, GetStaSceneSuccess5, TestSize.Level1)
2379 {
2380     GetStaSceneSuccess5();
2381 }
2382 
2383 HWTEST_F(ScanServiceTest, GetStaSceneSuccess6, TestSize.Level1)
2384 {
2385     GetStaSceneSuccess6();
2386 }
2387 
2388 HWTEST_F(ScanServiceTest, GetStaSceneFail, TestSize.Level1)
2389 {
2390     GetStaSceneFail();
2391 }
2392 
2393 HWTEST_F(ScanServiceTest, IsExternScanningSuccess, TestSize.Level1)
2394 {
2395     IsExternScanningSuccess();
2396 }
2397 
2398 HWTEST_F(ScanServiceTest, IsExternScanningFail, TestSize.Level1)
2399 {
2400     IsExternScanningFail();
2401 }
2402 
2403 HWTEST_F(ScanServiceTest, GetAllowBandFreqsControlInfoSuccess, TestSize.Level1)
2404 {
2405     GetAllowBandFreqsControlInfoSuccess();
2406 }
2407 
2408 HWTEST_F(ScanServiceTest, ConvertBandNotAllow24GSuccess1, TestSize.Level1)
2409 {
2410     ConvertBandNotAllow24GSuccess1();
2411 }
2412 
2413 HWTEST_F(ScanServiceTest, ConvertBandNotAllow24GSuccess2, TestSize.Level1)
2414 {
2415     ConvertBandNotAllow24GSuccess2();
2416 }
2417 
2418 HWTEST_F(ScanServiceTest, ConvertBandNotAllow24GSuccess3, TestSize.Level1)
2419 {
2420     ConvertBandNotAllow24GSuccess3();
2421 }
2422 
2423 HWTEST_F(ScanServiceTest, ConvertBandNotAllow24GSuccess4, TestSize.Level1)
2424 {
2425     ConvertBandNotAllow24GSuccess4();
2426 }
2427 
2428 HWTEST_F(ScanServiceTest, ConvertBandNotAllow24GFail, TestSize.Level1)
2429 {
2430     ConvertBandNotAllow24GFail();
2431 }
2432 
2433 HWTEST_F(ScanServiceTest, ConvertBandNotAllow5GSuccess, TestSize.Level1)
2434 {
2435     ConvertBandNotAllow5GSuccess();
2436 }
2437 
2438 HWTEST_F(ScanServiceTest, ConvertBandNotAllow5GFail, TestSize.Level1)
2439 {
2440     ConvertBandNotAllow5GFail();
2441 }
2442 
2443 HWTEST_F(ScanServiceTest, Delete24GhzFreqsSuccess, TestSize.Level1)
2444 {
2445     Delete24GhzFreqsSuccess();
2446 }
2447 
2448 HWTEST_F(ScanServiceTest, Delete5GhzFreqsSuccess, TestSize.Level1)
2449 {
2450     Delete5GhzFreqsSuccess();
2451 }
2452 
2453 HWTEST_F(ScanServiceTest, GetSavedNetworkSsidListSuccess, TestSize.Level1)
2454 {
2455     GetSavedNetworkSsidListSuccess();
2456 }
2457 
2458 HWTEST_F(ScanServiceTest, GetSavedNetworkSsidListFail, TestSize.Level1)
2459 {
2460     GetSavedNetworkSsidListFail();
2461 }
2462 
2463 HWTEST_F(ScanServiceTest, GetHiddenNetworkSsidListSuccess, TestSize.Level1)
2464 {
2465     GetHiddenNetworkSsidListSuccess1();
2466 }
2467 
2468 HWTEST_F(ScanServiceTest, GetHiddenNetworkSsidListSuccess2, TestSize.Level1)
2469 {
2470     GetHiddenNetworkSsidListSuccess2();
2471 }
2472 
2473 HWTEST_F(ScanServiceTest, GetHiddenNetworkSsidListFail, TestSize.Level1)
2474 {
2475     GetHiddenNetworkSsidListFail();
2476 }
2477 
2478 HWTEST_F(ScanServiceTest, SetStaCurrentTimeSuccess, TestSize.Level1)
2479 {
2480     SetStaCurrentTimeSuccess();
2481 }
2482 
2483 HWTEST_F(ScanServiceTest, AllowScanDuringScanningSuccess, TestSize.Level1)
2484 {
2485     AllowScanDuringScanningSuccess();
2486 }
2487 
2488 HWTEST_F(ScanServiceTest, AllowScanDuringScanningFail, TestSize.Level1)
2489 {
2490     AllowScanDuringScanningFail();
2491 }
2492 
2493 HWTEST_F(ScanServiceTest, AllowScanDuringStaSceneSuccess, TestSize.Level1)
2494 {
2495     AllowScanDuringStaSceneSuccess1();
2496 }
2497 
2498 HWTEST_F(ScanServiceTest, AllowScanDuringStaSceneFail1, TestSize.Level1)
2499 {
2500     AllowScanDuringStaSceneFail1();
2501 }
2502 
2503 HWTEST_F(ScanServiceTest, AllowScanDuringStaSceneFail2, TestSize.Level1)
2504 {
2505     AllowScanDuringStaSceneFail2();
2506 }
2507 
2508 HWTEST_F(ScanServiceTest, AllowScanDuringStaSceneFail3, TestSize.Level1)
2509 {
2510     AllowScanDuringStaSceneFail3();
2511 }
2512 
2513 HWTEST_F(ScanServiceTest, AllowScanDuringCustomSceneSuccess, TestSize.Level1)
2514 {
2515     AllowScanDuringCustomSceneSuccess();
2516 }
2517 
2518 HWTEST_F(ScanServiceTest, AllowScanDuringCustomSceneFail1, TestSize.Level1)
2519 {
2520     AllowScanDuringCustomSceneFail1();
2521 }
2522 
2523 HWTEST_F(ScanServiceTest, AllowScanDuringCustomSceneFail2, TestSize.Level1)
2524 {
2525     AllowScanDuringCustomSceneFail2();
2526 }
2527 
2528 HWTEST_F(ScanServiceTest, AllowScanDuringCustomSceneFail3, TestSize.Level1)
2529 {
2530     AllowScanDuringCustomSceneFail3();
2531 }
2532 /**
2533  * @tc.name: AllowExternScanByIntervalMode_001
2534  * @tc.desc: AllowExternScanByIntervalMode()
2535  * @tc.type: FUNC
2536  * @tc.require: issue
2537 */
2538 HWTEST_F(ScanServiceTest, AllowExternScanByIntervalMode_001, TestSize.Level1)
2539 {
2540     AllowExternScanByIntervalModeFail1();
2541 }
2542 /**
2543  * @tc.name: AllowExternScanByIntervalMode_002
2544  * @tc.desc: AllowExternScanByIntervalMode()
2545  * @tc.type: FUNC
2546  * @tc.require: issue
2547 */
2548 HWTEST_F(ScanServiceTest, AllowExternScanByIntervalMode_002, TestSize.Level1)
2549 {
2550     AllowExternScanByIntervalModeFail2();
2551 }
2552 /**
2553  * @tc.name: AllowExternScanByIntervalMode_003
2554  * @tc.desc: AllowExternScanByIntervalMode()
2555  * @tc.type: FUNC
2556  * @tc.require: issue
2557 */
2558 HWTEST_F(ScanServiceTest, AllowExternScanByIntervalMode_003, TestSize.Level1)
2559 {
2560     AllowExternScanByIntervalModeFail3();
2561 }
2562 /**
2563  * @tc.name: AllowExternScanByIntervalMode_004
2564  * @tc.desc: AllowExternScanByIntervalMode()
2565  * @tc.type: FUNC
2566  * @tc.require: issue
2567 */
2568 HWTEST_F(ScanServiceTest, AllowExternScanByIntervalMode_004, TestSize.Level1)
2569 {
2570     AllowExternScanByIntervalModeSuccess();
2571 }
2572 /**
2573  * @tc.name: AllowExternScanByIntervalMode_005
2574  * @tc.desc: AllowExternScanByIntervalMode()
2575  * @tc.type: FUNC
2576  * @tc.require: issue
2577 */
2578 HWTEST_F(ScanServiceTest, AllowExternScanByIntervalMode_005, TestSize.Level1)
2579 {
2580     AllowExternScanByIntervalModeSuccess1();
2581 }
2582 
2583 HWTEST_F(ScanServiceTest, PnoScanByIntervalSuccess1, TestSize.Level1)
2584 {
2585     PnoScanByIntervalSuccess1();
2586 }
2587 
2588 HWTEST_F(ScanServiceTest, PnoScanByIntervalSuccess2, TestSize.Level1)
2589 {
2590     PnoScanByIntervalSuccess2();
2591 }
2592 
2593 HWTEST_F(ScanServiceTest, PnoScanByIntervalSuccess3, TestSize.Level1)
2594 {
2595     PnoScanByIntervalSuccess3();
2596 }
2597 
2598 HWTEST_F(ScanServiceTest, PnoScanByIntervalFail1, TestSize.Level1)
2599 {
2600     PnoScanByIntervalFail1();
2601 }
2602 
2603 HWTEST_F(ScanServiceTest, SystemScanByIntervalSuccess, TestSize.Level1)
2604 {
2605     SystemScanByIntervalSuccess();
2606 }
2607 
2608 HWTEST_F(ScanServiceTest, ExternScanByIntervalSuccess1, TestSize.Level1)
2609 {
2610     ExternScanByIntervalSuccess1();
2611 }
2612 
2613 HWTEST_F(ScanServiceTest, ExternScanByIntervalSuccess2, TestSize.Level1)
2614 {
2615     ExternScanByIntervalSuccess2();
2616 }
2617 
2618 HWTEST_F(ScanServiceTest, ExternScanByIntervalSuccess3, TestSize.Level1)
2619 {
2620     ExternScanByIntervalSuccess3();
2621 }
2622 
2623 HWTEST_F(ScanServiceTest, ExternScanByIntervalSuccess4, TestSize.Level1)
2624 {
2625     ExternScanByIntervalSuccess4();
2626 }
2627 
2628 HWTEST_F(ScanServiceTest, ExternScanByIntervalSuccess5, TestSize.Level1)
2629 {
2630     ExternScanByIntervalSuccess5();
2631 }
2632 
2633 HWTEST_F(ScanServiceTest, AllowSingleAppScanByIntervalSuccess1, TestSize.Level1)
2634 {
2635     AllowSingleAppScanByIntervalSuccess1();
2636 }
2637 
2638 HWTEST_F(ScanServiceTest, AllowSingleAppScanByIntervalSuccess2, TestSize.Level1)
2639 {
2640     AllowSingleAppScanByIntervalSuccess2();
2641 }
2642 
2643 HWTEST_F(ScanServiceTest, AllowSingleAppScanByIntervalFail1, TestSize.Level1)
2644 {
2645     AllowSingleAppScanByIntervalFail1();
2646 }
2647 
2648 HWTEST_F(ScanServiceTest, AllowFullAppScanByIntervalSuccess1, TestSize.Level1)
2649 {
2650     AllowFullAppScanByIntervalSuccess1();
2651 }
2652 
2653 HWTEST_F(ScanServiceTest, AllowFullAppScanByIntervalSuccess2, TestSize.Level1)
2654 {
2655     AllowFullAppScanByIntervalSuccess2();
2656 }
2657 
2658 HWTEST_F(ScanServiceTest, AllowFullAppScanByIntervalFail1, TestSize.Level1)
2659 {
2660     AllowFullAppScanByIntervalFail1();
2661 }
2662 
2663 HWTEST_F(ScanServiceTest, AllowScanByIntervalFixedSuccess1, TestSize.Level1)
2664 {
2665     AllowScanByIntervalFixedSuccess1();
2666 }
2667 
2668 HWTEST_F(ScanServiceTest, AllowScanByIntervalFixedSuccess2, TestSize.Level1)
2669 {
2670     AllowScanByIntervalFixedSuccess2();
2671 }
2672 
2673 HWTEST_F(ScanServiceTest, AllowScanByIntervalFixedSuccess3, TestSize.Level1)
2674 {
2675     AllowScanByIntervalFixedSuccess3();
2676 }
2677 
2678 HWTEST_F(ScanServiceTest, AllowScanByHid2dStateTest, TestSize.Level1)
2679 {
2680     AllowScanByHid2dStateTest();
2681 }
2682 
2683 HWTEST_F(ScanServiceTest, AllowScanByIntervalFixedFail1, TestSize.Level1)
2684 {
2685     AllowScanByIntervalFixedFail1();
2686 }
2687 
2688 HWTEST_F(ScanServiceTest, AllowScanByIntervalExpSuccess, TestSize.Level1)
2689 {
2690     AllowScanByIntervalExpSuccess();
2691 }
2692 
2693 HWTEST_F(ScanServiceTest, AllowScanByIntervalContinueSuccess1, TestSize.Level1)
2694 {
2695     AllowScanByIntervalContinueSuccess1();
2696 }
2697 
2698 HWTEST_F(ScanServiceTest, AllowScanByIntervalContinueSuccess2, TestSize.Level1)
2699 {
2700     AllowScanByIntervalContinueSuccess2();
2701 }
2702 
2703 HWTEST_F(ScanServiceTest, AllowScanByIntervalContinueSuccess3, TestSize.Level1)
2704 {
2705     AllowScanByIntervalContinueSuccess3();
2706 }
2707 
2708 HWTEST_F(ScanServiceTest, AllowScanByIntervalContinueFail1, TestSize.Level1)
2709 {
2710     AllowScanByIntervalContinueFail1();
2711 }
2712 
2713 HWTEST_F(ScanServiceTest, AllowScanByIntervalBlocklistSuccess1, TestSize.Level1)
2714 {
2715     AllowScanByIntervalBlocklistSuccess1();
2716 }
2717 
2718 HWTEST_F(ScanServiceTest, AllowScanByIntervalBlocklistSuccess2, TestSize.Level1)
2719 {
2720     AllowScanByIntervalBlocklistSuccess2();
2721 }
2722 
2723 HWTEST_F(ScanServiceTest, AllowScanByIntervalBlocklistSuccess3, TestSize.Level1)
2724 {
2725     AllowScanByIntervalBlocklistSuccess3();
2726 }
2727 
2728 HWTEST_F(ScanServiceTest, AllowScanByIntervalBlocklistFail1, TestSize.Level1)
2729 {
2730     AllowScanByIntervalBlocklistFail1();
2731 }
2732 
2733 HWTEST_F(ScanServiceTest, AllowScanByIntervalBlocklistFail2, TestSize.Level1)
2734 {
2735     AllowScanByIntervalBlocklistFail2();
2736 }
2737 
2738 HWTEST_F(ScanServiceTest, SingleScanFail2, TestSize.Level1)
2739 {
2740     SingleScanFail2();
2741 }
2742 
2743 HWTEST_F(ScanServiceTest, PnoScanFail, TestSize.Level1)
2744 {
2745     PnoScanFail();
2746 }
2747 
2748 HWTEST_F(ScanServiceTest, HandleMovingFreezeChangedTest, TestSize.Level1)
2749 {
2750     HandleMovingFreezeChangedTest();
2751 }
2752 
2753 HWTEST_F(ScanServiceTest, HandleAutoConnectStateChangedTest, TestSize.Level1)
2754 {
2755     HandleAutoConnectStateChangedTest();
2756 }
2757 
2758 HWTEST_F(ScanServiceTest, HandleNetworkQualityChangedTest, TestSize.Level1)
2759 {
2760     HandleNetworkQualityChangedTest();
2761 }
2762 /**
2763  * @tc.name: WifiMaxThroughputTest
2764  * @tc.desc: WifiMaxThroughputTest
2765  * @tc.type: FUNC
2766  * @tc.require: issue
2767 */
2768 HWTEST_F(ScanServiceTest, WifiMaxThroughputTest, TestSize.Level1)
2769 {
2770     WifiMaxThroughputTest();
2771 }
2772 /**
2773  * @tc.name: IsPackageInTrustListTest
2774  * @tc.desc: IsPackageInTrustList()
2775  * @tc.type: FUNC
2776  * @tc.require: issue
2777 */
2778 HWTEST_F(ScanServiceTest, IsPackageInTrustListTest, TestSize.Level1)
2779 {
2780     IsPackageInTrustListTest();
2781 }
2782 /**
2783  * @tc.name: IsAppInFilterListTest
2784  * @tc.desc: IsAppInFilterList()
2785  * @tc.type: FUNC
2786  * @tc.require: issue
2787 */
2788 HWTEST_F(ScanServiceTest, IsAppInFilterListTest, TestSize.Level1)
2789 {
2790     IsAppInFilterListTest();
2791 }
2792 /**
2793  * @tc.name: AllowScanByMovingFreeze_001
2794  * @tc.desc: AllowScanByMovingFreeze()
2795  * @tc.type: FUNC
2796  * @tc.require: issue
2797 */
2798 HWTEST_F(ScanServiceTest, AllowScanByMovingFreeze_001, TestSize.Level1)
2799 {
2800     AllowScanByMovingFreezeTest1();
2801 }
2802 /**
2803  * @tc.name: AllowScanByMovingFreeze_002
2804  * @tc.desc: AllowScanByMovingFreeze()
2805  * @tc.type: FUNC
2806  * @tc.require: issue
2807 */
2808 HWTEST_F(ScanServiceTest, AllowScanByMovingFreeze_002, TestSize.Level1)
2809 {
2810     AllowScanByMovingFreezeTest2();
2811 }
2812 
2813 HWTEST_F(ScanServiceTest, SetScanTrustMode_001, TestSize.Level1)
2814 {
2815     SetScanTrustModeTest();
2816 }
2817 
2818 HWTEST_F(ScanServiceTest, ResetToNonTrustMode_001, TestSize.Level1)
2819 {
2820     ResetToNonTrustModeTest();
2821 }
2822 
2823 HWTEST_F(ScanServiceTest, IsScanningWithParam_001, TestSize.Level1)
2824 {
2825     IsScanningWithParamTest();
2826 }
2827 /**
2828  * @tc.name: AllowCustomSceneCheck_001
2829  * @tc.desc: AllowCustomSceneCheck()
2830  * @tc.type: FUNC
2831  * @tc.require: issue
2832 */
2833 HWTEST_F(ScanServiceTest, AllowCustomSceneCheck_001, TestSize.Level1)
2834 {
2835     AllowCustomSceneCheckTest1();
2836 }
2837 /**
2838  * @tc.name: AllowCustomSceneCheck_002
2839  * @tc.desc: AllowCustomSceneCheck()
2840  * @tc.type: FUNC
2841  * @tc.require: issue
2842 */
2843 HWTEST_F(ScanServiceTest, AllowCustomSceneCheck_002, TestSize.Level1)
2844 {
2845     AllowCustomSceneCheckTest2();
2846 }
2847 /**
2848  * @tc.name: AllowCustomSceneCheck_003
2849  * @tc.desc: AllowCustomSceneCheck()
2850  * @tc.type: FUNC
2851  * @tc.require: issue
2852 */
2853 HWTEST_F(ScanServiceTest, AllowCustomSceneCheck_003, TestSize.Level1)
2854 {
2855     AllowCustomSceneCheckTest3();
2856 }
2857 /**
2858  * @tc.name: AllowCustomSceneCheck_004
2859  * @tc.desc: AllowCustomSceneCheck()
2860  * @tc.type: FUNC
2861  * @tc.require: issue
2862 */
2863 HWTEST_F(ScanServiceTest, AllowCustomSceneCheck_004, TestSize.Level1)
2864 {
2865     AllowCustomSceneCheckTest4();
2866 }
2867 
2868 /**
2869  * @tc.name: GetAllowBandFreqsControlInfoSuccess1
2870  * @tc.desc: GetAllowBandFreqsControlInfo()
2871  * @tc.type: FUNC
2872  * @tc.require: issue
2873 */
2874 HWTEST_F(ScanServiceTest, GetAllowBandFreqsControlInfoSuccess1, TestSize.Level1)
2875 {
2876     GetAllowBandFreqsControlInfoSuccess1();
2877 }
2878 /**
2879  * @tc.name: GetAllowBandFreqsControlInfoSuccess2
2880  * @tc.desc: GetAllowBandFreqsControlInfo()
2881  * @tc.type: FUNC
2882  * @tc.require: issue
2883 */
2884 HWTEST_F(ScanServiceTest, GetAllowBandFreqsControlInfoSuccess2, TestSize.Level1)
2885 {
2886     GetAllowBandFreqsControlInfoSuccess2();
2887 }
2888 /**
2889  * @tc.name: AllowScanDuringCustomSceneSuccess2
2890  * @tc.desc: AllowScanDuringCustomScene()
2891  * @tc.type: FUNC
2892  * @tc.require: issue
2893 */
2894 HWTEST_F(ScanServiceTest, AllowScanDuringCustomSceneSuccess1, TestSize.Level1)
2895 {
2896     AllowScanDuringCustomSceneSuccess1();
2897 }
2898 /**
2899  * @tc.name: AllowScanDuringCustomSceneSuccess2
2900  * @tc.desc: AllowScanDuringCustomScene()
2901  * @tc.type: FUNC
2902  * @tc.require: issue
2903 */
2904 HWTEST_F(ScanServiceTest, AllowScanDuringCustomSceneSuccess2, TestSize.Level1)
2905 {
2906     AllowScanDuringCustomSceneSuccess2();
2907 }
2908 
2909 HWTEST_F(ScanServiceTest, GetScanControlInfoTest, TestSize.Level1)
2910 {
2911     GetScanControlInfoTest();
2912 }
2913 
2914 HWTEST_F(ScanServiceTest, ClearScanTrustSceneIdsTest, TestSize.Level1)
2915 {
2916     ClearScanTrustSceneIdsTest();
2917 }
2918 
2919 HWTEST_F(ScanServiceTest, ApplyTrustListPolicyTest, TestSize.Level1)
2920 {
2921     ApplyTrustListPolicyTest();
2922 }
2923 
2924 HWTEST_F(ScanServiceTest, SetNetworkInterfaceUpDownTest, TestSize.Level1)
2925 {
2926     SetNetworkInterfaceUpDownTest();
2927 }
2928 
2929 HWTEST_F(ScanServiceTest, SystemScanConnectedPolicyTest, TestSize.Level1)
2930 {
2931     SystemScanConnectedPolicyTest();
2932 }
2933 
2934 HWTEST_F(ScanServiceTest, SystemScanDisconnectedPolicyTest, TestSize.Level1)
2935 {
2936     SystemScanDisconnectedPolicyTest();
2937 }
2938 
2939 HWTEST_F(ScanServiceTest, OnWifiCountryCodeChangedTest, TestSize.Level1)
2940 {
2941     OnWifiCountryCodeChangedTest();
2942 }
2943 
2944 } // namespace Wifi
2945 } // namespace OHOS
2946