mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 08:30:38 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
09e6c39a2a
@ -100,22 +100,14 @@ HWTEST_F(DistributedAbilityManagerServiceTest, Dump_001, TestSize.Level3)
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @tc.steps: step1. test OnStart.
|
||||
*/
|
||||
dtbabilitymgrService_->OnStart();
|
||||
/**
|
||||
* @tc.steps: step2. test OnStop.
|
||||
*/
|
||||
dtbabilitymgrService_->OnStop();
|
||||
/**
|
||||
* @tc.steps: step3. test Dump when args is not empty.
|
||||
* @tc.steps: step1. test Dump when args is not empty.
|
||||
*/
|
||||
std::vector<std::u16string> args;
|
||||
args.push_back(TEST_U16STRING);
|
||||
int32_t result = dtbabilitymgrService_->Dump(INVALID_CODE, args);
|
||||
EXPECT_EQ(result, DMS_WRITE_FILE_FAILED_ERR);
|
||||
/**
|
||||
* @tc.steps: step4. test DumpAppRegisterInfo when tokenMap_ is not empty.
|
||||
* @tc.steps: step2. test DumpAppRegisterInfo when tokenMap_ is not empty.
|
||||
*/
|
||||
std::string info;
|
||||
std::vector<int32_t> tokenMapValue;
|
||||
@ -335,6 +327,45 @@ HWTEST_F(DistributedAbilityManagerServiceTest, Unregister_001, TestSize.Level3)
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest Unregister_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Unregister_002
|
||||
* @tc.desc: test Unregister when iter->second is not empty.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5NOA1
|
||||
*/
|
||||
HWTEST_F(DistributedAbilityManagerServiceTest, Unregister_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest Unregister_002 start" << std::endl;
|
||||
if (dtbabilitymgrService_ == nullptr) {
|
||||
DTEST_LOG << "dtbabilitymgrService_ is nullptr" << std::endl;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @tc.steps: step1. test Unregister when iter->second is not empty.
|
||||
*/
|
||||
int32_t token = 0;
|
||||
int32_t tokenBackup = 0;
|
||||
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
|
||||
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->Register(continuationExtraParams, tokenBackup);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
{
|
||||
std::lock_guard<std::mutex> callbackMapLock(dtbabilitymgrService_->callbackMapMutex_);
|
||||
std::unique_ptr<NotifierInfo> notifierInfo = std::make_unique<NotifierInfo>();
|
||||
dtbabilitymgrService_->callbackMap_[token] = std::move(notifierInfo);;
|
||||
}
|
||||
ret = dtbabilitymgrService_->Unregister(token);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->Unregister(tokenBackup);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
{
|
||||
std::lock_guard<std::mutex> callbackMapLock(dtbabilitymgrService_->callbackMapMutex_);
|
||||
dtbabilitymgrService_->callbackMap_.clear();
|
||||
}
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest Unregister_002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RegisterDeviceSelectionCallback_001
|
||||
* @tc.desc: test RegisterDeviceSelectionCallback
|
||||
@ -373,6 +404,40 @@ HWTEST_F(DistributedAbilityManagerServiceTest, RegisterDeviceSelectionCallback_0
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest RegisterDeviceSelectionCallback_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RegisterDeviceSelectionCallback_002
|
||||
* @tc.desc: test RegisterDeviceSelectionCallback
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5NOA1
|
||||
*/
|
||||
HWTEST_F(DistributedAbilityManagerServiceTest, RegisterDeviceSelectionCallback_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest RegisterDeviceSelectionCallback_002 start" << std::endl;
|
||||
if (dtbabilitymgrService_ == nullptr) {
|
||||
DTEST_LOG << "dtbabilitymgrService_ is nullptr" << std::endl;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @tc.steps: step1. test RegisterDeviceSelectionCallback when iter->second != nullptr.
|
||||
*/
|
||||
int32_t token = 0;
|
||||
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
|
||||
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
|
||||
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_DISCONNECT, notifier);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
ret = dtbabilitymgrService_->UnregisterDeviceSelectionCallback(token, EVENT_CONNECT);
|
||||
ret = dtbabilitymgrService_->UnregisterDeviceSelectionCallback(token, EVENT_DISCONNECT);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->Unregister(token);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest RegisterDeviceSelectionCallback_002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UnregisterDeviceSelectionCallback_001
|
||||
* @tc.desc: test UnregisterDeviceSelectionCallback
|
||||
@ -424,6 +489,41 @@ HWTEST_F(DistributedAbilityManagerServiceTest, UnregisterDeviceSelectionCallback
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest UnregisterDeviceSelectionCallback_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UnregisterDeviceSelectionCallback_002
|
||||
* @tc.desc: test UnregisterDeviceSelectionCallback when callback is registered.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5NOA1
|
||||
*/
|
||||
HWTEST_F(DistributedAbilityManagerServiceTest, UnregisterDeviceSelectionCallback_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest UnregisterDeviceSelectionCallback_002 start" << std::endl;
|
||||
if (dtbabilitymgrService_ == nullptr) {
|
||||
DTEST_LOG << "dtbabilitymgrService_ is nullptr" << std::endl;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @tc.steps: step1. test UnregisterDeviceSelectionCallback when callback is registered.
|
||||
*/
|
||||
int32_t token = 0;
|
||||
std::shared_ptr<ContinuationExtraParams> continuationExtraParams = std::make_shared<ContinuationExtraParams>();
|
||||
int32_t ret = dtbabilitymgrService_->Register(continuationExtraParams, token);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
sptr<DeviceSelectionNotifierTest> notifier = new DeviceSelectionNotifierTest();
|
||||
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_CONNECT, notifier);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->RegisterDeviceSelectionCallback(token, EVENT_DISCONNECT, notifier);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
ret = dtbabilitymgrService_->UnregisterDeviceSelectionCallback(token, EVENT_CONNECT);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->UnregisterDeviceSelectionCallback(token, EVENT_DISCONNECT);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->Unregister(token);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedAbilityManagerServiceTest UnregisterDeviceSelectionCallback_002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: UpdateConnectStatus_001
|
||||
* @tc.desc: test UpdateConnectStatus
|
||||
@ -464,6 +564,15 @@ HWTEST_F(DistributedAbilityManagerServiceTest, UpdateConnectStatus_001, TestSize
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
ret = dtbabilitymgrService_->UpdateConnectStatus(token, DEVICE_ID, DeviceConnectStatus::IDLE);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
/**
|
||||
* @tc.steps: step5. test UpdateConnectStatus when appProxy_ is nullptr.
|
||||
*/
|
||||
{
|
||||
std::lock_guard<std::mutex> appProxyLock(dtbabilitymgrService_->appProxyMutex_);
|
||||
dtbabilitymgrService_->appProxy_ = nullptr;
|
||||
}
|
||||
ret = dtbabilitymgrService_->UpdateConnectStatus(token, DEVICE_ID, DeviceConnectStatus::IDLE);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
ret = dtbabilitymgrService_->UnregisterDeviceSelectionCallback(token, EVENT_CONNECT);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -771,8 +880,8 @@ HWTEST_F(DistributedAbilityManagerServiceTest, HandleNotifierDied_001, TestSize.
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleNotifierDied
|
||||
* @tc.desc: test HandleNotifierDied
|
||||
* @tc.name: OnDeviceCancel_001
|
||||
* @tc.desc: test OnDeviceCancel
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedAbilityManagerServiceTest, OnDeviceCancel_001, TestSize.Level3)
|
||||
|
@ -896,6 +896,24 @@ HWTEST_F(DistributedSchedConnectTest, DisconnectRemoteAbility004, TestSize.Level
|
||||
HWTEST_F(DistributedSchedConnectTest, DisconnectRemoteAbility005, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest DisconnectRemoteAbility005 start" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. call RemoveCallerComponent
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
|
||||
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 end" << std::endl;
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().DisconnectRemoteAbility(nullptr, 0, 0);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedConnectTest DisconnectRemoteAbility005 end" << std::endl;
|
||||
@ -910,6 +928,26 @@ HWTEST_F(DistributedSchedConnectTest, DisconnectRemoteAbility005, TestSize.Level
|
||||
HWTEST_F(DistributedSchedConnectTest, DisconnectAbilityFromRemote001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest DisconnectAbilityFromRemote001 start" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. call RemoveCallerComponent
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 start" << std::endl;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
OHOS::AAFwk::Want want1;
|
||||
want1.SetElementName(remoteDeviceId, "ohos.demo.bundleName1", "abilityName1");
|
||||
OHOS::AAFwk::Want want2;
|
||||
want2.SetElementName(remoteDeviceId, "ohos.demo.bundleName2", "abilityName2");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want1, connect, callerInfo);
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want2, connect, callerInfo);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 end" << std::endl;
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().DisconnectAbilityFromRemote(nullptr, 0, "");
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedConnectTest DisconnectAbilityFromRemote001 end" << std::endl;
|
||||
@ -957,6 +995,22 @@ HWTEST_F(DistributedSchedConnectTest, DisconnectAbilityFromRemote004, TestSize.L
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest DisconnectAbilityFromRemote004 start" << std::endl;
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
/**
|
||||
* @tc.steps: step1. call SaveCallerComponent
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 end" << std::endl;
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().DisconnectAbilityFromRemote(
|
||||
connect, 0, "123_remote_device_id");
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -1015,6 +1069,17 @@ HWTEST_F(DistributedSchedConnectTest, NotifyApp001, TestSize.Level3)
|
||||
DTEST_LOG << "DistributedSchedConnectTest NotifyApp001 start" << std::endl;
|
||||
AppExecFwk::ElementName element;
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
/**
|
||||
* @tc.steps: step1. call ProcessCalleeDied
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 start" << std::endl;
|
||||
sptr<IRemoteObject> callbackWrapper = new AbilityConnectionWrapperStubTest(connect);
|
||||
CallerInfo callerInfo;
|
||||
ConnectInfo connectInfo {callerInfo, callbackWrapper};
|
||||
DistributedSchedService::GetInstance().calleeMap_.emplace(connect, connectInfo);
|
||||
DistributedSchedService::GetInstance().ProcessCalleeDied(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 end" << std::endl;
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().NotifyApp(connect, element, 0);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedConnectTest NotifyApp001 end" << std::endl;
|
||||
@ -1030,6 +1095,13 @@ HWTEST_F(DistributedSchedConnectTest, NotifyApp002, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest NotifyApp002 start" << std::endl;
|
||||
AppExecFwk::ElementName element;
|
||||
/**
|
||||
* @tc.steps: step1. call ProcessCalleeDied
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 start" << std::endl;
|
||||
DistributedSchedService::GetInstance().ProcessCalleeDied(nullptr);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 end" << std::endl;
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().NotifyApp(nullptr, element, 0);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedConnectTest NotifyApp002 end" << std::endl;
|
||||
@ -1079,6 +1151,15 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectRemoteAbility001, TestS
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @tc.steps: step1. call HandleLocalCallerDied
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 start" << std::endl;
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
|
||||
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->DisconnectRemoteAbility(nullptr, 0, 0);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectRemoteAbility001 end" << std::endl;
|
||||
@ -1098,6 +1179,23 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectRemoteAbility002, TestS
|
||||
return;
|
||||
}
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
/**
|
||||
* @tc.steps: step1. call HandleLocalCallerDied
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
|
||||
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->DisconnectRemoteAbility(connect, 0, 0);
|
||||
EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectRemoteAbility002 end" << std::endl;
|
||||
@ -1119,6 +1217,14 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectRemoteAbility001, TestSize
|
||||
OHOS::AAFwk::Want want;
|
||||
want.SetElementName("123_remote_device_id", "ohos.demo.bundleName", "abilityName");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
/**
|
||||
* @tc.steps: step1. call GetUidLocked
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 start" << std::endl;
|
||||
std::list<ConnectAbilitySession> sessionsList;
|
||||
DistributedSchedService::GetInstance().GetUidLocked(sessionsList);
|
||||
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->ConnectRemoteAbility(want, connect, 0, 0, 0);
|
||||
EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallConnectRemoteAbility001 end" << std::endl;
|
||||
@ -1139,6 +1245,15 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectRemoteAbility002, TestSize
|
||||
}
|
||||
OHOS::AAFwk::Want want;
|
||||
want.SetElementName("123_remote_device_id", "ohos.demo.bundleName", "abilityName");
|
||||
/**
|
||||
* @tc.steps: step1. call DecreaseConnectLocked
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 start" << std::endl;
|
||||
int32_t uid = 1000;
|
||||
AddConnectCount(uid);
|
||||
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->ConnectRemoteAbility(want, nullptr, 0, 0, 0);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallConnectRemoteAbility002 end" << std::endl;
|
||||
@ -1163,6 +1278,14 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectAbilityFromRemote001, Test
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
IDistributedSched::AccountInfo accountInfo;
|
||||
/**
|
||||
* @tc.steps: step1. call DecreaseConnectLocked
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 start" << std::endl;
|
||||
int32_t uid = -1;
|
||||
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->ConnectAbilityFromRemote(want, abilityInfo,
|
||||
connect, callerInfo, accountInfo);
|
||||
EXPECT_EQ(ret, REQUEST_CODE_ERR);
|
||||
@ -1187,6 +1310,15 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallConnectAbilityFromRemote002, Test
|
||||
AppExecFwk::AbilityInfo abilityInfo;
|
||||
CallerInfo callerInfo;
|
||||
IDistributedSched::AccountInfo accountInfo;
|
||||
/**
|
||||
* @tc.steps: step1. call CheckDistributedConnectLocked
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 start" << std::endl;
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.uid = uid;
|
||||
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->ConnectAbilityFromRemote(want, abilityInfo,
|
||||
nullptr, callerInfo, accountInfo);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
@ -1207,6 +1339,17 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectAbilityFromRemote001, T
|
||||
return;
|
||||
}
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
/**
|
||||
* @tc.steps: step1. call CheckDistributedConnectLocked
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 start" << std::endl;
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = uid;
|
||||
AddConnectCount(uid);
|
||||
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->DisconnectAbilityFromRemote(connect, 0, "");
|
||||
EXPECT_EQ(ret, REQUEST_CODE_ERR);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectAbilityFromRemote001 end" << std::endl;
|
||||
@ -1225,18 +1368,9 @@ HWTEST_F(DistributedSchedConnectTest, ProxyCallDisconnectAbilityFromRemote002, T
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
int32_t ret = proxy->DisconnectAbilityFromRemote(nullptr, 0, "");
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectAbilityFromRemote002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RemoteConnectAbilityMappingLocked001
|
||||
* @tc.desc: call RemoteConnectAbilityMappingLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, RemoteConnectAbilityMappingLocked001, TestSize.Level4)
|
||||
{
|
||||
/**
|
||||
* @tc.steps: step1. call RemoteConnectAbilityMappingLocked
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
want.SetElementName("", "ohos.demo.bundleName", "abilityName");
|
||||
@ -1248,77 +1382,10 @@ HWTEST_F(DistributedSchedConnectTest, RemoteConnectAbilityMappingLocked001, Test
|
||||
DistributedSchedService::GetInstance().RemoteConnectAbilityMappingLocked(connect, localDeviceId,
|
||||
remoteDeviceId, want.GetElement(), callerInfo, TargetComponent::HARMONY_COMPONENT);
|
||||
DTEST_LOG << "DistributedSchedConnectTest RemoteConnectAbilityMappingLocked001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CheckDistributedConnectLocked001
|
||||
* @tc.desc: call CheckDistributedConnectLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, CheckDistributedConnectLocked001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 start" << std::endl;
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = uid;
|
||||
AddConnectCount(uid);
|
||||
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CheckDistributedConnectLocked002
|
||||
* @tc.desc: call CheckDistributedConnectLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, CheckDistributedConnectLocked002, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 start" << std::endl;
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = uid;
|
||||
DistributedSchedService::GetInstance().CheckDistributedConnectLocked(callerInfo);
|
||||
DTEST_LOG << "DistributedSchedConnectTest CheckDistributedConnectLocked002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DecreaseConnectLocked001
|
||||
* @tc.desc: call DecreaseConnectLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, DecreaseConnectLocked001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 start" << std::endl;
|
||||
int32_t uid = -1;
|
||||
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DecreaseConnectLocked002
|
||||
* @tc.desc: call DecreaseConnectLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, DecreaseConnectLocked002, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 start" << std::endl;
|
||||
int32_t uid = 1000;
|
||||
AddConnectCount(uid);
|
||||
DistributedSchedService::GetInstance().DecreaseConnectLocked(uid);
|
||||
DTEST_LOG << "DistributedSchedConnectTest DecreaseConnectLocked002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetUidLocked001
|
||||
* @tc.desc: call GetUidLocked
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, GetUidLocked001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 start" << std::endl;
|
||||
std::list<ConnectAbilitySession> sessionsList;
|
||||
DistributedSchedService::GetInstance().GetUidLocked(sessionsList);
|
||||
DTEST_LOG << "DistributedSchedConnectTest GetUidLocked001 end" << std::endl;
|
||||
|
||||
int32_t ret = proxy->DisconnectAbilityFromRemote(nullptr, 0, "");
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallDisconnectAbilityFromRemote002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1404,142 +1471,6 @@ HWTEST_F(DistributedSchedConnectTest, ProcessCallerDied003, TestSize.Level4)
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCallerDied003 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleLocalCallerDied001
|
||||
* @tc.desc: call HandleLocalCallerDied
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, HandleLocalCallerDied001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
|
||||
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: HandleLocalCallerDied002
|
||||
* @tc.desc: call HandleLocalCallerDied
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, HandleLocalCallerDied002, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 start" << std::endl;
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
|
||||
DistributedSchedService::GetInstance().HandleLocalCallerDied(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest HandleLocalCallerDied002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ProcessCalleeDied001
|
||||
* @tc.desc: call ProcessCalleeDied
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, ProcessCalleeDied001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 start" << std::endl;
|
||||
DistributedSchedService::GetInstance().ProcessCalleeDied(nullptr);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ProcessCalleeDied002
|
||||
* @tc.desc: call ProcessCalleeDied
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, ProcessCalleeDied002, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 start" << std::endl;
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
sptr<IRemoteObject> callbackWrapper = new AbilityConnectionWrapperStubTest(connect);
|
||||
CallerInfo callerInfo;
|
||||
ConnectInfo connectInfo {callerInfo, callbackWrapper};
|
||||
DistributedSchedService::GetInstance().calleeMap_.emplace(connect, connectInfo);
|
||||
DistributedSchedService::GetInstance().ProcessCalleeDied(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProcessCalleeDied002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SaveCallerComponent001
|
||||
* @tc.desc: call SaveCallerComponent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, SaveCallerComponent001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SaveCallerComponent002
|
||||
* @tc.desc: call SaveCallerComponent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, SaveCallerComponent002, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 start" << std::endl;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
OHOS::AAFwk::Want want1;
|
||||
want1.SetElementName(remoteDeviceId, "ohos.demo.bundleName1", "abilityName1");
|
||||
OHOS::AAFwk::Want want2;
|
||||
want2.SetElementName(remoteDeviceId, "ohos.demo.bundleName2", "abilityName2");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want1, connect, callerInfo);
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want2, connect, callerInfo);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SaveCallerComponent002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RemoveCallerComponent001
|
||||
* @tc.desc: call RemoveCallerComponent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedConnectTest, RemoveCallerComponent001, TestSize.Level4)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 start" << std::endl;
|
||||
OHOS::AAFwk::Want want;
|
||||
std::string localDeviceId = "123_local_device_id";
|
||||
std::string remoteDeviceId = "123_remote_device_id";
|
||||
want.SetElementName(remoteDeviceId, "ohos.demo.bundleName", "abilityName");
|
||||
sptr<AbilityConnectCallbackTest> connect = new AbilityConnectCallbackTest();
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.uid = IPCSkeleton::GetCallingUid();
|
||||
callerInfo.pid = IPCSkeleton::GetCallingPid();
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
callerInfo.callerType = CALLER_TYPE_HARMONY;
|
||||
DistributedSchedService::GetInstance().SaveCallerComponent(want, connect, callerInfo);
|
||||
DistributedSchedService::GetInstance().RemoveCallerComponent(connect);
|
||||
DTEST_LOG << "DistributedSchedServiceTest RemoveCallerComponent001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: AbilityConnectionWrapperStub001
|
||||
* @tc.desc: receive connect message
|
||||
|
@ -35,6 +35,8 @@ constexpr int32_t MOCK_SESSION_ID = 123;
|
||||
constexpr int32_t MOCK_TASK_ID = 456;
|
||||
const std::string LOCAL_DEVICE_ID = "192.168.43.100";
|
||||
constexpr int32_t SLEEP_TIME = 1000;
|
||||
constexpr int64_t FREE_INSTALL_TIMEOUT = 50000;
|
||||
constexpr int32_t REQUEST_CODE_ERR = 305;
|
||||
}
|
||||
|
||||
void DSchedContinuationTest::SetUpTestCase()
|
||||
@ -95,6 +97,30 @@ std::shared_ptr<Want> DSchedContinuationTest::MockWant(const std::string& bundle
|
||||
return spWant;
|
||||
}
|
||||
|
||||
void DSchedContinuationTest::MockOnStart()
|
||||
{
|
||||
DTEST_LOG << "mock on start" << std::endl;
|
||||
if (!DistributedSchedService::GetInstance().Init()) {
|
||||
DTEST_LOG << "init failed" << std::endl;
|
||||
return;
|
||||
}
|
||||
FuncContinuationCallback continuationCallback = [this] (int32_t missionId) {
|
||||
DistributedSchedService::GetInstance().
|
||||
NotifyContinuationCallbackResult(missionId, CONTINUE_ABILITY_TIMEOUT_ERR);
|
||||
};
|
||||
|
||||
DmsCallbackTaskInitCallbackFunc freeCallback = [this] (int64_t taskId) {
|
||||
DistributedSchedService::GetInstance().
|
||||
NotifyCompleteFreeInstallFromRemote(taskId, FREE_INSTALL_TIMEOUT);
|
||||
};
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ =
|
||||
std::make_shared<DSchedContinuation>();
|
||||
DistributedSchedService::GetInstance().dmsCallbackTask_ =
|
||||
std::make_shared<DmsCallbackTask>();
|
||||
DistributedSchedService::GetInstance().dschedContinuation_->Init(continuationCallback);
|
||||
DistributedSchedService::GetInstance().dmsCallbackTask_->Init(freeCallback);
|
||||
}
|
||||
|
||||
sptr<IDistributedSched> DSchedContinuationTest::GetDms()
|
||||
{
|
||||
if (proxy_ != nullptr) {
|
||||
@ -375,7 +401,7 @@ HWTEST_F(DSchedContinuationTest, ContinueLocalMission_002, TestSize.Level1)
|
||||
int32_t missionId = 0;
|
||||
auto callback = GetDSchedService();
|
||||
WantParams wantParams;
|
||||
DistributedSchedService::GetInstance().OnStart();
|
||||
MockOnStart();
|
||||
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -1290,14 +1316,12 @@ HWTEST_F(DSchedContinuationTest, ProxyCallContinueMission001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallContinueMission001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
std::string srcDeviceId;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(srcDeviceId);
|
||||
WantParams wantParams;
|
||||
int32_t ret = proxy->ContinueMission(srcDeviceId, "MockdevId", 0, GetDSchedService(), wantParams);
|
||||
EXPECT_EQ(ret, MISSION_FOR_CONTINUING_IS_NOT_ALIVE);
|
||||
EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallContinueMission001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1311,14 +1335,12 @@ HWTEST_F(DSchedContinuationTest, ProxyCallContinueMission002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallContinueMission002 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
std::string srcDeviceId;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(srcDeviceId);
|
||||
WantParams wantParams;
|
||||
int32_t ret = proxy->ContinueMission(srcDeviceId, "MockdevId", 0, nullptr, wantParams);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallContinueMission002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1332,13 +1354,11 @@ HWTEST_F(DSchedContinuationTest, ProxyCallStartContinuation001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartContinuation001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
OHOS::AAFwk::Want want;
|
||||
want.SetElementName("123_remote_device_id", "ohos.demo.bundleName", "abilityName");
|
||||
int32_t ret = proxy->StartContinuation(want, 0, 0, 0, 0);
|
||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartContinuation001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1352,14 +1372,12 @@ HWTEST_F(DSchedContinuationTest, ProxyCallNotifyContinuationResultFromRemote001,
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallNotifyContinuationResultFromRemote001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
std::string srcDeviceId;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(srcDeviceId);
|
||||
proxy->NotifyCompleteContinuation(Str8ToStr16(srcDeviceId), 0, true);
|
||||
int32_t ret = proxy->NotifyContinuationResultFromRemote(0, true);
|
||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, REQUEST_CODE_ERR);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallNotifyContinuationResultFromRemote001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1395,14 +1413,12 @@ HWTEST_F(DSchedContinuationTest, ProxyCallStartRemoteAbilityByCall001, TestSize.
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartRemoteAbilityByCall001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
std::string bundleName = "bundleName";
|
||||
std::string abilityName = "abilityName";
|
||||
std::shared_ptr<Want> spWant = MockWant(bundleName, abilityName, 0);
|
||||
int32_t ret = proxy->StartRemoteAbilityByCall(*spWant, nullptr, 0, 0, 1);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartRemoteAbilityByCall001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1437,13 +1453,11 @@ HWTEST_F(DSchedContinuationTest, ProxyCallReleaseRemoteAbility001, TestSize.Leve
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallReleaseRemoteAbility001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
AppExecFwk::ElementName element("", "com.ohos.distributedmusicplayer",
|
||||
"com.ohos.distributedmusicplayer.MainAbility");
|
||||
int32_t ret = proxy->ReleaseRemoteAbility(nullptr, element);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallReleaseRemoteAbility001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1477,9 +1491,7 @@ HWTEST_F(DSchedContinuationTest, ProxyCallStartAbilityByCallFromRemote001, TestS
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallReleaseRemoteAbility001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
// mock want
|
||||
std::string bundleName = "bundleName";
|
||||
std::string abilityName = "abilityName";
|
||||
@ -1495,7 +1507,7 @@ HWTEST_F(DSchedContinuationTest, ProxyCallStartAbilityByCallFromRemote001, TestS
|
||||
accountInfo.groupIdList.push_back("123456");
|
||||
|
||||
int32_t ret = proxy->StartAbilityByCallFromRemote(*spWant, nullptr, callerInfo, accountInfo);
|
||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallReleaseRemoteAbility001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1541,9 +1553,7 @@ HWTEST_F(DSchedContinuationTest, ProxyCallReleaseAbilityFromRemote001, TestSize.
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallReleaseAbilityFromRemote001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
// mock callerinfo
|
||||
CallerInfo callerInfo;
|
||||
callerInfo.sourceDeviceId = "255.255.255.255";
|
||||
@ -1553,7 +1563,7 @@ HWTEST_F(DSchedContinuationTest, ProxyCallReleaseAbilityFromRemote001, TestSize.
|
||||
AppExecFwk::ElementName element("", "com.ohos.distributedmusicplayer",
|
||||
"com.ohos.distributedmusicplayer.MainAbility");
|
||||
int32_t ret = proxy->ReleaseAbilityFromRemote(nullptr, element, callerInfo);
|
||||
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallReleaseAbilityFromRemote001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1616,16 +1626,14 @@ HWTEST_F(DSchedContinuationTest, ProxyCallStartRemoteFreeInstall002, TestSize.Le
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartRemoteFreeInstall002 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
// mock want
|
||||
std::string bundleName = "bundleName";
|
||||
std::string abilityName = "abilityName";
|
||||
std::shared_ptr<Want> spWant = MockWant(bundleName, abilityName, 0);
|
||||
|
||||
int32_t ret = proxy->StartRemoteFreeInstall(*spWant, 0, 1, 1, nullptr);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
EXPECT_EQ(ret, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartRemoteFreeInstall002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1677,12 +1685,10 @@ HWTEST_F(DSchedContinuationTest, ProxyCallStartShareFormFromRemote001, TestSize.
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartShareFormFromRemote001 start" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(proxy, nullptr);
|
||||
const OHOS::AppExecFwk::FormShareInfo formShareInfo {};
|
||||
int32_t ret = proxy->StartShareFormFromRemote("", formShareInfo);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DistributedSchedServiceTest ProxyCallStartShareFormFromRemote001 end" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ class DSchedContinuationTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void MockOnStart();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
sptr<IDistributedSched> GetDms();
|
||||
|
@ -192,6 +192,23 @@ HWTEST_F(DistributedSchedDumperTest, Dump_008, TestSize.Level3)
|
||||
DTEST_LOG << "DistributedSchedDumperTest Dump_008 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Dump_009
|
||||
* @tc.desc: dump info with 0 arg
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I6ONQ3
|
||||
*/
|
||||
HWTEST_F(DistributedSchedDumperTest, Dump_009, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedDumperTest Dump_009 begin" << std::endl;
|
||||
DistributedSchedUtil::MockProcess(HIDUMPER_PROCESS_NAME);
|
||||
const std::vector<std::string> args = {};
|
||||
std::string result = "";
|
||||
bool res = DistributedSchedDumper::Dump(args, result);
|
||||
EXPECT_TRUE(res);
|
||||
DTEST_LOG << "DistributedSchedDumperTest Dump_009 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CanDump_001
|
||||
* @tc.desc: CanDump
|
||||
|
@ -849,6 +849,17 @@ HWTEST_F(DistributedSchedServiceTest, StartShareFormFromRemote_002, TestSize.Lev
|
||||
DTEST_LOG << "DistributedSchedServiceTest StartShareFormFromRemote_002 start" << std::endl;
|
||||
std::string remoteDeviceId = "123456";
|
||||
const OHOS::AppExecFwk::FormShareInfo formShareInfo {};
|
||||
/**
|
||||
* @tc.steps: step1. call GetContinuaitonDevice
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 start" << std::endl;
|
||||
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
}
|
||||
int32_t missionId = MISSION_ID;
|
||||
(void)DistributedSchedService::GetInstance().GetContinuaitonDevice(missionId);
|
||||
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 end" << std::endl;
|
||||
|
||||
auto result = DistributedSchedService::GetInstance().StartShareFormFromRemote(remoteDeviceId, formShareInfo);
|
||||
DTEST_LOG << "result:" << result << std::endl;
|
||||
EXPECT_EQ(static_cast<int>(INVALID_REMOTE_PARAMETERS_ERR), result);
|
||||
@ -906,19 +917,9 @@ HWTEST_F(DistributedSchedServiceTest, SendResultFromRemote_006, TestSize.Level1)
|
||||
callerInfo.uid = 0;
|
||||
callerInfo.sourceDeviceId = LOCAL_DEVICEID;
|
||||
IDistributedSched::AccountInfo accountInfo;
|
||||
int result = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
|
||||
DTEST_LOG << "result:" << result << std::endl;
|
||||
EXPECT_EQ(static_cast<int>(INVALID_PARAMETERS_ERR), result);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SendResultFromRemote_006 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RemoveContinuationTimeout_001
|
||||
* @tc.desc: call RemoveContinuationTimeout
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedServiceTest, RemoveContinuationTimeout_001, TestSize.Level1)
|
||||
{
|
||||
/**
|
||||
* @tc.steps: step1. call RemoveContinuationTimeout
|
||||
*/
|
||||
DTEST_LOG << "DistributedSchedServiceTest RemoveContinuationTimeout_001 start" << std::endl;
|
||||
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
@ -926,6 +927,11 @@ HWTEST_F(DistributedSchedServiceTest, RemoveContinuationTimeout_001, TestSize.Le
|
||||
int32_t missionId = MISSION_ID;
|
||||
DistributedSchedService::GetInstance().RemoveContinuationTimeout(missionId);
|
||||
DTEST_LOG << "DistributedSchedServiceTest RemoveContinuationTimeout_001 end" << std::endl;
|
||||
|
||||
int result = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
|
||||
DTEST_LOG << "result:" << result << std::endl;
|
||||
EXPECT_EQ(static_cast<int>(INVALID_PARAMETERS_ERR), result);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SendResultFromRemote_006 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -945,22 +951,6 @@ HWTEST_F(DistributedSchedServiceTest, SetContinuationTimeout_001, TestSize.Level
|
||||
DTEST_LOG << "DistributedSchedServiceTest SetContinuationTimeout_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetContinuaitonDevice_001
|
||||
* @tc.desc: call GetContinuaitonDevice
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedServiceTest, GetContinuaitonDevice_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 start" << std::endl;
|
||||
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
}
|
||||
int32_t missionId = MISSION_ID;
|
||||
(void)DistributedSchedService::GetInstance().GetContinuaitonDevice(missionId);
|
||||
DTEST_LOG << "DistributedSchedServiceTest GetContinuaitonDevice_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ContinueMission_001
|
||||
* @tc.desc: call ContinueMission
|
||||
@ -1220,6 +1210,15 @@ HWTEST_F(DistributedSchedServiceTest, StartContinuation_007, TestSize.Level3)
|
||||
int32_t status = ERR_OK;
|
||||
uint32_t accessToken = 0;
|
||||
bool isSuccess = false;
|
||||
/**
|
||||
* @tc.steps: step1. call GetFormMgrProxy
|
||||
*/
|
||||
#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
|
||||
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 start" << std::endl;
|
||||
DistributedSchedService::GetInstance().GetFormMgrProxy();
|
||||
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 end" << std::endl;
|
||||
#endif
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().StartContinuation(
|
||||
want, missionId, callerUid, status, accessToken);
|
||||
DistributedSchedService::GetInstance().NotifyCompleteContinuation(DEVICE_ID_NULL, SESSION_ID, isSuccess);
|
||||
@ -1274,20 +1273,6 @@ HWTEST_F(DistributedSchedServiceTest, NotifyContinuationCallbackResult_002, Test
|
||||
DTEST_LOG << "DSchedContinuationTest NotifyContinuationCallbackResult_002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetFormMgrProxy_001
|
||||
* @tc.desc: call GetFormMgrProxy
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
|
||||
HWTEST_F(DistributedSchedServiceTest, GetFormMgrProxy_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 start" << std::endl;
|
||||
DistributedSchedService::GetInstance().GetFormMgrProxy();
|
||||
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 end" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @tc.name: StartAbilityFromRemote_007
|
||||
* @tc.desc: test StartAbilityFromRemote
|
||||
@ -1418,7 +1403,7 @@ HWTEST_F(DistributedSchedServiceTest, SendResultFromRemote_010, TestSize.Level3)
|
||||
callerInfo.sourceDeviceId = localDeviceId;
|
||||
IDistributedSched::AccountInfo accountInfo;
|
||||
accountInfo.accountType = IDistributedSched::SAME_ACCOUNT_TYPE;
|
||||
int ret = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
|
||||
int32_t ret = DistributedSchedService::GetInstance().SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedServiceTest SendResultFromRemote_010 end" << std::endl;
|
||||
}
|
||||
|
@ -37,6 +37,9 @@ constexpr uint8_t ONE_BYTE = '6';
|
||||
void DistributedDataStorageTest::SetUpTestCase()
|
||||
{
|
||||
DTEST_LOG << "DistributedDataStorageTest::SetUpTestCase" << std::endl;
|
||||
if (!DistributedSchedUtil::LoadDistributedSchedService()) {
|
||||
DTEST_LOG << "DMSMissionManagerTest::SetUpTestCase LoadDistributedSchedService failed" << std::endl;
|
||||
}
|
||||
const std::string pkgName = "DBinderBus_" + std::to_string(getpid());
|
||||
std::shared_ptr<DmInitCallback> initCallback_ = std::make_shared<DeviceInitCallBack>();
|
||||
DeviceManager::GetInstance().InitDeviceManager(pkgName, initCallback_);
|
||||
|
@ -1044,19 +1044,6 @@ HWTEST_F(DMSMissionManagerTest, testFetchCachedRemoteMissions009, TestSize.Level
|
||||
DTEST_LOG << "testFetchCachedRemoteMissions009 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testNotifyRemoteDied001
|
||||
* @tc.desc: test notify remote died
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testNotifyRemoteDied001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testNotifyRemoteDied001 begin" << std::endl;
|
||||
wptr<IRemoteObject> remote = nullptr;
|
||||
DistributedSchedMissionManager::GetInstance().NotifyRemoteDied(remote);
|
||||
DTEST_LOG << "testNotifyRemoteDied001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testStopDataStorage001
|
||||
* @tc.desc: test stop data storage
|
||||
@ -1162,30 +1149,6 @@ HWTEST_F(DMSMissionManagerTest, testGetRemoteMissionSnapshotInfo001, TestSize.Le
|
||||
DTEST_LOG << "testGetRemoteMissionSnapshotInfo001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeviceOnlineNotify001
|
||||
* @tc.desc: test device online notify
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeviceOnlineNotify001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeviceOnlineNotify001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify("");
|
||||
DTEST_LOG << "testDeviceOnlineNotify001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeviceOnlineNotify002
|
||||
* @tc.desc: test device online notify
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeviceOnlineNotify002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeviceOnlineNotify002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify(DEVICE_ID);
|
||||
DTEST_LOG << "testDeviceOnlineNotify002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeviceOnlineNotify003
|
||||
* @tc.desc: test device online notify
|
||||
@ -1224,54 +1187,6 @@ HWTEST_F(DMSMissionManagerTest, testDeviceOfflineNotify002, TestSize.Level3)
|
||||
DTEST_LOG << "testDeviceOfflineNotify002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeleteDataStorage001
|
||||
* @tc.desc: test delete data storage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeleteDataStorage001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", false);
|
||||
DTEST_LOG << "testDeleteDataStorage001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeleteDataStorage002
|
||||
* @tc.desc: test delete data storage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeleteDataStorage002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, false);
|
||||
DTEST_LOG << "testDeleteDataStorage002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeleteDataStorage003
|
||||
* @tc.desc: test delete data storage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeleteDataStorage003 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", true);
|
||||
DTEST_LOG << "testDeleteDataStorage003 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeleteDataStorage004
|
||||
* @tc.desc: test delete data storage
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeleteDataStorage004, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeleteDataStorage004 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, true);
|
||||
DTEST_LOG << "testDeleteDataStorage004 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testNotifySnapshotChanged001
|
||||
* @tc.desc: test notify snapshot changed
|
||||
@ -1357,93 +1272,6 @@ HWTEST_F(DMSMissionManagerTest, testStopSyncMissionsFromRemote002, TestSize.Leve
|
||||
DTEST_LOG << "testStopSyncMissionsFromRemote002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testEnqueueCachedSnapshotInfo001
|
||||
* @tc.desc: enqueue cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testEnqueueCachedSnapshotInfo001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, nullptr);
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testEnqueueCachedSnapshotInfo002
|
||||
* @tc.desc: enqueue cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testEnqueueCachedSnapshotInfo002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo(DEVICE_ID, 1, nullptr);
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testEnqueueCachedSnapshotInfo003
|
||||
* @tc.desc: enqueue cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testEnqueueCachedSnapshotInfo003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 begin" << std::endl;
|
||||
unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
|
||||
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, std::move(snapshot));
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDequeueCachedSnapshotInfo001
|
||||
* @tc.desc: enqueue cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDequeueCachedSnapshotInfo001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo("", 1);
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDequeueCachedSnapshotInfo002
|
||||
* @tc.desc: enqueue cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDequeueCachedSnapshotInfo002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo(DEVICE_ID, 1);
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRebornMissionCache001
|
||||
* @tc.desc: reborn mission cache
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testRebornMissionCache001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testRebornMissionCache001 begin" << std::endl;
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
DistributedSchedMissionManager::GetInstance().RebornMissionCache("", missionInfos);
|
||||
DTEST_LOG << "testRebornMissionCache001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRebornMissionCache002
|
||||
* @tc.desc: reborn mission cache
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testRebornMissionCache002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testRebornMissionCache002 begin" << std::endl;
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
|
||||
DTEST_LOG << "testRebornMissionCache002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testNotifyMissionsChangedFromRemote001
|
||||
* @tc.desc: notify missions changed from remote
|
||||
@ -1579,30 +1407,6 @@ HWTEST_F(DMSMissionManagerTest, testNotifyMissionsChangedToRemoteInner002, TestS
|
||||
DTEST_LOG << "testNotifyMissionsChangedToRemoteInner002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testFetchDeviceHandler001
|
||||
* @tc.desc: fetch device handler
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testFetchDeviceHandler001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testFetchDeviceHandler001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler("");
|
||||
DTEST_LOG << "testFetchDeviceHandler001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testFetchDeviceHandler002
|
||||
* @tc.desc: fetch device handler
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testFetchDeviceHandler002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testFetchDeviceHandler002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler(DEVICE_ID);
|
||||
DTEST_LOG << "testFetchDeviceHandler002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testOnRemoteDmsDied001
|
||||
* @tc.desc: on remote dms died
|
||||
@ -2009,52 +1813,6 @@ HWTEST_F(DMSMissionManagerTest, testRegisterMissionListener010, TestSize.Level3)
|
||||
DTEST_LOG << "testRegisterMissionListener010 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testGetRemoteDms001
|
||||
* @tc.desc: test GetRemoteDms
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testGetRemoteDms001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "testGetRemoteDms001 begin" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = proxy;
|
||||
}
|
||||
|
||||
auto ret = DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
|
||||
DTEST_LOG << "testGetRemoteDms001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testGetRemoteDms002
|
||||
* @tc.desc: test GetRemoteDms
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testGetRemoteDms002, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "testGetRemoteDms002 begin" << std::endl;
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = nullptr;
|
||||
}
|
||||
|
||||
auto ret = DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
|
||||
DTEST_LOG << "testGetRemoteDms002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testIsDeviceIdValidated002
|
||||
* @tc.desc: test IsDeviceIdValidated
|
||||
@ -2168,23 +1926,6 @@ HWTEST_F(DMSMissionManagerTest, testGetMissionInfos009, TestSize.Level3)
|
||||
DTEST_LOG << "testGetMissionInfos009 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testNotifyRemoteDied002
|
||||
* @tc.desc: test notify remote died
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testNotifyRemoteDied002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testNotifyRemoteDied002 begin" << std::endl;
|
||||
wptr<IRemoteObject> remote = new RemoteMissionListenerTest();
|
||||
if (DistributedSchedMissionManager::GetInstance().distributedDataStorage_ == nullptr) {
|
||||
DistributedSchedMissionManager::GetInstance().distributedDataStorage_ =
|
||||
std::make_shared<DistributedDataStorage>();
|
||||
}
|
||||
DistributedSchedMissionManager::GetInstance().NotifyRemoteDied(remote);
|
||||
DTEST_LOG << "testNotifyRemoteDied002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testInitDataStorage003
|
||||
* @tc.desc: test init data storage
|
||||
@ -2510,6 +2251,14 @@ HWTEST_F(DMSMissionManagerTest, testStartSyncRemoteMissions016, TestSize.Level3)
|
||||
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener006, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testUnRegisterMissionListener006 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. test device online notify
|
||||
*/
|
||||
DTEST_LOG << "testDeviceOnlineNotify001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify("");
|
||||
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify(DEVICE_ID);
|
||||
DTEST_LOG << "testDeviceOnlineNotify001 end" << std::endl;
|
||||
|
||||
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
@ -2528,6 +2277,22 @@ HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener006, TestSize.Level
|
||||
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener007, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testUnRegisterMissionListener007 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. test delete data storage
|
||||
*/
|
||||
DTEST_LOG << "testDeleteDataStorage001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", false);
|
||||
DTEST_LOG << "testDeleteDataStorage001 end" << std::endl;
|
||||
DTEST_LOG << "testDeleteDataStorage002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, false);
|
||||
DTEST_LOG << "testDeleteDataStorage002 end" << std::endl;
|
||||
DTEST_LOG << "testDeleteDataStorage003 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage("", true);
|
||||
DTEST_LOG << "testDeleteDataStorage003 end" << std::endl;
|
||||
DTEST_LOG << "testDeleteDataStorage004 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DeleteDataStorage(DEVICE_ID, true);
|
||||
DTEST_LOG << "testDeleteDataStorage004 end" << std::endl;
|
||||
|
||||
u16string deviceId = Str8ToStr16(DEVICE_ID);
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
@ -2547,6 +2312,36 @@ HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener007, TestSize.Level
|
||||
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener008, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testUnRegisterMissionListener008 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. enqueue cached snapshot info
|
||||
*/
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, nullptr);
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo001 end" << std::endl;
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo(DEVICE_ID, 1, nullptr);
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo002 end" << std::endl;
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 begin" << std::endl;
|
||||
unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
|
||||
DistributedSchedMissionManager::GetInstance().EnqueueCachedSnapshotInfo("", 1, std::move(snapshot));
|
||||
DTEST_LOG << "testEnqueueCachedSnapshotInfo003 end" << std::endl;
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo("", 1);
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo001 end" << std::endl;
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo(DEVICE_ID, 1);
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo002 end" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step2. reborn mission cache
|
||||
*/
|
||||
DTEST_LOG << "testRebornMissionCache001 begin" << std::endl;
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
DistributedSchedMissionManager::GetInstance().RebornMissionCache("", missionInfos);
|
||||
DTEST_LOG << "testRebornMissionCache001 end" << std::endl;
|
||||
DTEST_LOG << "testRebornMissionCache002 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
|
||||
DTEST_LOG << "testRebornMissionCache002 end" << std::endl;
|
||||
|
||||
u16string deviceId = Str8ToStr16(DEVICE_ID);
|
||||
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
|
||||
{
|
||||
@ -2572,6 +2367,14 @@ HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener008, TestSize.Level
|
||||
HWTEST_F(DMSMissionManagerTest, testUnRegisterMissionListener009, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testUnRegisterMissionListener009 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. fetch device handler
|
||||
*/
|
||||
DTEST_LOG << "testFetchDeviceHandler001 begin" << std::endl;
|
||||
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler("");
|
||||
DistributedSchedMissionManager::GetInstance().FetchDeviceHandler(DEVICE_ID);
|
||||
DTEST_LOG << "testFetchDeviceHandler001 end" << std::endl;
|
||||
|
||||
u16string deviceId = Str8ToStr16(DEVICE_ID);
|
||||
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
|
||||
sptr<IRemoteObject> nullListener = nullptr;
|
||||
@ -2623,10 +2426,26 @@ HWTEST_F(DMSMissionManagerTest, testCleanMissionResources002, TestSize.Level3)
|
||||
HWTEST_F(DMSMissionManagerTest, testStopSyncRemoteMissions013, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testStopSyncRemoteMissions013 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. test GetRemoteDms
|
||||
*/
|
||||
DTEST_LOG << "testGetRemoteDms001 begin" << std::endl;
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = proxy;
|
||||
}
|
||||
|
||||
DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
|
||||
DTEST_LOG << "testGetRemoteDms001 end" << std::endl;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
|
||||
@ -2648,6 +2467,22 @@ HWTEST_F(DMSMissionManagerTest, testStopSyncRemoteMissions013, TestSize.Level3)
|
||||
HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testStartSyncMissionsFromRemote002 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. test GetRemoteDms
|
||||
*/
|
||||
DTEST_LOG << "testGetRemoteDms002 begin" << std::endl;
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteDmsLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteDmsMap_[localDeviceId_] = nullptr;
|
||||
}
|
||||
|
||||
DistributedSchedMissionManager::GetInstance().GetRemoteDms(localDeviceId_);
|
||||
DTEST_LOG << "testGetRemoteDms002 end" << std::endl;
|
||||
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
CallerInfo callerInfo;
|
||||
auto runner = AppExecFwk::EventRunner::Create("MissionManagerHandler");
|
||||
@ -2668,6 +2503,18 @@ HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote002, TestSize.Lev
|
||||
HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testStartSyncMissionsFromRemote003 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. test notify remote died
|
||||
*/
|
||||
DTEST_LOG << "testNotifyRemoteDied002 begin" << std::endl;
|
||||
wptr<IRemoteObject> remote = new RemoteMissionListenerTest();
|
||||
if (DistributedSchedMissionManager::GetInstance().distributedDataStorage_ == nullptr) {
|
||||
DistributedSchedMissionManager::GetInstance().distributedDataStorage_ =
|
||||
std::make_shared<DistributedDataStorage>();
|
||||
}
|
||||
DistributedSchedMissionManager::GetInstance().NotifyRemoteDied(remote);
|
||||
DTEST_LOG << "testNotifyRemoteDied002 end" << std::endl;
|
||||
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
CallerInfo callerInfo;
|
||||
auto runner = AppExecFwk::EventRunner::Create("MissionManagerHandler");
|
||||
@ -2704,6 +2551,32 @@ HWTEST_F(DMSMissionManagerTest, testStopSyncMissionsFromRemote003, TestSize.Leve
|
||||
HWTEST_F(DMSMissionManagerTest, testNeedSyncDevice003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testNeedSyncDevice003 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. delete cached snapshot info
|
||||
*/
|
||||
DTEST_LOG << "testDeleteCachedSnapshotInfo001 begin" << std::endl;
|
||||
std::string uuid = "uuid for GetUuidByNetworkId";
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
|
||||
}
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
|
||||
}
|
||||
std::unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
|
||||
std::string key = DistributedSchedMissionManager::GetInstance().GenerateKeyInfo(DEVICE_ID, 1);
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_[key] = std::move(snapshot);
|
||||
}
|
||||
DistributedSchedMissionManager::GetInstance().DeleteCachedSnapshotInfo(DEVICE_ID);
|
||||
DTEST_LOG << "testDeleteCachedSnapshotInfo001 end" << std::endl;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().remoteSyncDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().remoteSyncDeviceSet_.clear();
|
||||
@ -2725,6 +2598,23 @@ HWTEST_F(DMSMissionManagerTest, testNeedSyncDevice003, TestSize.Level3)
|
||||
HWTEST_F(DMSMissionManagerTest, testHasSyncListener002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testHasSyncListener002 begin" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. reborn mission cache
|
||||
*/
|
||||
DTEST_LOG << "testRebornMissionCache003 begin" << std::endl;
|
||||
std::string uuid = "uuid for GetUuidByNetworkId";
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
|
||||
}
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
|
||||
}
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
|
||||
DTEST_LOG << "testRebornMissionCache003 end" << std::endl;
|
||||
|
||||
u16string deviceId = Str8ToStr16(DEVICE_ID);
|
||||
sptr<IRemoteObject> listener = new RemoteMissionListenerTest();
|
||||
{
|
||||
@ -2829,67 +2719,6 @@ HWTEST_F(DMSMissionManagerTest, testDequeueCachedSnapshotInfo003, TestSize.Level
|
||||
DTEST_LOG << "testDequeueCachedSnapshotInfo003 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeleteCachedSnapshotInfo001
|
||||
* @tc.desc: delete cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeleteCachedSnapshotInfo001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeleteCachedSnapshotInfo001 begin" << std::endl;
|
||||
std::string uuid = "uuid for GetUuidByNetworkId";
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
|
||||
}
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
|
||||
}
|
||||
std::unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
|
||||
std::string key = DistributedSchedMissionManager::GetInstance().GenerateKeyInfo(DEVICE_ID, 1);
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_[key] = std::move(snapshot);
|
||||
}
|
||||
DistributedSchedMissionManager::GetInstance().DeleteCachedSnapshotInfo(DEVICE_ID);
|
||||
DTEST_LOG << "testDeleteCachedSnapshotInfo001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testDeleteCachedSnapshotInfo002
|
||||
* @tc.desc: delete cached snapshot info
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testDeleteCachedSnapshotInfo002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testDeleteCachedSnapshotInfo002 begin" << std::endl;
|
||||
std::string uuid = "uuid for GetUuidByNetworkId";
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
|
||||
}
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
|
||||
}
|
||||
std::unique_ptr<Snapshot> snapshot = make_unique<Snapshot>();
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_.clear();
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(DistributedSchedMissionManager::GetInstance().listenDeviceLock_);
|
||||
DistributedSchedMissionManager::GetInstance().cachedSnapshotInfos_[uuid] = std::move(snapshot);
|
||||
}
|
||||
DistributedSchedMissionManager::GetInstance().DeleteCachedSnapshotInfo(DEVICE_ID);
|
||||
DTEST_LOG << "testDeleteCachedSnapshotInfo002 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testFetchCachedRemoteMissions010
|
||||
* @tc.desc: test FetchCachedRemoteMissions
|
||||
@ -2922,28 +2751,6 @@ HWTEST_F(DMSMissionManagerTest, testFetchCachedRemoteMissions010, TestSize.Level
|
||||
DTEST_LOG << "testFetchCachedRemoteMissions010 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRebornMissionCache003
|
||||
* @tc.desc: reborn mission cache
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSMissionManagerTest, testRebornMissionCache003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "testRebornMissionCache003 begin" << std::endl;
|
||||
std::string uuid = "uuid for GetUuidByNetworkId";
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_.clear();
|
||||
}
|
||||
{
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
|
||||
}
|
||||
std::vector<DstbMissionInfo> missionInfos;
|
||||
DistributedSchedMissionManager::GetInstance().RebornMissionCache(DEVICE_ID, missionInfos);
|
||||
DTEST_LOG << "testRebornMissionCache003 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testNotifyMissionsChangedFromRemote003
|
||||
* @tc.desc: notify missions changed from remote
|
||||
|
Loading…
Reference in New Issue
Block a user