mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-11-23 07:39:51 +00:00
fix: ut coverage
Signed-off-by: 居凯 <shun0304@126.com> Change-Id: Ia4dc3850294adf384aee97cb8f0d0d7b61c770c1
This commit is contained in:
parent
87d2df1ca7
commit
2b1b57c6bc
@ -43,11 +43,32 @@ void KeyguardStatusListenerTest::TearDown()
|
||||
HWTEST_F(KeyguardStatusListenerTest, KeyguardStatusListenerTestRegisterListener, TestSize.Level0)
|
||||
{
|
||||
ResultCode result = KeyguardStatusListenerManager::GetInstance().RegisterCommonEventListener();
|
||||
EXPECT_EQ(result, GENERAL_ERROR);
|
||||
EXPECT_EQ(result, SUCCESS);
|
||||
result = KeyguardStatusListenerManager::GetInstance().RegisterCommonEventListener();
|
||||
EXPECT_NO_THROW(KeyguardStatusListenerManager::GetInstance().RegisterKeyguardStatusSwitchCallback());
|
||||
EXPECT_NO_THROW(KeyguardStatusListenerManager::GetInstance().RegisterKeyguardStatusSwitchCallback());
|
||||
EXPECT_NO_THROW(KeyguardStatusListenerManager::GetInstance().UnRegisterKeyguardStatusSwitchCallback());
|
||||
EXPECT_NO_THROW(KeyguardStatusListenerManager::GetInstance().UnRegisterKeyguardStatusSwitchCallback());
|
||||
result = KeyguardStatusListenerManager::GetInstance().UnRegisterCommonEventListener();
|
||||
EXPECT_EQ(result, GENERAL_ERROR);
|
||||
EXPECT_EQ(result, SUCCESS);
|
||||
result = KeyguardStatusListenerManager::GetInstance().UnRegisterCommonEventListener();
|
||||
}
|
||||
|
||||
HWTEST_F(KeyguardStatusListenerTest, KeyguardStatusListenerTestOnReceiveEvent, TestSize.Level0)
|
||||
{
|
||||
EventFwk::MatchingSkills matchingSkills;
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED);
|
||||
|
||||
EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
|
||||
auto subscriber = std::make_shared<KeyguardStatusListener>(subscribeInfo);
|
||||
EventFwk::Want want;
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED);
|
||||
EventFwk::CommonEventData data(want);
|
||||
EXPECT_NO_THROW(subscriber->OnReceiveEvent(data));
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED);
|
||||
EventFwk::CommonEventData data1(want);
|
||||
EXPECT_NO_THROW(subscriber->OnReceiveEvent(data1));
|
||||
}
|
||||
} // namespace UserAuth
|
||||
} // namespace UserIam
|
||||
|
Loading…
Reference in New Issue
Block a user