!1184 wifi_sta异常用例修复

Merge pull request !1184 from CoderAdo/br_to_master_fix_tdd_sta_0801
This commit is contained in:
openharmony_ci 2023-08-01 09:45:00 +00:00 committed by Gitee
commit fb30ce263e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 12 deletions

View File

@ -54,8 +54,6 @@ public:
virtual int SetDhcpIpType(int dhcpIpType) = 0;
virtual int SetWhetherToAllowNetworkSwitchover(bool bSwitch) = 0;
virtual bool GetWhetherToAllowNetworkSwitchover() = 0;
virtual int AddWpsDeviceConfig(const WifiDeviceConfig &config) = 0;
virtual int GetSavedDeviceAppraisalPriority() = 0;
virtual int GetExternDeviceAppraisalPriority() = 0;
virtual int GetScoretacticsScoreSlope() = 0;
@ -117,8 +115,6 @@ public:
MOCK_METHOD1(SetDhcpIpType, int(int dhcpIpType));
MOCK_METHOD1(SetWhetherToAllowNetworkSwitchover, int(bool bSwitch));
MOCK_METHOD0(GetWhetherToAllowNetworkSwitchover, bool());
MOCK_METHOD1(AddWpsDeviceConfig, int(const WifiDeviceConfig &config));
MOCK_METHOD0(GetSavedDeviceAppraisalPriority, int());
MOCK_METHOD0(GetExternDeviceAppraisalPriority, int());
MOCK_METHOD0(GetScoretacticsScoreSlope, int());

View File

@ -189,7 +189,7 @@ public:
EXPECT_CALL(WifiStaHalInterface::GetInstance(), ClearDeviceConfig()).WillRepeatedly(Return(WIFI_IDL_OPT_OK));
EXPECT_CALL(WifiSettings::GetInstance(), SetMacAddress(_)).Times(testing::AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), ReloadDeviceConfig()).WillRepeatedly(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_)).WillRepeatedly(Return(WIFI_IDL_OPT_OK));
EXPECT_CALL(WifiSettings::GetInstance(), GetRealMacAddress(_)).Times(testing::AtLeast(0));
WifiDeviceConfig wifiDeviceConfig;
std::vector<WifiDeviceConfig> results;
@ -221,7 +221,7 @@ public:
void StartWifiProcessFail1()
{
EXPECT_CALL(WifiStaHalInterface::GetInstance(), StartWifi()).WillRepeatedly(Return(WIFI_IDL_OPT_FAILED));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_)).WillRepeatedly(Return(WIFI_IDL_OPT_OK));
EXPECT_CALL(WifiStaHalInterface::GetInstance(), WpaAutoConnect(_)).WillRepeatedly(Return(WIFI_IDL_OPT_OK));
EXPECT_CALL(WifiManager::GetInstance(), DealStaOpenRes(_)).Times(testing::AtLeast(0));
EXPECT_CALL(WifiStaHalInterface::GetInstance(), ClearDeviceConfig()).WillRepeatedly(Return(WIFI_IDL_OPT_OK));
@ -1257,7 +1257,8 @@ public:
void ApRoamingStateExeMsgSuccess()
{
EXPECT_CALL(WifiSettings::GetInstance(), SetWifiState(_)).Times(testing::AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_)).WillRepeatedly(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetMacAddress(_)).Times(AtLeast(0)).WillOnce(Return(0));
InternalMessage msg;
msg.SetMessageName(WIFI_SVR_CMD_STA_NETWORK_CONNECTION_EVENT);
EXPECT_TRUE(pStaStateMachine->pApRoamingState->ExecuteStateMsg(&msg));
@ -1279,7 +1280,7 @@ public:
config.value = "hmwifi";
EXPECT_CALL(WifiStaHalInterface::GetInstance(), GetDeviceConfig(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(config), Return(WIFI_IDL_OPT_FAILED)));
EXPECT_CALL(WifiSettings::GetInstance(), AddWpsDeviceConfig(_));
EXPECT_CALL(WifiSettings::GetInstance(), GetMacAddress(_)).Times(AtLeast(0)).WillOnce(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), SyncDeviceConfig());
EXPECT_CALL(WifiSettings::GetInstance(), SetWifiState(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
@ -1296,7 +1297,7 @@ public:
config.value = "hmwifi";
EXPECT_CALL(WifiStaHalInterface::GetInstance(), GetDeviceConfig(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(config), Return(WIFI_IDL_OPT_FAILED)));
EXPECT_CALL(WifiSettings::GetInstance(), AddWpsDeviceConfig(_));
EXPECT_CALL(WifiSettings::GetInstance(), GetMacAddress(_)).Times(AtLeast(0)).WillOnce(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), SyncDeviceConfig());
EXPECT_CALL(WifiSettings::GetInstance(), SetWifiState(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
@ -1313,7 +1314,7 @@ public:
config.value = "hmwifi";
EXPECT_CALL(WifiStaHalInterface::GetInstance(), GetDeviceConfig(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(config), Return(WIFI_IDL_OPT_OK)));
EXPECT_CALL(WifiSettings::GetInstance(), AddWpsDeviceConfig(_));
EXPECT_CALL(WifiSettings::GetInstance(), GetMacAddress(_)).Times(AtLeast(0)).WillOnce(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), SyncDeviceConfig());
EXPECT_CALL(WifiSettings::GetInstance(), SetWifiState(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
@ -1330,7 +1331,7 @@ public:
config.value = "hmwifi";
EXPECT_CALL(WifiStaHalInterface::GetInstance(), GetDeviceConfig(_))
.WillRepeatedly(DoAll(SetArgReferee<0>(config), Return(WIFI_IDL_OPT_FAILED)));
EXPECT_CALL(WifiSettings::GetInstance(), AddWpsDeviceConfig(_));
EXPECT_CALL(WifiSettings::GetInstance(), GetMacAddress(_)).Times(AtLeast(0)).WillOnce(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), SyncDeviceConfig());
EXPECT_CALL(WifiSettings::GetInstance(), SetWifiState(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetDeviceConfig(_)).Times(AtLeast(0));
@ -1577,7 +1578,7 @@ public:
{
pStaStateMachine->linkedInfo.detailedState = DetailedState::NOTWORKING;
pStaStateMachine->linkedInfo.connState = ConnState::CONNECTED;
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_)).WillOnce(Return(0));
EXPECT_CALL(WifiSettings::GetInstance(), SaveLinkedInfo(_)).WillRepeatedly(Return(0));
WifiDeviceConfig config;
pStaStateMachine->ReUpdateNetLinkInfo(config);
}