Merge pull request !1128 from dengxiaoyu/master
This commit is contained in:
openharmony_ci 2024-10-21 07:26:47 +00:00 committed by Gitee
commit 0bc01885a1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 193 additions and 0 deletions

View File

@ -174,10 +174,15 @@ ohos_unittest("distributedschedservicetest") {
public_deps = dsched_public_deps
}
defines = []
if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
}
if (!dmsfwk_softbus_adapter_common) {
defines += [ "DMSFWK_INTERACTIVE_ADAPTER" ]
}
part_name = "dmsfwk"
subsystem_name = "ability"
}

View File

@ -1486,5 +1486,136 @@ HWTEST_F(DistributedSchedServiceSecondTest, CheckTargetPermission4DiffBundle_001
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DistributedSchedServiceSecondTest CheckTargetPermission4DiffBundle_001 end" << std::endl;
}
#ifdef DMSFWK_INTERACTIVE_ADAPTER
/**
* @tc.name: StartRemoteAbilityAdapter_001
* @tc.desc: StartRemoteAbilityAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, StartRemoteAbilityAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest StartRemoteAbilityAdapter_001 start" << std::endl;
OHOS::AAFwk::Want want;
int32_t callerUid = 0;
int32_t requestCode = 0;
uint32_t accessToken = 0;
int32_t ret = DistributedSchedService::GetInstance().StartRemoteAbilityAdapter(want,
callerUid, requestCode, accessToken);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest StartRemoteAbilityAdapter_001 end" << std::endl;
}
/**
* @tc.name: ConnectRemoteAbilityAdapter_001
* @tc.desc: ConnectRemoteAbilityAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, ConnectRemoteAbilityAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest ConnectRemoteAbilityAdapter_001 start" << std::endl;
OHOS::AAFwk::Want want;
sptr<IRemoteObject> connect;
int32_t callerUid = 0;
int32_t callerPid = 0;
uint32_t accessToken = 0;
int32_t ret = DistributedSchedService::GetInstance().ConnectRemoteAbilityAdapter(want, connect,
callerUid, callerPid, accessToken);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest ConnectRemoteAbilityAdapter_001 end" << std::endl;
}
/**
* @tc.name: StartAbilityFromRemoteAdapter_001
* @tc.desc: StartAbilityFromRemoteAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, StartAbilityFromRemoteAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest StartAbilityFromRemoteAdapter_001 start" << std::endl;
MessageParcel data;
MessageParcel reply;
int32_t ret = DistributedSchedService::GetInstance().StartAbilityFromRemoteAdapter(data, reply);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest StartAbilityFromRemoteAdapter_001 end" << std::endl;
}
/**
* @tc.name: StopAbilityFromRemoteAdapter_001
* @tc.desc: StopAbilityFromRemoteAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, StopAbilityFromRemoteAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest StopAbilityFromRemoteAdapter_001 start" << std::endl;
MessageParcel data;
MessageParcel reply;
int32_t ret = DistributedSchedService::GetInstance().StopAbilityFromRemoteAdapter(data, reply);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest StopAbilityFromRemoteAdapter_001 end" << std::endl;
}
/**
* @tc.name: ConnectAbilityFromRemoteAdapter_001
* @tc.desc: ConnectAbilityFromRemoteAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, ConnectAbilityFromRemoteAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest ConnectAbilityFromRemoteAdapter_001 start" << std::endl;
MessageParcel data;
MessageParcel reply;
int32_t ret = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteAdapter(data, reply);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest ConnectAbilityFromRemoteAdapter_001 end" << std::endl;
}
/**
* @tc.name: DisconnectAbilityFromRemoteAdapter_001
* @tc.desc: DisconnectAbilityFromRemoteAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, DisconnectAbilityFromRemoteAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest DisconnectAbilityFromRemoteAdapter_001 start" << std::endl;
MessageParcel data;
MessageParcel reply;
int32_t ret = DistributedSchedService::GetInstance().DisconnectAbilityFromRemoteAdapter(data, reply);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest DisconnectAbilityFromRemoteAdapter_001 end" << std::endl;
}
/**
* @tc.name: NotifyAbilityLifecycleChangedFromRemoteAdapter_001
* @tc.desc: NotifyAbilityLifecycleChangedFromRemoteAdapter
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, NotifyAbilityLifecycleChangedFromRemoteAdapter_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest NotifyAbilityLifecycleChangedFromRemoteAdapter_001 start" <<
std::endl;
MessageParcel data;
MessageParcel reply;
int32_t ret = DistributedSchedService::GetInstance().NotifyAbilityLifecycleChangedFromRemoteAdapter(data, reply);
EXPECT_EQ(ret, NOT_FIND_SERVICE_REGISTRY);
DTEST_LOG << "DistributedSchedServiceSecondTest NotifyAbilityLifecycleChangedFromRemoteAdapter_001 end" <<
std::endl;
}
#endif // DMSFWK_INTERACTIVE_ADAPTER
/**
* @tc.name: NotifyDSchedEventResultFromRemote_001
* @tc.desc: NotifyDSchedEventResultFromRemote
* @tc.type: FUNC
*/
HWTEST_F(DistributedSchedServiceSecondTest, NotifyDSchedEventResultFromRemote_001, TestSize.Level3)
{
DTEST_LOG << "DistributedSchedServiceSecondTest NotifyDSchedEventResultFromRemote_001 start" << std::endl;
std::string type;
int32_t dSchedEventResult = 0;
int32_t ret = DistributedSchedService::GetInstance().NotifyDSchedEventResultFromRemote(type, dSchedEventResult);
EXPECT_EQ(ret, ERR_OK);
DTEST_LOG << "DistributedSchedServiceSecondTest NotifyDSchedEventResultFromRemote_001 end" << std::endl;
}
}
}

