!733 修复 NotifyScreenLockorOff ut

Merge pull request !733 from zhx/master
This commit is contained in:
openharmony_ci 2023-11-18 10:45:57 +00:00 committed by Gitee
commit f3f70f9247
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -531,14 +531,20 @@ HWTEST_F(DMSContinueManagerTest, testDealSetMissionContinueStateBusiness001, Tes
HWTEST_F(DMSContinueManagerTest, testNotifyScreenLockorOff001, TestSize.Level1)
{
DTEST_LOG << "DMSContinueManagerTest testNotifyScreenLockorOff001 start" << std::endl;
sptr<IRemoteObject> obj01 = new RemoteOnListenerStubTest();
DistributedSchedContinueManager::GetInstance().RegisterOnListener(TYPE, obj01);
EXPECT_NE(DistributedSchedContinueManager::GetInstance().registerOnListener_.size(), 0);
DistributedSchedContinueManager::GetInstance().Init();
DistributedSchedContinueManager::GetInstance().iconInfo_.senderNetworkId = NETWORKID_01;
/**
* @tc.steps: step1. test NotifyScreenLockorOff when eventHandler is not nullptr;
*/
DistributedSchedContinueManager::GetInstance().NotifyScreenLockorOff();
EXPECT_EQ(DistributedSchedContinueManager::GetInstance().iconInfo_.senderNetworkId, "");
EXPECT_NE(DistributedSchedContinueManager::GetInstance().eventHandler_, nullptr);
/**
* @tc.steps: step2. test NotifyScreenLockorOff when eventHandler is nullptr;
*/
DistributedSchedContinueManager::GetInstance().UnInit();
DistributedSchedContinueManager::GetInstance().NotifyScreenLockorOff();
EXPECT_EQ(DistributedSchedContinueManager::GetInstance().eventHandler_, nullptr);
DTEST_LOG << "DMSContinueManagerTest testNotifyScreenLockorOff001 end" << std::endl;
}