Signed-off-by: sunjingqiang <17319862417@163.com>
This commit is contained in:
sunjingqiang 2023-12-06 17:21:58 +08:00
parent c59aaf015a
commit aecd479de9
4 changed files with 2 additions and 11 deletions

View File

@ -168,7 +168,7 @@ HWTEST_F(WifiCountryCodePolicyTest, GetWifiCountryCodeByRegionTest, TestSize.Lev
{
WIFI_LOGI("GetWifiCountryCodeByRegionTest enter");
std::string code;
EXPECT_EQ(ErrCode::WIFI_OPT_SUCCESS, m_wifiCountryCodePolicy->GetWifiCountryCodeByRegion(code));
EXPECT_EQ(ErrCode::WIFI_OPT_FAILED, m_wifiCountryCodePolicy->GetWifiCountryCodeByRegion(code));
}
HWTEST_F(WifiCountryCodePolicyTest, GetWifiCountryCodeByDefaultZZTest, TestSize.Level1)

View File

@ -46,6 +46,7 @@ ohos_unittest("wifi_scan_unittest") {
"scan_interface_test.cpp",
"scan_monitor_test.cpp",
"scan_service_test.cpp",
"scan_state_machine_test.cpp",
]
include_dirs = [

View File

@ -49,13 +49,11 @@ public:
virtual void SetThermalLevel(const int &level) = 0;
virtual void SetAppRunningState(ScanMode appRunMode) = 0;
virtual int SetWhetherToAllowNetworkSwitchover(bool bSwitch, int instId = 0) = 0;
virtual int GetValidChannels(ChannelsTable &channelsInfo) = 0;
virtual int ClearScanInfoList() = 0;
virtual void SetAppPackageName(const std::string &name) = 0;
virtual int SetP2pBusinessType(const P2pBusinessType &type) = 0;
virtual int GetHid2dUpperScene(Hid2dUpperScene &scene) = 0;
virtual int GetP2pBusinessType(P2pBusinessType &type) = 0;
virtual int GetP2pInfo(WifiP2pLinkedInfo &LinkedInfo) = 0;
};
class WifiSettings : public MockWifiSettings {
@ -84,15 +82,12 @@ public:
MOCK_METHOD1(SetThermalLevel, void(const int &level));
MOCK_METHOD1(SetAppRunningState, void(ScanMode appRunMode));
MOCK_METHOD2(SetWhetherToAllowNetworkSwitchover, int(bool bSwitch, int));
MOCK_METHOD1(GetValidChannels, int(ChannelsTable &channelsInfo));
MOCK_METHOD0(ClearScanInfoList, int());
MOCK_METHOD1(SetAppPackageName, void(const std::string &name));
MOCK_METHOD1(SetP2pBusinessType, int(const P2pBusinessType &type));
MOCK_METHOD1(GetHid2dUpperScene, int(Hid2dUpperScene &scene));
MOCK_METHOD1(GetP2pBusinessType, int(P2pBusinessType &type));
MOCK_METHOD1(GetP2pInfo, int(WifiP2pLinkedInfo &LinkedInfo));
};
} // namespace Wifi
} // namespace OHOS
#endif

View File

@ -53,7 +53,6 @@ public:
{
EXPECT_CALL(WifiSettings::GetInstance(), GetHid2dUpperScene(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetP2pBusinessType(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetP2pInfo(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSettings::GetInstance(), GetAppPackageName()).WillRepeatedly(Return(""));
EXPECT_CALL(WifiStaHalInterface::GetInstance(), StopPnoScan()).Times(AtLeast(0));
pScanService = std::make_unique<ScanService>();
@ -78,8 +77,6 @@ public:
EXPECT_CALL(WifiSettings::GetInstance(), GetSupportHwPnoFlag(_)).Times(AtLeast(1));
EXPECT_CALL(WifiSupplicantHalInterface::GetInstance(), RegisterSupplicantEventCallback(_)).Times(AtLeast(1));
EXPECT_CALL(WifiStaHalInterface::GetInstance(), GetSupportFrequencies(_, _)).Times(AtLeast(1));
EXPECT_CALL(WifiSettings::GetInstance(), GetValidChannels(_))
.WillOnce(DoAll(SetArgReferee<0>(temp), Return(0)));
EXPECT_CALL(WifiSettings::GetInstance(), GetScanControlInfo(_, _)).Times(AtLeast(1));
EXPECT_CALL(WifiManager::GetInstance(), DealScanOpenRes(_)).Times(AtLeast(0));
EXPECT_CALL(WifiSupplicantHalInterface::GetInstance(), UnRegisterSupplicantEventCallback()).Times(AtLeast(1));
@ -97,8 +94,6 @@ public:
ChannelsTable temp = { { BandType::BAND_2GHZ, band_2G_channel }, { BandType::BAND_5GHZ, band_5G_channel } };
EXPECT_CALL(WifiStaHalInterface::GetInstance(), GetSupportFrequencies(_, _))
.WillRepeatedly(Return(WIFI_IDL_OPT_FAILED));
EXPECT_CALL(WifiSettings::GetInstance(), GetValidChannels(_))
.WillOnce(DoAll(SetArgReferee<0>(temp), Return(0)));
EXPECT_CALL(WifiSettings::GetInstance(), GetSupportHwPnoFlag(_)).Times(AtLeast(1));
EXPECT_CALL(WifiSupplicantHalInterface::GetInstance(), RegisterSupplicantEventCallback(_)).Times(AtLeast(1));
EXPECT_CALL(WifiSettings::GetInstance(), GetScanControlInfo(_, _)).Times(AtLeast(1));