mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-11 20:03:42 +00:00
commit
ca8c2f737c
@ -777,8 +777,12 @@ ErrCode AbilityContextImpl::GetMissionId(int32_t &missionId)
|
||||
ErrCode AbilityContextImpl::SetMissionContinueState(const AAFwk::ContinueState &state)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::CONTEXT, "SetMissionContinueState: %{public}d", state);
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->SetMissionContinueState(token_, state,
|
||||
sessionToken_.promote());
|
||||
auto sessionToken = GetSessionToken();
|
||||
if (sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "sessionToken is null");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->SetMissionContinueState(token_, state, sessionToken);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::CONTEXT, "SetMissionContinueState failed: %{public}d", err);
|
||||
}
|
||||
|
@ -235,6 +235,29 @@ HWTEST_F(AbilityContextImplTest, Ability_Context_Impl_SetMissionContinueState_01
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Ability_Context_Impl_SetMissionContinueState_0200
|
||||
* @tc.desc: test set mission continue state.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AbilityContextImplTest, Ability_Context_Impl_SetMissionContinueState_0200, Function | MediumTest | Level1)
|
||||
{
|
||||
ASSERT_TRUE(g_mockAbilityMs != nullptr);
|
||||
ASSERT_TRUE(context_ != nullptr);
|
||||
AAFwk::AbilityManagerClient::GetInstance()->proxy_ = g_mockAbilityMs;
|
||||
g_mockAbilityMs->SetCommonMockResult(false);
|
||||
|
||||
AAFwk::ContinueState state = AAFwk::ContinueState::CONTINUESTATE_INACTIVE;
|
||||
auto ret = context_->SetMissionContinueState(state);
|
||||
EXPECT_NE(ret, 0);
|
||||
|
||||
g_mockAbilityMs->SetCommonMockResult(true);
|
||||
ret = context_->SetMissionContinueState(state);
|
||||
if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Ability_Context_Impl_SetMissionLabel_0100
|
||||
* @tc.desc: test set mission label.
|
||||
|
Loading…
Reference in New Issue
Block a user