mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
commit
e43600568a
@ -1617,5 +1617,104 @@ HWTEST_F(DistributedSchedServiceSecondTest, NotifyDSchedEventResultFromRemote_00
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest NotifyDSchedEventResultFromRemote_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ContinueLocalMission_001
|
||||
* @tc.desc: ContinueLocalMission
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedServiceSecondTest, ContinueLocalMission_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest ContinueLocalMission_001 start" << std::endl;
|
||||
std::string dstDeviceId;
|
||||
int32_t missionId = 0;
|
||||
OHOS::AAFwk::WantParams wantParams;
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = nullptr;
|
||||
int32_t ret = DistributedSchedService::GetInstance().ContinueLocalMission(
|
||||
dstDeviceId, missionId, nullptr, wantParams);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
ret = DistributedSchedService::GetInstance().ContinueAbilityWithTimeout(
|
||||
dstDeviceId, missionId, nullptr, 0);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
DistributedSchedService::GetInstance().NotifyDSchedEventCallbackResult(FOREGROUND);
|
||||
|
||||
ret = DistributedSchedService::GetInstance().NotifyContinuationResultFromRemote(
|
||||
FOREGROUND, true, dstDeviceId);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest ContinueLocalMission_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetContinueInfo_001
|
||||
* @tc.desc: GetContinueInfo
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedServiceSecondTest, GetContinueInfo_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest GetContinueInfo_001 start" << std::endl;
|
||||
std::string dstNetworkId;
|
||||
std::string srcNetworkId;
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = nullptr;
|
||||
int32_t ret = DistributedSchedService::GetInstance().GetContinueInfo(dstNetworkId, srcNetworkId);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
ret = DistributedSchedService::GetInstance().GetContinueInfo(dstNetworkId, srcNetworkId);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest GetContinueInfo_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetDSchedEventInfo_001
|
||||
* @tc.desc: GetDSchedEventInfo
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedServiceSecondTest, GetDSchedEventInfo_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest GetDSchedEventInfo_001 start" << std::endl;
|
||||
std::vector<EventNotify> events;
|
||||
int32_t ret = DistributedSchedService::GetInstance().GetDSchedEventInfo(DMS_CONTINUE, events);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
ret = DistributedSchedService::GetInstance().GetDSchedEventInfo(DMS_ALL, events);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest GetDSchedEventInfo_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RegisterDSchedEventListener_001
|
||||
* @tc.desc: RegisterDSchedEventListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedServiceSecondTest, RegisterDSchedEventListener_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest RegisterDSchedEventListener_001 start" << std::endl;
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = nullptr;
|
||||
DistributedSchedService::GetInstance().collaborateCbMgr_ = nullptr;
|
||||
int32_t ret = DistributedSchedService::GetInstance().RegisterDSchedEventListener(DMS_CONTINUE, nullptr);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
ret = DistributedSchedService::GetInstance().UnRegisterDSchedEventListener(DMS_CONTINUE, nullptr);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
ret = DistributedSchedService::GetInstance().RegisterDSchedEventListener(DMS_CONTINUE, nullptr);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
ret = DistributedSchedService::GetInstance().UnRegisterDSchedEventListener(DMS_CONTINUE, nullptr);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
DistributedSchedService::GetInstance().collaborateCbMgr_ = std::make_shared<DSchedCollaborationCallbackMgr>();
|
||||
DistributedSchedService::GetInstance().collaborateCbMgr_->Init();
|
||||
auto callback = GetDSchedService();
|
||||
ret = DistributedSchedService::GetInstance().RegisterDSchedEventListener(DMS_COLLABORATION, callback);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
ret = DistributedSchedService::GetInstance().UnRegisterDSchedEventListener(DMS_COLLABORATION, callback);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DistributedSchedServiceSecondTest RegisterDSchedEventListener_001 end" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -445,11 +445,69 @@ HWTEST_F(DtbschedmgrDeviceInfoStorageTest, GetNetworkIdList_001, TestSize.Level3
|
||||
devices = DtbschedmgrDeviceInfoStorage::GetInstance().GetNetworkIdList();
|
||||
EXPECT_EQ(devices.empty(), true);
|
||||
|
||||
std::shared_ptr<DmsDeviceInfo> deviceInfo = std::make_shared<DmsDeviceInfo>("deviceName", 0, "netWorkId");
|
||||
std::shared_ptr<DmsDeviceInfo> deviceInfo = nullptr;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().remoteDevices_[netWorkId] = deviceInfo;
|
||||
devices = DtbschedmgrDeviceInfoStorage::GetInstance().GetNetworkIdList();
|
||||
EXPECT_EQ(devices.empty(), true);
|
||||
|
||||
deviceInfo = std::make_shared<DmsDeviceInfo>("deviceName", 0, "netWorkId");
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().remoteDevices_[netWorkId] = deviceInfo;
|
||||
devices = DtbschedmgrDeviceInfoStorage::GetInstance().GetNetworkIdList();
|
||||
EXPECT_EQ(devices.empty(), false);
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest GetNetworkIdList_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: InitNetworkIdManager_001
|
||||
* @tc.desc: test InitNetworkIdManager
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DtbschedmgrDeviceInfoStorageTest, InitNetworkIdManager_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest InitNetworkIdManager_001 start" << std::endl;
|
||||
bool ret = DtbschedmgrDeviceInfoStorage::GetInstance().InitNetworkIdManager(nullptr);
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest InitNetworkIdManager_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RegisterUuidNetworkIdMap_001
|
||||
* @tc.desc: test RegisterUuidNetworkIdMap
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DtbschedmgrDeviceInfoStorageTest, RegisterUuidNetworkIdMap_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest RegisterUuidNetworkIdMap_001 start" << std::endl;
|
||||
std::string networkId = "networkId";
|
||||
EXPECT_NO_FATAL_FAILURE(DtbschedmgrDeviceInfoStorage::GetInstance().RegisterUuidNetworkIdMap(networkId));
|
||||
EXPECT_NO_FATAL_FAILURE(DtbschedmgrDeviceInfoStorage::GetInstance().UnregisterUuidNetworkIdMap(networkId));
|
||||
EXPECT_NO_FATAL_FAILURE(DtbschedmgrDeviceInfoStorage::GetInstance().DeviceOnlineNotify(nullptr));
|
||||
networkId = "";
|
||||
EXPECT_NO_FATAL_FAILURE(DtbschedmgrDeviceInfoStorage::GetInstance().DeviceOfflineNotify(networkId));
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest RegisterUuidNetworkIdMap_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetDeviceName_002
|
||||
* @tc.desc: test GetDeviceName
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DtbschedmgrDeviceInfoStorageTest, GetDeviceName_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest GetDeviceName_002 start" << std::endl;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().remoteDevices_.clear();
|
||||
std::string netWorkId = "netWorkId";
|
||||
std::shared_ptr<DmsDeviceInfo> deviceInfo = nullptr;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().remoteDevices_[netWorkId] = deviceInfo;
|
||||
std::string str = DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceName(netWorkId);
|
||||
EXPECT_EQ(str, "");
|
||||
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().remoteDevices_.clear();
|
||||
deviceInfo = std::make_shared<DmsDeviceInfo>("deviceName", 0, "netWorkId");
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().remoteDevices_[netWorkId] = deviceInfo;
|
||||
str = DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceName(netWorkId);
|
||||
EXPECT_EQ(str, "deviceName");
|
||||
DTEST_LOG << "DtbschedmgrDeviceInfoStorageTest GetDeviceName_002 end" << std::endl;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "mission/dms_continue_recv_manager.h"
|
||||
#undef private
|
||||
#include "multi_user_manager.h"
|
||||
#include "softbus_adapter/softbus_adapter.h"
|
||||
#include "test_log.h"
|
||||
|
||||
using namespace testing;
|
||||
@ -49,6 +50,11 @@ constexpr int32_t DBMS_RETRY_MAX_TIME = 5;
|
||||
constexpr uint8_t DMS_FOCUSED_TYPE = 0x00;
|
||||
}
|
||||
|
||||
int32_t SoftbusAdapter::SendSoftbusEvent(std::shared_ptr<DSchedDataBuffer> buffer)
|
||||
{
|
||||
return CAN_NOT_FOUND_ABILITY_ERR;
|
||||
}
|
||||
|
||||
void DMSContinueManagerTest::SetUpTestCase()
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user