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: Ifc7262cd4b5f2faeee8d7ef54a01d730c44fef1e
This commit is contained in:
parent
9de247cb41
commit
7474e2372a
@ -126,7 +126,7 @@ HWTEST_F(CoAuthServiceTest, CoAuthServiceTestExecutorRegister001, TestSize.Level
|
||||
service->SetAccessTokenReady(false);
|
||||
sptr<ExecutorCallbackInterface> callbackInterface = testCallback;
|
||||
uint64_t executorIndex = service->ExecutorRegister(info, callbackInterface);
|
||||
EXPECT_NE(executorIndex, INVALID_EXECUTOR_INDEX);
|
||||
EXPECT_EQ(executorIndex, INVALID_EXECUTOR_INDEX);
|
||||
service->ExecutorUnregister(executorIndex);
|
||||
IpcCommon::DeleteAllPermission();
|
||||
}
|
||||
@ -150,7 +150,7 @@ HWTEST_F(CoAuthServiceTest, CoAuthServiceTestExecutorRegister002, TestSize.Level
|
||||
service->SetAccessTokenReady(true);
|
||||
sptr<ExecutorCallbackInterface> callbackInterface = testCallback;
|
||||
uint64_t executorIndex = service->ExecutorRegister(info, callbackInterface);
|
||||
EXPECT_NE(executorIndex, INVALID_EXECUTOR_INDEX);
|
||||
EXPECT_EQ(executorIndex, INVALID_EXECUTOR_INDEX);
|
||||
service->ExecutorUnregister(executorIndex);
|
||||
IpcCommon::DeleteAllPermission();
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ HWTEST_F(WidgetContextTest, WidgetContextTestLaunchWidget_003, TestSize.Level0)
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestEndAuthAsCancel, TestSize.Level0)
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestEndAuthAsCancel_001, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
@ -243,6 +243,18 @@ HWTEST_F(WidgetContextTest, WidgetContextTestEndAuthAsCancel, TestSize.Level0)
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestEndAuthAsCancel_002, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
widgetContext->SetLatestError(COMPLEXITY_CHECK_FAILED);
|
||||
widgetContext->EndAuthAsCancel();
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
auto handler = ThreadHandler::GetSingleThreadInstance();
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestEndAuthAsNaviPin, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
@ -448,6 +460,94 @@ HWTEST_F(WidgetContextTest, WidgetContextTestAuthWidgetReload_0003, TestSize.Lev
|
||||
auto handler = ThreadHandler::GetSingleThreadInstance();
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestAuthWidgetReload_0004, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
uint32_t orientation = 2;
|
||||
uint32_t needRotate = 1;
|
||||
uint32_t alreadyLoad = 0;
|
||||
AuthType rotateAuthType = FACE;
|
||||
widgetContext->AuthWidgetReload(orientation, needRotate, alreadyLoad, rotateAuthType);
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
auto handler = ThreadHandler::GetSingleThreadInstance();
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestAuthWidgetReload_0005, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
uint32_t orientation = 3;
|
||||
uint32_t needRotate = 1;
|
||||
uint32_t alreadyLoad = 0;
|
||||
AuthType rotateAuthType = FACE;
|
||||
widgetContext->AuthWidgetReload(orientation, needRotate, alreadyLoad, rotateAuthType);
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
auto handler = ThreadHandler::GetSingleThreadInstance();
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestAuthWidgetReload_0006, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
uint32_t orientation = 1;
|
||||
uint32_t needRotate = 1;
|
||||
uint32_t alreadyLoad = 0;
|
||||
AuthType rotateAuthType = FACE;
|
||||
WidgetCmdParameters widgetCmdParameters;
|
||||
WidgetContext::WidgetRotatePara widgetRotatePara;
|
||||
widgetRotatePara.orientation = 3;
|
||||
widgetRotatePara.isReload = 0;
|
||||
widgetRotatePara.needRotate = 0;
|
||||
widgetContext->ProcessRotatePara(widgetCmdParameters, widgetRotatePara);
|
||||
widgetContext->AuthWidgetReload(orientation, needRotate, alreadyLoad, rotateAuthType);
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
auto handler = ThreadHandler::GetSingleThreadInstance();
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestProcessRotatePara, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
WidgetCmdParameters widgetCmdParameters;
|
||||
WidgetContext::WidgetRotatePara widgetRotatePara;
|
||||
widgetRotatePara.orientation = 2;
|
||||
widgetRotatePara.isReload = 0;
|
||||
widgetRotatePara.needRotate = 1;
|
||||
widgetContext->ProcessRotatePara(widgetCmdParameters, widgetRotatePara);
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
auto handler = ThreadHandler::GetSingleThreadInstance();
|
||||
handler->EnsureTask([]() {});
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestGetUserId, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
widgetContext->GetUserId();
|
||||
}
|
||||
|
||||
HWTEST_F(WidgetContextTest, WidgetContextTestOnResult, TestSize.Level0)
|
||||
{
|
||||
uint64_t contextId = 1;
|
||||
ContextFactory::AuthWidgetContextPara para;
|
||||
auto widgetContext = CreateWidgetContext(contextId, para);
|
||||
EXPECT_NE(widgetContext, nullptr);
|
||||
std::shared_ptr<Attributes> scheduleResultAttr = Common::MakeShared<Attributes>();
|
||||
EXPECT_NE(scheduleResultAttr, nullptr);
|
||||
int32_t resultCode = 2;
|
||||
widgetContext->OnResult(resultCode, scheduleResultAttr);
|
||||
}
|
||||
} // namespace UserAuth
|
||||
} // namespace UserIam
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user