View File

@ -234,5 +234,49 @@ int32_t MockDistributedSched::StopExtensionAbilityFromRemote(const OHOS::AAFwk::
{
return ERR_NONE;
}
#ifdef DMSFWK_INTERACTIVE_ADAPTER
bool MockDistributedSched::CheckRemoteOsType(const std::string& netwokId)
{
return true;
}
int32_t MockDistributedSched::StartRemoteAbilityAdapter(const OHOS::AAFwk::Want& want,
int32_t callerUid, int32_t requestCode, uint32_t accessToken)
{
return ERR_NONE;
}
int32_t MockDistributedSched::ConnectRemoteAbilityAdapter(const OHOS::AAFwk::Want& want,
const sptr<IRemoteObject>& connect, int32_t callerUid, int32_t callerPid, uint32_t accessToken)
{
return ERR_NONE;
}
int32_t MockDistributedSched::StartAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply)
{
return ERR_NONE;
}
int32_t MockDistributedSched::StopAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply)
{
return ERR_NONE;
}
int32_t MockDistributedSched::ConnectAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply)
{
return ERR_NONE;
}
int32_t MockDistributedSched::DisconnectAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply)
{
return ERR_NONE;
}
int32_t MockDistributedSched::NotifyAbilityLifecycleChangedFromRemoteAdapter(MessageParcel& data, MessageParcel& reply)
{
return ERR_NONE;
}
#endif // DMSFWK_INTERACTIVE_ADAPTER
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -92,6 +92,19 @@ public:
const OHOS::AAFwk::Want& want, int32_t callerUid, uint32_t accessToken, int32_t extensionType) override;
int32_t StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want,
const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t extensionType) override;
#ifdef DMSFWK_INTERACTIVE_ADAPTER
bool CheckRemoteOsType(const std::string& netwokId) override;
int32_t StartRemoteAbilityAdapter(const OHOS::AAFwk::Want& want, int32_t callerUid, int32_t requestCode,
uint32_t accessToken);
int32_t ConnectRemoteAbilityAdapter(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
int32_t callerUid, int32_t callerPid, uint32_t accessToken);
int32_t StartAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) override;
int32_t StopAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) override;
int32_t ConnectAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) override;
int32_t DisconnectAbilityFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) override;
int32_t NotifyAbilityLifecycleChangedFromRemoteAdapter(MessageParcel& data, MessageParcel& reply) override;
#endif
private:
bool expectedTrue_ = false;
};