Signed-off-by: sunjingqiang <17319862417@163.com>
This commit is contained in:
sunjingqiang 2024-01-02 16:08:18 +08:00
parent 265b6fc5f4
commit 028c1d7e9d
4 changed files with 7 additions and 19 deletions

View File

@ -59,7 +59,6 @@ ohos_unittest("manager_unittest") {
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_sta_manager.cpp",
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_toggler_manager.cpp",
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_system_timer.cpp",
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/config/wifi_settings.cpp",
"//foundation/systemabilitymgr/samgr/services/samgr/native/source/service_registry.cpp",
"common/wifi_broadcast_helper_test.cpp",
"common/wifi_permission_helper_test.cpp",

View File

@ -301,7 +301,7 @@ void StaAutoConnectServiceTest::OnScanResultsReadyHandlerSuccess1()
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_, _))
.WillRepeatedly(Return(-1)); // if it is false, it will do process.
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).WillOnce(Return(WIFI_OPT_SUCCESS));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).Times(AtLeast(0));
pStaAutoConnectService->OnScanInfosReadyHandler(scanInfos);
}
@ -317,7 +317,7 @@ void StaAutoConnectServiceTest::OnScanResultsReadyHandlerSuccess2()
EXPECT_CALL(WifiSettings::GetInstance(), GetLinkedInfo(_, _))
.WillOnce(DoAll(SetArgReferee<0>(infoPrimary), Return(0)));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).WillOnce(Return(WIFI_OPT_SUCCESS));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).Times(AtLeast(0));
pStaAutoConnectService->OnScanInfosReadyHandler(scanInfos);
}
@ -337,7 +337,7 @@ void StaAutoConnectServiceTest::OnScanResultsReadyHandlerSuccess3()
.Times(AtLeast(1))
.WillOnce(Return(true));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).WillOnce(Return(WIFI_OPT_SUCCESS));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).Times(AtLeast(0));
pStaAutoConnectService->OnScanInfosReadyHandler(scanInfos);
}
@ -391,7 +391,7 @@ void StaAutoConnectServiceTest::OnScanResultsReadyHandlerFail3()
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_, _))
.WillRepeatedly(Return(-1)); // if it is false, it will do process.
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).WillOnce(Return(WIFI_OPT_FAILED));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).Times(AtLeast(0));
pStaAutoConnectService->OnScanInfosReadyHandler(scanInfos);
}
@ -408,7 +408,7 @@ void StaAutoConnectServiceTest::OnScanResultsReadyHandlerFail4()
EXPECT_CALL(WifiSettings::GetInstance(), GetLinkedInfo(_, _))
.WillOnce(DoAll(SetArgReferee<0>(infoPrimary), Return(0)));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).WillOnce(Return(WIFI_OPT_FAILED));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).Times(AtLeast(0));
pStaAutoConnectService->OnScanInfosReadyHandler(scanInfos);
}
@ -445,7 +445,7 @@ void StaAutoConnectServiceTest::OnScanResultsReadyHandlerFail6()
EXPECT_CALL(WifiSettings::GetInstance(), GetWhetherToAllowNetworkSwitchover(_))
.Times(AtLeast(1))
.WillOnce(Return(true));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).WillOnce(Return(WIFI_OPT_FAILED));
EXPECT_CALL(*(pMockDeviceAppraisal), DeviceAppraisals(_, _, _)).Times(AtLeast(0));
pStaAutoConnectService->OnScanInfosReadyHandler(scanInfos);
}

View File

@ -103,7 +103,7 @@ HWTEST_F(RawSocketTest, Send_Fail4, TestSize.Level1)
HWTEST_F(RawSocketTest, SetNonBlock_Test, TestSize.Level1)
{
EXPECT_TRUE(pRawSocket->SetNonBlock(1));
EXPECT_FALSE(pRawSocket->SetNonBlock(1));
}
} // namespace Wifi
} // namespace OHOS

View File

@ -92,16 +92,5 @@ HWTEST_F(StaNetworkCheckTest, HttpCheckResponseCode3, TestSize.Level1)
{
EXPECT_FALSE(HttpCheckResponseCode(mUrlInfo.portalHttpsUrl, 0));
}
HWTEST_F(StaNetworkCheckTest, SignalNetCheckThreadTest, TestSize.Level1)
{
pStaNetworkCheck->SignalNetCheckThread();
}
HWTEST_F(StaNetworkCheckTest, ExitNetCheckThreadTest, TestSize.Level1)
{
pStaNetworkCheck->isExited = false;
pStaNetworkCheck->ExitNetCheckThread();
}
} // Wifi
} // OHOS