Signed-off-by: sunjingqiang <17319862417@163.com>
This commit is contained in:
sunjingqiang 2023-12-02 18:08:25 +08:00
parent 6fedf1ec5c
commit 08bca8f8d1

View File

@ -49,116 +49,6 @@ HWTEST_F(WifiProtectTest, InitWifiProtectTest, TestSize.Level1)
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, GetWifiProtectTest, TestSize.Level1)
{
WIFI_LOGI("GetWifiProtectTest enter!");
bool result = WifiProtectManager::GetInstance().GetWifiProtect(WifiProtectMode::WIFI_PROTECT_FULL, "wifiprotect");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().GetWifiProtect(WifiProtectMode::WIFI_PROTECT_SCAN_ONLY, "wifiprotect");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().GetWifiProtect(WifiProtectMode::WIFI_PROTECT_FULL_HIGH_PERF, "wifiprotect");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().GetWifiProtect(WifiProtectMode::WIFI_PROTECT_NO_HELD, nullptr);
EXPECT_FALSE(result);
result = WifiProtectManager::GetInstance().GetWifiProtect(WifiProtectMode::WIFI_PROTECT_NO_HELD, "wifiprotect");
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, IsHeldWifiProtectTest, TestSize.Level1)
{
WIFI_LOGI("IsHeldWifiProtectTest enter!");
std::shared_ptr<WifiProtect> pProtect = std::make_shared<WifiProtect>(WifiProtectType::WIFI_PROTECT_COMMON,
WifiProtectMode::WIFI_PROTECT_FULL, "wifiprotext");
std::shared_ptr<WifiProtect> pProtext = std::make_shared<WifiProtect>(WifiProtectType::WIFI_PROTECT_COMMON,
WifiProtectMode::WIFI_PROTECT_FULL, "wifiprotect");
WifiProtectManager::GetInstance().mWifiProtects.push_back(pProtect);
WifiProtectManager::GetInstance().mWifiProtects.push_back(pProtext);
bool result = WifiProtectManager::GetInstance().IsHeldWifiProtect("wifiprotect");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().IsHeldWifiProtect("wifiprotest");
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, GetNearlyProtectModeTest, TestSize.Level1)
{
WIFI_LOGI("GetNearlyProtectMode enter!");
WifiProtectMode result = WifiProtectManager::GetInstance().GetNearlyProtectMode();
EXPECT_EQ(result, WifiProtectMode::WIFI_PROTECT_NO_HELD);
}
HWTEST_F(WifiProtectTest, ChangeToPerfModeTest, TestSize.Level1)
{
WIFI_LOGI("ChangeToPerfModeTest enter!");
bool result = WifiProtectManager::GetInstance().ChangeToPerfMode(true);
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, ChangeWifiPowerModeTest, TestSize.Level1)
{
WIFI_LOGI("ChangeWifiPowerModeTest enter!");
bool result = WifiProtectManager::GetInstance().ChangeWifiPowerMode();
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, HandleScreenStateChangedTest, TestSize.Level1)
{
WIFI_LOGI("HandleScreenStateChanged enter!");
WifiProtectManager::GetInstance().HandleScreenStateChanged(true);
}
HWTEST_F(WifiProtectTest, AddProtectTest, TestSize.Level1)
{
WIFI_LOGI("AddProtect enter!");
bool result = WifiProtectManager::GetInstance().AddProtect(WifiProtectMode::WIFI_PROTECT_FULL, "wifiprotect");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().AddProtect(WifiProtectMode::WIFI_PROTECT_FULL_HIGH_PERF, "wifiprotect");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().AddProtect(WifiProtectMode::WIFI_PROTECT_FULL_LOW_LATENCY, "wifiprotect");
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, PutWifiProtectTest, TestSize.Level1)
{
WIFI_LOGI("PutWifiProtectTest enter!");
std::shared_ptr<WifiProtect> pProtect = std::make_shared<WifiProtect>(WifiProtectType::WIFI_PROTECT_COMMON,
WifiProtectMode::WIFI_PROTECT_FULL_HIGH_PERF, "wifiprotect");
WifiProtectManager::GetInstance().mWifiProtects.push_back(pProtect);
bool result = WifiProtectManager::GetInstance().PutWifiProtect("wifiprotext");
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().PutWifiProtect("wifiprotect");
EXPECT_TRUE(result);
pProtect = std::make_shared<WifiProtect>(WifiProtectType::WIFI_PROTECT_COMMON,
WifiProtectMode::WIFI_PROTECT_FULL_LOW_LATENCY, "wifiprotext");
WifiProtectManager::GetInstance().mWifiProtects.push_back(pProtect);
result = WifiProtectManager::GetInstance().PutWifiProtect("wifiprotext");
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, GetFgLowlatyProtectCountTest, TestSize.Level1)
{
WIFI_LOGI("GetFgLowlatyProtectCount enter!");
std::shared_ptr<WifiProtect> pProtect = std::make_shared<WifiProtect>(WifiProtectType::WIFI_PROTECT_COMMON,
WifiProtectMode::WIFI_PROTECT_FULL_LOW_LATENCY, "wifiprotect");
WifiProtectManager::GetInstance().mWifiProtects.push_back(pProtect);
bool result = WifiProtectManager::GetInstance().GetFgLowlatyProtectCount();
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, SetLowLatencyModeTest, TestSize.Level1)
{
WIFI_LOGI("SetLowLatencyMode enter!");
bool result = WifiProtectManager::GetInstance().SetLowLatencyMode(true);
EXPECT_TRUE(result);
result = WifiProtectManager::GetInstance().SetLowLatencyMode(false);
EXPECT_TRUE(result);
}
HWTEST_F(WifiProtectTest, RegisterAppStateObserverTest, TestSize.Level1)
{
WIFI_LOGI("RegisterAppStateObserverTest enter!");
WifiProtectManager::GetInstance().RegisterAppStateObserver();
}
HWTEST_F(WifiProtectTest, OnAppDiedTest, TestSize.Level1)
{
WIFI_LOGI("OnAppDiedTest enter!");