mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-22 22:09:58 +00:00
解决冲突
Signed-off-by: 皇甫毅 <smart_e@126.com>
This commit is contained in:
commit
11ea6e8c42
@ -18,6 +18,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
#include "ability_info.h"
|
||||
#include "caller_info.h"
|
||||
#include "distributed_sched_interface.h"
|
||||
@ -88,9 +90,13 @@ public:
|
||||
int32_t Unmarshal(const std::string &jsonStr);
|
||||
|
||||
private:
|
||||
bool MarshalInner(cJSON* rootValue);
|
||||
int32_t MarshalCallerInfo(std::string &jsonStr);
|
||||
int32_t MarshalAccountInfo(std::string &jsonStr);
|
||||
int32_t UnmarshalParcel(const std::string &jsonStr);
|
||||
bool UnmarshalWantParcel(cJSON* rootValue);
|
||||
int32_t UnmarshalWantStr(const std::string &jsonStr);
|
||||
int32_t UnmarshalDtbWantStr(const std::string &jsonStr);
|
||||
int32_t UnmarshalCallerInfo(const std::string &jsonStr);
|
||||
int32_t UnmarshalCallerInfoExtra(const std::string &jsonStr);
|
||||
int32_t UnmarshalAccountInfo(const std::string &jsonStr);
|
||||
|
@ -87,7 +87,6 @@ public:
|
||||
void OnContinueSwitchOff();
|
||||
void OnUserSwitch();
|
||||
std::string GetContinueType(const std::string& bundleName);
|
||||
bool CheckRegSoftbusListener();
|
||||
|
||||
private:
|
||||
void StartEvent();
|
||||
@ -119,7 +118,6 @@ private:
|
||||
std::mutex eventMutex_;
|
||||
std::mutex iconMutex_;
|
||||
std::shared_ptr<OHOS::AppExecFwk::EventHandler> eventHandler_;
|
||||
bool hasRegSoftbusEventListener_ = false;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -26,7 +26,15 @@
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
class MultiUserManager {
|
||||
DECLARE_SINGLE_INSTANCE(MultiUserManager);
|
||||
public:
|
||||
static MultiUserManager& GetInstance();
|
||||
private:
|
||||
MultiUserManager(const MultiUserManager&) = delete;
|
||||
MultiUserManager& operator= (const MultiUserManager&) = delete;
|
||||
MultiUserManager(MultiUserManager&&) = delete;
|
||||
MultiUserManager& operator= (MultiUserManager&&) = delete;
|
||||
MultiUserManager();
|
||||
~MultiUserManager() = default;
|
||||
|
||||
public:
|
||||
void Init();
|
||||
@ -34,8 +42,8 @@ public:
|
||||
void OnUserSwitched(int32_t userId);
|
||||
void OnUserRemoved(int32_t userId);
|
||||
AccountSA::OsAccountType GetOsAccountType(int32_t &accountId);
|
||||
int32_t CreateNewSendMgr();
|
||||
int32_t CreateNewRecvMgr();
|
||||
int32_t CreateNewSendMgrLocked();
|
||||
int32_t CreateNewRecvMgrLocked();
|
||||
std::shared_ptr<DMSContinueSendMgr> GetCurrentSendMgr();
|
||||
std::shared_ptr<DMSContinueRecvMgr> GetCurrentRecvMgr();
|
||||
std::shared_ptr<DMSContinueSendMgr> GetSendMgrByCallingUid(int32_t callingUid);
|
||||
@ -45,6 +53,8 @@ public:
|
||||
int32_t GetForegroundUser();
|
||||
bool IsUserForeground(int32_t userId);
|
||||
bool IsCallerForeground(int32_t callingUid);
|
||||
bool CheckRegSoftbusListener();
|
||||
void RegisterSoftbusListener();
|
||||
|
||||
private:
|
||||
void UserSwitchedOnRegisterListenerCache();
|
||||
@ -57,6 +67,7 @@ private:
|
||||
std::mutex sendMutex_;
|
||||
std::mutex recvMutex_;
|
||||
std::mutex listenerMutex_;
|
||||
bool hasRegSoftbusEventListener_ = false;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -139,7 +139,7 @@ DSchedContinue::DSchedContinue(std::shared_ptr<DSchedContinueStartCmd> startCmd,
|
||||
HILOGE("startCmd is null");
|
||||
return;
|
||||
}
|
||||
version_ = startCmd->version_;
|
||||
version_ = DSCHED_CONTINUE_PROTOCOL_VERSION;
|
||||
subServiceType_ = startCmd->subServiceType_;
|
||||
continueByType_ = startCmd->continueByType_;
|
||||
direction_ = (startCmd->direction_ == CONTINUE_SOURCE) ? CONTINUE_SINK : CONTINUE_SOURCE;
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include "dsched_continue_event.h"
|
||||
|
||||
#include "cJSON.h"
|
||||
#include "parcel.h"
|
||||
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
@ -217,21 +217,49 @@ int32_t DSchedContinueDataCmd::Marshal(std::string &jsonStr)
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
cJSON_AddStringToObject(rootValue, "BaseCmd", baseJsonStr.c_str());
|
||||
|
||||
if (!MarshalInner(rootValue)) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
char *data = cJSON_Print(rootValue);
|
||||
if (data == nullptr) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
jsonStr = std::string(data);
|
||||
cJSON_Delete(rootValue);
|
||||
cJSON_free(data);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DSchedContinueDataCmd::MarshalInner(cJSON* rootValue)
|
||||
{
|
||||
if (rootValue == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Parcel wantParcel;
|
||||
if (!want_.Marshalling(wantParcel)) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
return false;
|
||||
}
|
||||
std::string wantStr = ParcelToBase64Str(wantParcel);
|
||||
cJSON_AddStringToObject(rootValue, "Want", wantStr.c_str());
|
||||
|
||||
DistributedWant dtbWant(want_);
|
||||
Parcel dtbWantParcel;
|
||||
if (!dtbWant.Marshalling(dtbWantParcel)) {
|
||||
return false;
|
||||
}
|
||||
std::string dtbWantStr = ParcelToBase64Str(dtbWantParcel);
|
||||
cJSON_AddStringToObject(rootValue, "DtbWant", dtbWantStr.c_str());
|
||||
|
||||
Parcel abilityParcel;
|
||||
if (!abilityInfo_.Marshalling(abilityParcel)) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
return false;
|
||||
}
|
||||
std::string abilityInfoStr = ParcelToBase64Str(abilityParcel);
|
||||
cJSON_AddStringToObject(rootValue, "AbilityInfo", abilityInfoStr.c_str());
|
||||
@ -240,29 +268,20 @@ int32_t DSchedContinueDataCmd::Marshal(std::string &jsonStr)
|
||||
|
||||
std::string callerInfoStr;
|
||||
if (MarshalCallerInfo(callerInfoStr) != ERR_OK) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
return false;
|
||||
}
|
||||
cJSON_AddStringToObject(rootValue, "CallerInfo", callerInfoStr.c_str());
|
||||
|
||||
std::string accountInfoStr;
|
||||
if (MarshalAccountInfo(accountInfoStr) != ERR_OK) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
return false;
|
||||
}
|
||||
cJSON_AddStringToObject(rootValue, "AccountInfo", accountInfoStr.c_str());
|
||||
|
||||
char *data = cJSON_Print(rootValue);
|
||||
if (data == nullptr) {
|
||||
cJSON_Delete(rootValue);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
jsonStr = std::string(data);
|
||||
cJSON_Delete(rootValue);
|
||||
cJSON_free(data);
|
||||
return ERR_OK;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int32_t DSchedContinueDataCmd::MarshalCallerInfo(std::string &jsonStr)
|
||||
{
|
||||
cJSON *callerInfoJson = cJSON_CreateObject();
|
||||
@ -412,26 +431,10 @@ int32_t DSchedContinueDataCmd::UnmarshalParcel(const std::string &jsonStr)
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
cJSON *wantStr = cJSON_GetObjectItemCaseSensitive(rootValue, "Want");
|
||||
if (wantStr == nullptr || !cJSON_IsString(wantStr) || (wantStr->valuestring == nullptr)) {
|
||||
if (!UnmarshalWantParcel(rootValue)) {
|
||||
cJSON_Delete(rootValue);
|
||||
HILOGE("Want term is null or not string.");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
Parcel wantParcel;
|
||||
int32_t ret = Base64StrToParcel(wantStr->valuestring, wantParcel);
|
||||
if (ret != ERR_OK) {
|
||||
cJSON_Delete(rootValue);
|
||||
HILOGE("Want parcel Base64Str unmarshal fail, ret %{public}d.", ret);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto wantPtr = AAFwk::Want::Unmarshalling(wantParcel);
|
||||
if (wantPtr == nullptr) {
|
||||
cJSON_Delete(rootValue);
|
||||
HILOGE("AAFwk Want unmarshalling fail, check return null.");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
want_ = *wantPtr;
|
||||
|
||||
cJSON *abilityInfoStr = cJSON_GetObjectItemCaseSensitive(rootValue, "AbilityInfo");
|
||||
if (abilityInfoStr == nullptr || !cJSON_IsString(abilityInfoStr) || (abilityInfoStr->valuestring == nullptr)) {
|
||||
@ -440,7 +443,7 @@ int32_t DSchedContinueDataCmd::UnmarshalParcel(const std::string &jsonStr)
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
Parcel abilityParcel;
|
||||
ret = Base64StrToParcel(abilityInfoStr->valuestring, abilityParcel);
|
||||
int32_t ret = Base64StrToParcel(abilityInfoStr->valuestring, abilityParcel);
|
||||
if (ret != ERR_OK) {
|
||||
cJSON_Delete(rootValue);
|
||||
HILOGE("AbilityInfo parcel Base64Str unmarshal fail, ret %{public}d.", ret);
|
||||
@ -458,6 +461,79 @@ int32_t DSchedContinueDataCmd::UnmarshalParcel(const std::string &jsonStr)
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DSchedContinueDataCmd::UnmarshalWantParcel(cJSON* rootValue)
|
||||
{
|
||||
if (rootValue == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cJSON *dtbWantStr = cJSON_GetObjectItemCaseSensitive(rootValue, "DtbWant");
|
||||
if (dtbWantStr != nullptr) {
|
||||
if (!cJSON_IsString(dtbWantStr) || (dtbWantStr->valuestring == nullptr)) {
|
||||
HILOGE("DtbWant term is null or not string.");
|
||||
return false;
|
||||
}
|
||||
if (UnmarshalDtbWantStr(dtbWantStr->valuestring) != ERR_OK) {
|
||||
HILOGE("UnmarshalDtbWantStr failed!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cJSON *wantStr = cJSON_GetObjectItemCaseSensitive(rootValue, "Want");
|
||||
if (wantStr == nullptr|| !cJSON_IsString(wantStr) || (wantStr->valuestring == nullptr)) {
|
||||
HILOGE("Want term is null or not string.");
|
||||
return false;
|
||||
}
|
||||
if (UnmarshalWantStr(wantStr->valuestring) != ERR_OK) {
|
||||
HILOGE("UnmarshalWantStr failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueDataCmd::UnmarshalDtbWantStr(const std::string &jsonStr)
|
||||
{
|
||||
Parcel wantParcel;
|
||||
int32_t ret = Base64StrToParcel(jsonStr, wantParcel);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("Want parcel Base64Str unmarshal fail, ret %{public}d.", ret);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
auto dtbWantPtr = DistributedWant::Unmarshalling(wantParcel);
|
||||
if (dtbWantPtr == nullptr) {
|
||||
HILOGE("Distributed want unmarshalling fail, check return null.");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
DistributedWant dtbWant = *dtbWantPtr;
|
||||
auto wantPtr = dtbWant.ToWant();
|
||||
if (wantPtr == nullptr) {
|
||||
HILOGE("Convert distributedWant to want failed.");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
want_ = *wantPtr;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueDataCmd::UnmarshalWantStr(const std::string &jsonStr)
|
||||
{
|
||||
Parcel wantParcel;
|
||||
int32_t ret = Base64StrToParcel(jsonStr, wantParcel);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("Want parcel Base64Str unmarshal fail, ret %{public}d.", ret);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
auto wantPtr = AAFwk::Want::Unmarshalling(wantParcel);
|
||||
if (wantPtr == nullptr) {
|
||||
HILOGE("Want unmarshalling fail, check return null.");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
want_ = *wantPtr;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueDataCmd::UnmarshalCallerInfo(const std::string &jsonStr)
|
||||
{
|
||||
cJSON *rootValue = cJSON_Parse(jsonStr.c_str());
|
||||
|
@ -143,6 +143,7 @@ sptr<IDistributedWantParams> DistributedWantParamWrapper::Parse(const std::strin
|
||||
strKey = "";
|
||||
typeId = 0;
|
||||
strnum = num + 1;
|
||||
continue;
|
||||
} else if (str[strnum] != '"') {
|
||||
continue;
|
||||
}
|
||||
|
@ -270,15 +270,10 @@ void DistributedSchedService::DeviceOnlineNotify(const std::string& networkId)
|
||||
DistributedSchedAdapter::GetInstance().DeviceOnline(networkId);
|
||||
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
|
||||
DistributedSchedMissionManager::GetInstance().DeviceOnlineNotify(networkId);
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
HILOGI("GetRecvMgr failed.");
|
||||
return;
|
||||
}
|
||||
if (!recvMgr->CheckRegSoftbusListener() &&
|
||||
if (!MultiUserManager::GetInstance().CheckRegSoftbusListener() &&
|
||||
DistributedHardware::DeviceManager::GetInstance().IsSameAccount(networkId)) {
|
||||
HILOGI("DMSContinueRecvMgr need init");
|
||||
recvMgr->Init();
|
||||
MultiUserManager::GetInstance().RegisterSoftbusListener();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -403,15 +403,10 @@ void DtbschedmgrDeviceInfoStorage::DeviceOfflineNotify(const std::string& networ
|
||||
void DtbschedmgrDeviceInfoStorage::OnDeviceInfoChanged(const std::string& deviceId)
|
||||
{
|
||||
HILOGI("OnDeviceInfoChanged called");
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
HILOGI("GetRecvMgr failed.");
|
||||
return;
|
||||
}
|
||||
if (!recvMgr->CheckRegSoftbusListener() &&
|
||||
if (!MultiUserManager::GetInstance().CheckRegSoftbusListener() &&
|
||||
DistributedHardware::DeviceManager::GetInstance().IsSameAccount(deviceId)) {
|
||||
HILOGI("DMSContinueRecvMgr need init");
|
||||
recvMgr->Init();
|
||||
MultiUserManager::GetInstance().RegisterSoftbusListener();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ void DMSContinueRecvMgr::Init()
|
||||
return;
|
||||
}
|
||||
{
|
||||
hasRegSoftbusEventListener_ = true;
|
||||
missionDiedListener_ = new DistributedMissionDiedListener();
|
||||
eventThread_ = std::thread(&DMSContinueRecvMgr::StartEvent, this);
|
||||
std::unique_lock<std::mutex> lock(eventMutex_);
|
||||
@ -653,10 +652,5 @@ std::string DMSContinueRecvMgr::GetContinueType(const std::string& bundleName)
|
||||
|
||||
return iconInfo_.continueType;
|
||||
}
|
||||
|
||||
bool DMSContinueRecvMgr::CheckRegSoftbusListener()
|
||||
{
|
||||
return hasRegSoftbusEventListener_;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -31,7 +31,19 @@ namespace {
|
||||
const std::string TAG = "MultiUserManager";
|
||||
}
|
||||
|
||||
IMPLEMENT_SINGLE_INSTANCE(MultiUserManager);
|
||||
MultiUserManager& MultiUserManager::GetInstance()
|
||||
{
|
||||
static auto instance = new MultiUserManager();
|
||||
return *instance;
|
||||
}
|
||||
|
||||
MultiUserManager::MultiUserManager()
|
||||
{
|
||||
HILOGI("Start.");
|
||||
if (currentUserId_ <= 0) {
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
void MultiUserManager::Init()
|
||||
{
|
||||
@ -44,18 +56,13 @@ void MultiUserManager::Init()
|
||||
HILOGI("GetSendMgr failed.");
|
||||
return;
|
||||
}
|
||||
sendMgr->Init();
|
||||
auto recvMgr = GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
HILOGI("GetRecvMgr failed.");
|
||||
return;
|
||||
}
|
||||
recvMgr->Init();
|
||||
std::shared_ptr<SoftbusAdapterListener> missionBroadcastListener =
|
||||
std::make_shared<DistributedMissionBroadcastListener>();
|
||||
int32_t ret = SoftbusAdapter::GetInstance().RegisterSoftbusEventListener(missionBroadcastListener);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("get RegisterSoftbusEventListener failed, ret: %{public}d", ret);
|
||||
if (!CheckRegSoftbusListener()) {
|
||||
RegisterSoftbusListener();
|
||||
}
|
||||
HILOGI("Init end.");
|
||||
}
|
||||
@ -130,14 +137,11 @@ void MultiUserManager::OnUserSwitched(int32_t accountId)
|
||||
HILOGI("GetSendMgr failed.");
|
||||
return;
|
||||
}
|
||||
sendMgr->Init();
|
||||
recvMgr = GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
HILOGI("GetRecvMgr failed.");
|
||||
return;
|
||||
}
|
||||
recvMgr->Init();
|
||||
|
||||
if (!DataShareManager::GetInstance().IsCurrentContinueSwitchOn()) {
|
||||
recvMgr->OnContinueSwitchOff();
|
||||
HILOGI("ICurrentContinueSwitch is off, %{public}d", DataShareManager::GetInstance()
|
||||
@ -214,19 +218,21 @@ AccountSA::OsAccountType MultiUserManager::GetOsAccountType(int32_t &accountId)
|
||||
return type;
|
||||
}
|
||||
|
||||
int32_t MultiUserManager::CreateNewSendMgr()
|
||||
int32_t MultiUserManager::CreateNewSendMgrLocked()
|
||||
{
|
||||
HILOGI("CreateNewSendMgr begin. accountId: %{public}d.", currentUserId_);
|
||||
auto sendMgr = std::make_shared<DMSContinueSendMgr>();
|
||||
sendMgr->Init();
|
||||
sendMgrMap_.emplace(currentUserId_, sendMgr);
|
||||
HILOGI("CreateNewSendMgr end.");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t MultiUserManager::CreateNewRecvMgr()
|
||||
int32_t MultiUserManager::CreateNewRecvMgrLocked()
|
||||
{
|
||||
HILOGI("CreateNewRecvMgr begin. accountId: %{public}d.", currentUserId_);
|
||||
auto recvMgr = std::make_shared<DMSContinueRecvMgr>();
|
||||
recvMgr->Init();
|
||||
recvMgrMap_.emplace(currentUserId_, recvMgr);
|
||||
HILOGI("CreateNewRecvMgr end.");
|
||||
return ERR_OK;
|
||||
@ -238,7 +244,7 @@ std::shared_ptr<DMSContinueSendMgr> MultiUserManager::GetCurrentSendMgr()
|
||||
std::lock_guard<std::mutex> lock(sendMutex_);
|
||||
if (sendMgrMap_.empty() || sendMgrMap_.find(currentUserId_) == sendMgrMap_.end()) {
|
||||
HILOGI("sendMgr need to create.");
|
||||
CreateNewSendMgr();
|
||||
CreateNewSendMgrLocked();
|
||||
}
|
||||
auto cur = sendMgrMap_.find(currentUserId_);
|
||||
return cur->second;
|
||||
@ -250,7 +256,7 @@ std::shared_ptr<DMSContinueRecvMgr> MultiUserManager::GetCurrentRecvMgr()
|
||||
std::lock_guard<std::mutex> lock(recvMutex_);
|
||||
if (recvMgrMap_.empty() || recvMgrMap_.find(currentUserId_) == recvMgrMap_.end()) {
|
||||
HILOGI("recvMgr need to create.");
|
||||
CreateNewRecvMgr();
|
||||
CreateNewRecvMgrLocked();
|
||||
}
|
||||
auto cur = recvMgrMap_.find(currentUserId_);
|
||||
return cur->second;
|
||||
@ -260,11 +266,11 @@ std::shared_ptr<DMSContinueSendMgr> MultiUserManager::GetSendMgrByCallingUid(int
|
||||
{
|
||||
int32_t accountId = -1;
|
||||
OHOS::AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(callingUid, accountId);
|
||||
HILOGI("GetRecvMgrByCallingUid. accountId: %{public}d , callingUid: %{public}d.", accountId, callingUid);
|
||||
HILOGI("GetSendMgrByCallingUid. accountId: %{public}d , callingUid: %{public}d.", accountId, callingUid);
|
||||
std::lock_guard<std::mutex> lock(sendMutex_);
|
||||
if (sendMgrMap_.empty() || sendMgrMap_.find(accountId) == sendMgrMap_.end()) {
|
||||
HILOGI("sendMgr need to create.");
|
||||
CreateNewSendMgr();
|
||||
CreateNewSendMgrLocked();
|
||||
}
|
||||
auto cur = sendMgrMap_.find(accountId);
|
||||
return cur->second;
|
||||
@ -278,7 +284,7 @@ std::shared_ptr<DMSContinueRecvMgr> MultiUserManager::GetRecvMgrByCallingUid(int
|
||||
std::lock_guard<std::mutex> lock(recvMutex_);
|
||||
if (recvMgrMap_.empty() || recvMgrMap_.find(accountId) == recvMgrMap_.end()) {
|
||||
HILOGI("recvMgr need to create.");
|
||||
CreateNewRecvMgr();
|
||||
CreateNewRecvMgrLocked();
|
||||
}
|
||||
auto cur = recvMgrMap_.find(accountId);
|
||||
return cur->second;
|
||||
@ -361,5 +367,23 @@ bool MultiUserManager::IsCallerForeground(int32_t callingUid)
|
||||
OHOS::AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(callingUid, accountId);
|
||||
return IsUserForeground(accountId);
|
||||
}
|
||||
|
||||
void MultiUserManager::RegisterSoftbusListener()
|
||||
{
|
||||
HILOGI("Register softbusListener start. accountId: %{public}d.", currentUserId_);
|
||||
std::shared_ptr<SoftbusAdapterListener> missionBroadcastListener =
|
||||
std::make_shared<DistributedMissionBroadcastListener>();
|
||||
int32_t ret = SoftbusAdapter::GetInstance().RegisterSoftbusEventListener(missionBroadcastListener);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("get RegisterSoftbusEventListener failed, ret: %{public}d", ret);
|
||||
}
|
||||
hasRegSoftbusEventListener_ = true;
|
||||
HILOGI("Register softbusListener end.");
|
||||
}
|
||||
|
||||
bool MultiUserManager::CheckRegSoftbusListener()
|
||||
{
|
||||
return hasRegSoftbusEventListener_;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -162,6 +162,9 @@ ohos_unittest("distributedschedservicetest") {
|
||||
"unittest/distributed_sched_service_second_test.cpp",
|
||||
"unittest/mock_distributed_sched.cpp",
|
||||
]
|
||||
if (dmsfwk_ces_listener) {
|
||||
sources += [ "unittest/common_event_listener_test.cpp" ]
|
||||
}
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
@ -203,8 +206,13 @@ ohos_unittest("distributedschedstubtest") {
|
||||
public_deps = dsched_public_deps
|
||||
}
|
||||
|
||||
defines = []
|
||||
if (dmsfwk_report_memmgr || dmsfwk_report_memmgr_plugins) {
|
||||
defines = [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
|
||||
defines += [ "SUPPORT_DISTRIBUTEDCOMPONENT_TO_MEMMGR" ]
|
||||
}
|
||||
|
||||
if (!dmsfwk_softbus_adapter_common) {
|
||||
defines += [ "DMSFWK_INTERACTIVE_ADAPTER" ]
|
||||
}
|
||||
|
||||
part_name = "dmsfwk"
|
||||
|
@ -31,11 +31,38 @@ using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
|
||||
static std::string g_mockString = "";
|
||||
static bool g_mockBool = false;
|
||||
|
||||
namespace {
|
||||
const string GROUP_ID = "TEST_GROUP_ID";
|
||||
constexpr int32_t SLEEP_TIME = 1000;
|
||||
}
|
||||
|
||||
bool DmsBmStorage::GetBundleNameId(const std::string& bundleName, uint16_t &bundleNameId)
|
||||
{
|
||||
return g_mockBool;
|
||||
}
|
||||
|
||||
std::string DmsBmStorage::GetContinueType(const std::string &networkId, std::string &bundleName,
|
||||
uint8_t continueTypeId)
|
||||
{
|
||||
return g_mockString;
|
||||
}
|
||||
|
||||
bool DmsBmStorage::GetContinueTypeId(const std::string &bundleName, const std::string &abilityName,
|
||||
uint8_t &continueTypeId)
|
||||
{
|
||||
return g_mockBool;
|
||||
}
|
||||
|
||||
bool DmsBmStorage::GetDistributedBundleName(const std::string &networkId, const uint16_t& bundleNameId,
|
||||
std::string &bundleName)
|
||||
{
|
||||
return g_mockBool;
|
||||
}
|
||||
|
||||
void BundleManagerInternalTest::SetUpTestCase()
|
||||
{
|
||||
DTEST_LOG << "BundleManagerInternalTest::SetUpTestCase" << std::endl;
|
||||
@ -646,5 +673,73 @@ HWTEST_F(BundleManagerInternalTest, GetBundleNameById_001, TestSize.Level3)
|
||||
EXPECT_EQ(ret, CAN_NOT_FOUND_ABILITY_ERR);
|
||||
DTEST_LOG << "BundleManagerInternalTest GetBundleNameById_001 end "<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.name: GetBundleNameId_003
|
||||
* @tc.desc: test get bundleNameId from bms
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BundleManagerInternalTest, GetBundleNameId_003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "BundleManagerInternalTest GetBundleNameId_003 begin" << std::endl;
|
||||
const std::string bundleName = "com.ohos.mms";
|
||||
uint16_t bundleNameId = 0;
|
||||
g_mockBool = true;
|
||||
int32_t ret = BundleManagerInternal::GetBundleNameId(bundleName, bundleNameId);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "BundleManagerInternalTest GetBundleNameId_003 end "<< std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetContinueType_002
|
||||
* @tc.desc: GetContinueType
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BundleManagerInternalTest, GetContinueType_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "BundleManagerInternalTest GetContinueType_002 begin" << std::endl;
|
||||
std::string networkId = "networkId";
|
||||
std::string bundleName;
|
||||
uint8_t continueTypeId = 0;
|
||||
g_mockString = "continueType";
|
||||
std::string str = BundleManagerInternal::GetContinueType(networkId, bundleName, continueTypeId);
|
||||
EXPECT_NE(str, "");
|
||||
DTEST_LOG << "BundleManagerInternalTest GetContinueType_002 end "<< std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetContinueTypeId_002
|
||||
* @tc.desc: GetContinueTypeId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BundleManagerInternalTest, GetContinueTypeId_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "BundleManagerInternalTest GetContinueTypeId_002 begin" << std::endl;
|
||||
std::string networkId = "networkId";
|
||||
std::string abilityName;
|
||||
uint8_t continueTypeId = 0;
|
||||
g_mockBool = true;
|
||||
int32_t ret = BundleManagerInternal::GetContinueTypeId(networkId, abilityName, continueTypeId);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "BundleManagerInternalTest GetContinueTypeId_002 end "<< std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetBundleNameById_002
|
||||
* @tc.desc: GetBundleNameById
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(BundleManagerInternalTest, GetBundleNameById_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "BundleManagerInternalTest GetBundleNameById_002 begin" << std::endl;
|
||||
std::string networkId = "networkId";
|
||||
std::string bundleName;
|
||||
uint16_t bundleNameId = 0;
|
||||
g_mockBool = true;
|
||||
int32_t ret = BundleManagerInternal::GetBundleNameById(networkId, bundleNameId, bundleName);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "BundleManagerInternalTest GetBundleNameById_002 end "<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "common_event_listener.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test_log.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
class CommonEventListenerTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
std::shared_ptr<CommonEventListener> applyMonitor = nullptr;
|
||||
};
|
||||
|
||||
void CommonEventListenerTest::SetUpTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
void CommonEventListenerTest::TearDownTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
void CommonEventListenerTest::SetUp()
|
||||
{
|
||||
EventFwk::MatchingSkills matchingSkills;
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_ADDED);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED);
|
||||
matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_CHANGED);
|
||||
EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
|
||||
applyMonitor = std::make_shared<CommonEventListener>(subscribeInfo);
|
||||
}
|
||||
|
||||
void CommonEventListenerTest::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnReceiveEvent001
|
||||
* @tc.desc: call OnReceiveEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CommonEventListenerTest, OnReceiveEvent001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "CommonEventListenerTest OnReceiveEvent001 start" << std::endl;
|
||||
AAFwk::Want want;
|
||||
EventFwk::CommonEventData eventData;
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED);
|
||||
eventData.SetWant(want);
|
||||
EXPECT_NO_FATAL_FAILURE(applyMonitor->OnReceiveEvent(eventData));
|
||||
DTEST_LOG << "CommonEventListenerTest OnReceiveEvent001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnReceiveEvent002
|
||||
* @tc.desc: call OnReceiveEvent
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(CommonEventListenerTest, OnReceiveEvent002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "CommonEventListenerTest OnReceiveEvent002 start" << std::endl;
|
||||
AAFwk::Want want;
|
||||
EventFwk::CommonEventData eventData;
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_ADDED);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_CHANGED);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_USER_REMOVED);
|
||||
eventData.SetWant(want);
|
||||
applyMonitor->OnReceiveEvent(eventData);
|
||||
|
||||
want.SetAction("receiveEvent");
|
||||
eventData.SetWant(want);
|
||||
EXPECT_NO_FATAL_FAILURE(applyMonitor->OnReceiveEvent(eventData));
|
||||
DTEST_LOG << "CommonEventListenerTest OnReceiveEvent002 end" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
@ -316,6 +316,7 @@ HWTEST_F(DSchedContinueManagerTest, GetContinueInfo_002, TestSize.Level3)
|
||||
|
||||
DSchedContinueInfo info;
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
std::string localDeviceId = "localdeviceid";
|
||||
std::string remoteDeviceId = "remotedeviceid";
|
||||
DSchedContinueManager::GetInstance().continues_[info] = dContinue;
|
||||
@ -546,6 +547,7 @@ HWTEST_F(DSchedContinueManagerTest, GetDSchedContinueByWant_002, TestSize.Level3
|
||||
EXPECT_EQ(ret, nullptr);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
DSchedContinueManager::GetInstance().continues_[info] = nullptr;
|
||||
DSchedContinueManager::GetInstance().continues_[info] = dContinue;
|
||||
|
||||
|
@ -483,6 +483,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueDataTask001, TestSize.Level3
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = dataStateTest_->DoContinueDataTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueDataTask001 end" << std::endl;
|
||||
@ -500,6 +501,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueDataTask002, TestSize.Level3
|
||||
auto data = std::make_shared<DSchedContinueDataCmd>();
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_DATA_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
EXPECT_CALL(*mockStateTest_, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||
int32_t ret = dataStateTest_->DoContinueDataTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -530,6 +532,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueEndTask001, TestSize.Level3)
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = dataStateTest_->DoContinueEndTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueEndTask001 end" << std::endl;
|
||||
@ -547,6 +550,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueEndTask002, TestSize.Level3)
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = dataStateTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueEndTask002 end" << std::endl;
|
||||
@ -576,6 +580,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueErrorTask001, TestSize.Level
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = dataStateTest_->DoContinueErrorTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueErrorTask001 end" << std::endl;
|
||||
@ -593,6 +598,7 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueErrorTask002, TestSize.Level
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_COMPLETE_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = dataStateTest_->DoContinueErrorTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueErrorTask002 end" << std::endl;
|
||||
@ -683,6 +689,7 @@ HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkDoContinueEndTask001, TestSize.
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
sinkEndStateTest_->DoContinueEndTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
DTEST_LOG << "DSchedContinueSinkEndStateTest TestSinkDoContinueEndTask001 end" << std::endl;
|
||||
@ -700,6 +707,7 @@ HWTEST_F(DSchedContinueSinkEndStateTest, TestSinkDoContinueEndTask002, TestSize.
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = sinkEndStateTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSinkEndStateTest TestSinkDoContinueEndTask002 end" << std::endl;
|
||||
@ -792,6 +800,7 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinuePullReqTaskTest_001, Te
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = sinkStartStateTest_->DoContinuePullReqTask(dContinue,
|
||||
AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -824,6 +833,7 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueAbilityTaskTest_001, Te
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = sinkStartStateTest_->DoContinueAbilityTask(dContinue,
|
||||
AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -856,6 +866,7 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueEndTaskTest_001, TestSi
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = sinkStartStateTest_->DoContinueEndTask(dContinue,
|
||||
AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -887,6 +898,7 @@ HWTEST_F(DSchedContinueSinkStartStateTest, SinkDoContinueErrorTask001, TestSize.
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = sinkStartStateTest_->DoContinueErrorTask(dContinue,
|
||||
AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -980,6 +992,7 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoNotifyCompleteTask001, TestSi
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = sinkWaitEndTest_->DoNotifyCompleteTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoNotifyCompleteTask001 end" << std::endl;
|
||||
@ -997,6 +1010,7 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoNotifyCompleteTask002, TestSi
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_COMPLETE_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = sinkWaitEndTest_->DoNotifyCompleteTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoNotifyCompleteTask002 end" << std::endl;
|
||||
@ -1027,6 +1041,7 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoContinueEndTask001, TestSize.
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = sinkWaitEndTest_->DoContinueEndTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoContinueEndTask001 end" << std::endl;
|
||||
@ -1044,6 +1059,7 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoContinueEndTask002, TestSize.
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = sinkWaitEndTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoContinueEndTask002 end" << std::endl;
|
||||
@ -1134,6 +1150,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueSendTask001, TestSize.Leve
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = abilityStateTest_->DoContinueSendTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueSendTask001 end" << std::endl;
|
||||
@ -1151,6 +1168,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueSendTask002, TestSize.Leve
|
||||
auto data = std::make_shared<ContinueAbilityData>();
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSHCED_CONTINUE_SEND_DATA_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = abilityStateTest_->DoContinueSendTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueSendTask002 end" << std::endl;
|
||||
@ -1180,6 +1198,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueEndTask001, TestSize.Level
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = abilityStateTest_->DoContinueEndTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueEndTask001 end" << std::endl;
|
||||
@ -1197,6 +1216,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueErrorTask002, TestSize.Lev
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_COMPLETE_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = abilityStateTest_->DoContinueErrorTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueErrorTask002 end" << std::endl;
|
||||
@ -1226,6 +1246,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueErrorTask001, TestSize.Lev
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = abilityStateTest_->DoContinueErrorTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueErrorTask001 end" << std::endl;
|
||||
@ -1243,6 +1264,7 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueEndTask002, TestSize.Level
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = abilityStateTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueEndTask002 end" << std::endl;
|
||||
@ -1333,6 +1355,7 @@ HWTEST_F(DSchedContinueEndStateTest, SrcDoContinueEndTaskTest001, TestSize.Level
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = srcEndStateTest_->DoContinueEndTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueEndStateTest SrcDoContinueEndTaskTest001 end" << std::endl;
|
||||
@ -1350,6 +1373,7 @@ HWTEST_F(DSchedContinueEndStateTest, SrcDoContinueEndTaskTest002, TestSize.Level
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcEndStateTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueEndStateTest SrcDoContinueEndTaskTest002 end" << std::endl;
|
||||
@ -1460,6 +1484,7 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinuePushReqTaskTest_002, T
|
||||
}
|
||||
};
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcStartStateTest_->DoContinuePushReqTask(dContinue,
|
||||
AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -1491,6 +1516,7 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinuePushReqTaskTest_003, T
|
||||
auto wantParamsPtr = std::make_shared<OHOS::AAFwk::WantParams>(wantParams);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSHCED_CONTINUE_REQ_PUSH_EVENT, wantParamsPtr, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcStartStateTest_->DoContinuePushReqTask(dContinue, event);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinuePushReqTaskTest_003 end" << std::endl;
|
||||
@ -1534,6 +1560,7 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueAbilityTaskTest_002, T
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSHCED_CONTINUE_ABILITY_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcStartStateTest_->DoContinueAbilityTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueAbilityTaskTest_002 end" << std::endl;
|
||||
@ -1577,6 +1604,7 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueEndTaskTest_002, TestS
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcStartStateTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueEndTaskTest_002 end" << std::endl;
|
||||
@ -1619,6 +1647,7 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueErrorTaskTest_002, Tes
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_COMPLETE_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcStartStateTest_->DoContinueErrorTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueErrorTaskTest_002 end" << std::endl;
|
||||
@ -1710,6 +1739,7 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoNotifyCompleteTask_001, TestSize.L
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = srcWaitEndTest_->DoNotifyCompleteTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoNotifyCompleteTask_001 end" << std::endl;
|
||||
@ -1727,6 +1757,7 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoNotifyCompleteTask_002, TestSize.L
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_COMPLETE_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcWaitEndTest_->DoNotifyCompleteTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoNotifyCompleteTask_002 end" << std::endl;
|
||||
@ -1757,6 +1788,7 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoContinueEndTask_001, TestSize.Leve
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
ret = srcWaitEndTest_->DoContinueEndTask(dContinue, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoContinueEndTask_001 end" << std::endl;
|
||||
@ -1774,6 +1806,7 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoContinueEndTask_002, TestSize.Leve
|
||||
auto data = std::make_shared<int32_t>(1);
|
||||
auto event = AppExecFwk::InnerEvent::Get(DSCHED_CONTINUE_END_EVENT, data, 0);
|
||||
std::shared_ptr<DSchedContinue> dContinue = CreateObject();
|
||||
usleep(WAITTIME);
|
||||
int32_t ret = srcWaitEndTest_->DoContinueEndTask(dContinue, event);
|
||||
EXPECT_NE(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoContinueEndTask_002 end" << std::endl;
|
||||
|
@ -98,6 +98,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_001_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
ret = conti->PostStartTask(wantParams);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DSchedContinueTest DSchedContinueTest_001_1 end ret:" << ret << std::endl;
|
||||
@ -130,6 +131,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_002_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
ret = conti->PostCotinueAbilityTask(appVersion);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DSchedContinueTest DSchedContinueTest_002_1 end ret:" << ret << std::endl;
|
||||
@ -163,6 +165,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_003_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
cmd->replyCmd_ = DSCHED_CONTINUE_END_EVENT;
|
||||
ret = conti->OnReplyCmd(cmd);
|
||||
@ -212,6 +215,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_004_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
ret = conti->OnStartContinuation(want, callerUid, status, accessToken);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -252,6 +256,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_005_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
ret = conti->OnContinueDataCmd(cmd);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -302,6 +307,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_006_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
ret = conti->PostNotifyCompleteTask(ERR_OK);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
@ -338,6 +344,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_007_1, TestSize.Level0)
|
||||
|
||||
// eventHandler_ not null
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
ret = conti->PostContinueEndTask(result);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DSchedContinueTest DSchedContinueTest_007_1 end ret:" << ret << std::endl;
|
||||
@ -360,6 +367,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_008_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto wantParams = std::make_shared<DistributedWantParams>();
|
||||
int32_t ret = conti->ExecuteContinueReq(wantParams);
|
||||
@ -385,6 +393,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_009_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto cmd = std::make_shared<DSchedContinueStartCmd>();
|
||||
auto wantParams = std::make_shared<DistributedWantParams>();
|
||||
@ -420,6 +429,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0010_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, deviceId, missionId);
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t appVersion = 0;
|
||||
int32_t ret = conti->ExecuteContinueAbility(appVersion);
|
||||
@ -444,6 +454,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0011_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, deviceId, missionId);
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t ret = conti->GetMissionIdByBundleName();
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -467,6 +478,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0012_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t ret = conti->CheckContinueAbilityPermission();
|
||||
EXPECT_EQ(ret, NO_MISSION_INFO_FOR_MISSION_ID);
|
||||
@ -490,6 +502,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0013_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t ret = conti->ExecuteContinueReply();
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -513,6 +526,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0014_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto data = std::make_shared<ContinueAbilityData>();
|
||||
int32_t ret = conti->ExecuteContinueSend(data);
|
||||
@ -541,6 +555,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0015_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
AAFwk::Want want;
|
||||
int32_t ret = conti->SetWantForContinuation(want);
|
||||
@ -565,6 +580,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0016_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto cmd = std::make_shared<DSchedContinueDataCmd>();
|
||||
OHOS::AAFwk::Want want;
|
||||
@ -598,6 +614,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0017_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto cmd = std::make_shared<DSchedContinueDataCmd>();
|
||||
|
||||
@ -702,6 +719,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0018_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t result = ERR_OK;
|
||||
int32_t ret = conti->ExecuteNotifyComplete(result);
|
||||
@ -730,6 +748,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0019_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto cmd = std::make_shared<DSchedContinueReplyCmd>();
|
||||
int32_t replyCmd = 0;
|
||||
@ -762,6 +781,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0020_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t result = 0;
|
||||
|
||||
@ -787,6 +807,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0021_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t result = 0;
|
||||
int32_t ret = conti->ExecuteContinueError(result);
|
||||
@ -815,6 +836,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0022_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto cmd = std::make_shared<DSchedContinueEndCmd>();
|
||||
int32_t result = 0;
|
||||
@ -845,6 +867,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0023_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
auto cmd = std::make_shared<DSchedContinueCmdBase>();
|
||||
int32_t ret = conti->SendCommand(cmd);
|
||||
@ -869,6 +892,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0024_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
std::string localDeviceId;
|
||||
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||
@ -894,6 +918,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0025_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
bool ret = conti->CheckDeviceIdFromRemote("", "", "");
|
||||
EXPECT_FALSE(ret);
|
||||
@ -937,6 +962,7 @@ HWTEST_F(DSchedContinueTest, WaitAbilityStateInitialTest_0026_1, TestSize.Level0
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t persistentId = 100;
|
||||
bool ret = conti->WaitAbilityStateInitial(persistentId);
|
||||
@ -961,6 +987,7 @@ HWTEST_F(DSchedContinueTest, StartAbilityTest_0027_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
AAFwk::Want want;
|
||||
AppExecFwk::ElementName element("devicdId", "com.ohos.distributedmusicplayer",
|
||||
@ -989,6 +1016,7 @@ HWTEST_F(DSchedContinueTest, QuerySinkAbilityNameTest_0028_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, continueType);
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
std::string sinkBundleName = conti->QuerySinkAbilityName();
|
||||
EXPECT_TRUE(sinkBundleName.empty());
|
||||
@ -1012,6 +1040,7 @@ HWTEST_F(DSchedContinueTest, QuickStartAbilityTest_0029_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t ret = conti->QuickStartAbility();
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -1035,6 +1064,7 @@ HWTEST_F(DSchedContinueTest, UpdateWantForContinueTypeTest_0030_1, TestSize.Leve
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
AAFwk::Want want;
|
||||
AppExecFwk::ElementName element("devicdId", "com.ohos.distributedmusicplayer",
|
||||
@ -1062,6 +1092,7 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_031_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
AppExecFwk::InnerEvent *event = nullptr;
|
||||
auto destructor = [](AppExecFwk::InnerEvent *event) {
|
||||
@ -1095,6 +1126,7 @@ HWTEST_F(DSchedContinueTest, OnDataRecvTest_032_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t command = 0;
|
||||
std::shared_ptr<DSchedDataBuffer> dataBuffer = nullptr;
|
||||
@ -1136,6 +1168,7 @@ HWTEST_F(DSchedContinueTest, UpdateStateTest_033_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
DSchedContinueStateType stateType = DSCHED_CONTINUE_SINK_START_STATE;
|
||||
conti->UpdateState(stateType);
|
||||
@ -1163,6 +1196,7 @@ HWTEST_F(DSchedContinueTest, CheckStartPermission_034_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t ret = conti->CheckStartPermission(cmd);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -1192,6 +1226,7 @@ HWTEST_F(DSchedContinueTest, ConvertToDmsSdkErr_035_1, TestSize.Level0)
|
||||
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||
conti->Init();
|
||||
usleep(WAITTIME);
|
||||
|
||||
int32_t ret = conti->ConvertToDmsSdkErr(0);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
@ -1154,4 +1154,30 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_ReadFromParcelPara
|
||||
bool result = wantParams.ReadFromParcelParam(parcel, key, type);
|
||||
EXPECT_TRUE(result);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_ReadFromParcelParam_1000 end" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ReadFromParcelWantParamWrapper_1000
|
||||
* @tc.name: ReadFromParcelWantParamWrapper
|
||||
* @tc.desc: Test ReadFromParcelWantParamWrapper.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, ReadFromParcelWantParamWrapper_1000, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest ReadFromParcelWantParamWrapper_1000 begin" << std::endl;
|
||||
DistributedWantParams wantParams;
|
||||
Parcel parcel;
|
||||
std::string key = "this is key";
|
||||
int type = DistributedWantParams::VALUE_TYPE_FD;
|
||||
int bufferSize = 1;
|
||||
parcel.WriteInt32(bufferSize);
|
||||
parcel.WriteInt32(0);
|
||||
bool result = wantParams.ReadFromParcelWantParamWrapper(parcel, key, type);
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
type = DistributedWantParams::VALUE_TYPE_REMOTE_OBJECT;
|
||||
result = wantParams.ReadFromParcelWantParamWrapper(parcel, key, type);
|
||||
EXPECT_TRUE(result);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest ReadFromParcelWantParamWrapper_1000 end" << std::endl;
|
||||
}
|
||||
|
@ -3758,5 +3758,176 @@ HWTEST_F(DistributedWantBaseTest, GetLowerCaseScheme_test_003, TestSize.Level3)
|
||||
EXPECT_FALSE(strUri.empty());
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: GetLowerCaseScheme_test_004
|
||||
* @tc.name: GetLowerCaseScheme
|
||||
* @tc.desc: Test GetLowerCaseScheme.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, GetLowerCaseScheme_test_004, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_004 start";
|
||||
DistributedWant want;
|
||||
Uri lowerCaseUri("http://TEST.COM");
|
||||
Uri result = want.GetLowerCaseScheme(lowerCaseUri);
|
||||
EXPECT_EQ(result, lowerCaseUri);
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ReadUriFromParcel_test_001
|
||||
* @tc.name: ReadUriFromParcel
|
||||
* @tc.desc: Test ReadUriFromParcel.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, ReadUriFromParcel_test_001, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ReadUriFromParcel_test_001 start";
|
||||
DistributedWant want;
|
||||
Parcel parcel;
|
||||
parcel.WriteInt32(DistributedOperation::VALUE_OBJECT);
|
||||
bool result = want.ReadUriFromParcel(parcel);
|
||||
EXPECT_EQ(result, true);
|
||||
GTEST_LOG_(INFO) << "ReadUriFromParcel_test_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: CanReadFromJson_test_001
|
||||
* @tc.name: CanReadFromJson
|
||||
* @tc.desc: Test CanReadFromJson.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, CanReadFromJson_test_001, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "CanReadFromJson_test_001 start";
|
||||
DistributedWant want;
|
||||
nlohmann::json wantJson;
|
||||
wantJson["deviceId"] = "device1";
|
||||
wantJson["bundleName"] = "bundle1";
|
||||
wantJson["abilityName"] = "ability1";
|
||||
wantJson["uri"] = "uri1";
|
||||
wantJson["type"] = "type1";
|
||||
wantJson["flags"] = 1;
|
||||
wantJson["action"] = "action1";
|
||||
wantJson["parameters"] = "parameters1";
|
||||
bool result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
wantJson["deviceId"] = 1;
|
||||
wantJson["entities"] = "entities1";
|
||||
result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
wantJson["deviceId"] = "device1";
|
||||
wantJson["bundleName"] = 1;
|
||||
result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
GTEST_LOG_(INFO) << "CanReadFromJson_test_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: CanReadFromJson_test_002
|
||||
* @tc.name: CanReadFromJson
|
||||
* @tc.desc: Test CanReadFromJson.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, CanReadFromJson_test_002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "CanReadFromJson_test_002 start";
|
||||
DistributedWant want;
|
||||
nlohmann::json wantJson;
|
||||
wantJson["deviceId"] = "device1";
|
||||
wantJson["bundleName"] = "bundle1";
|
||||
wantJson["abilityName"] = 1;
|
||||
wantJson["uri"] = "uri1";
|
||||
wantJson["type"] = "type1";
|
||||
wantJson["flags"] = 1;
|
||||
wantJson["action"] = "action1";
|
||||
wantJson["parameters"] = "parameters1";
|
||||
wantJson["entities"] = "entities1";
|
||||
bool result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
wantJson["abilityName"] = "ability1";
|
||||
wantJson["uri"] = 1;
|
||||
result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
wantJson["uri"] = "uri1";
|
||||
wantJson["type"] = 1;
|
||||
result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
GTEST_LOG_(INFO) << "CanReadFromJson_test_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: CanReadFromJson_test_003
|
||||
* @tc.name: CanReadFromJson
|
||||
* @tc.desc: Test CanReadFromJson.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, CanReadFromJson_test_003, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "CanReadFromJson_test_003 start";
|
||||
DistributedWant want;
|
||||
nlohmann::json wantJson;
|
||||
wantJson["deviceId"] = "device1";
|
||||
wantJson["bundleName"] = "bundle1";
|
||||
wantJson["abilityName"] = "ability1";
|
||||
wantJson["uri"] = "uri1";
|
||||
wantJson["type"] = "type1";
|
||||
wantJson["flags"] = "flags1";
|
||||
wantJson["action"] = "action1";
|
||||
wantJson["parameters"] = "parameters1";
|
||||
wantJson["entities"] = "entities1";
|
||||
bool result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
wantJson["flags"] = 1;
|
||||
wantJson["action"] = 1;
|
||||
result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
|
||||
wantJson["action"] = "action1";
|
||||
wantJson["parameters"] = 1;
|
||||
result = want.CanReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
GTEST_LOG_(INFO) << "CanReadFromJson_test_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ReadFromJson_test_001
|
||||
* @tc.name: ReadFromJson
|
||||
* @tc.desc: Test ReadFromJson.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, ReadFromJson_test_001, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ReadFromJson_test_001 start";
|
||||
DistributedWant want;
|
||||
nlohmann::json wantJson;
|
||||
wantJson["deviceId"] = "device1";
|
||||
wantJson["bundleName"] = "bundle1";
|
||||
wantJson["abilityName"] = "ability1";
|
||||
wantJson["uri"] = "uri1";
|
||||
wantJson["type"] = "type1";
|
||||
wantJson["flags"] = 1;
|
||||
wantJson["action"] = "action1";
|
||||
wantJson["parameters"] = "parameters1";
|
||||
wantJson["entities"] = "entities1";
|
||||
bool result = want.ReadFromJson(wantJson);
|
||||
EXPECT_EQ(result, false);
|
||||
GTEST_LOG_(INFO) << "ReadFromJson_test_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: ReadFromJson_test_002
|
||||
* @tc.name: ReadFromJson
|
||||
* @tc.desc: Test ReadFromJson.
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, ReadFromJson_test_002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "ReadFromJson_test_002 start";
|
||||
DistributedWant want;
|
||||
std::string str = "";
|
||||
EXPECT_EQ(want.FromString(str), nullptr);
|
||||
GTEST_LOG_(INFO) << "ReadFromJson_test_002 end";
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2292,5 +2292,83 @@ HWTEST_F(DistributedSchedStubTest, NotifyDSchedEventResultFromRemoteInner_001, T
|
||||
EXPECT_NE(result, ERR_NULL_OBJECT);
|
||||
DTEST_LOG << "DistributedSchedStubTest NotifyDSchedEventResultFromRemoteInner_001 end" << std::endl;
|
||||
}
|
||||
|
||||
#ifdef DMSFWK_INTERACTIVE_ADAPTER
|
||||
/**
|
||||
* @tc.name: StartAbilityFromRemoteAdapterInner_001
|
||||
* @tc.desc: check StartAbilityFromRemoteAdapterInner
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteAdapterInner_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteAdapterInner_001 begin" << std::endl;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
int32_t result = DistributedSchedService::GetInstance().StartAbilityFromRemoteAdapterInner(data, reply);
|
||||
EXPECT_NE(result, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteAdapterInner_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StopAbilityFromRemoteAdapterInner_001
|
||||
* @tc.desc: check StopAbilityFromRemoteAdapterInner
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedStubTest, StopAbilityFromRemoteAdapterInner_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedStubTest StopAbilityFromRemoteAdapterInner_001 begin" << std::endl;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
int32_t result = DistributedSchedService::GetInstance().StopAbilityFromRemoteAdapterInner(data, reply);
|
||||
EXPECT_NE(result, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedStubTest StopAbilityFromRemoteAdapterInner_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ConnectAbilityFromRemoteAdapterInner_001
|
||||
* @tc.desc: check ConnectAbilityFromRemoteAdapterInner
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteAdapterInner_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteAdapterInner_001 begin" << std::endl;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
int32_t result = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteAdapterInner(data, reply);
|
||||
EXPECT_NE(result, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteAdapterInner_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: DisconnectAbilityFromRemoteAdapterInner_001
|
||||
* @tc.desc: check DisconnectAbilityFromRemoteAdapterInner
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedStubTest, DisconnectAbilityFromRemoteAdapterInner_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteAdapterInner_001 begin" << std::endl;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
int32_t result = DistributedSchedService::GetInstance().DisconnectAbilityFromRemoteAdapterInner(data, reply);
|
||||
EXPECT_NE(result, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteAdapterInner_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001
|
||||
* @tc.desc: check NotifyAbilityLifecycleChangedFromRemoteAdapterInner
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DistributedSchedStubTest, NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedStubTest NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001 begin" << std::endl;
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
int32_t result = DistributedSchedService::GetInstance().NotifyAbilityLifecycleChangedFromRemoteAdapterInner(
|
||||
data, reply);
|
||||
EXPECT_NE(result, DMS_PERMISSION_DENIED);
|
||||
DTEST_LOG << "DistributedSchedStubTest NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001 end" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@ -432,5 +432,34 @@ HWTEST_F(DMSNetworkAdapterTest, UpdateDeviceInfoStorage_001, TestSize.Level3)
|
||||
bool result = DnetworkAdapter::GetInstance()->UpdateDeviceInfoStorage();
|
||||
EXPECT_EQ(result, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnDeviceTrustChange_001
|
||||
* @tc.desc: test OnDeviceTrustChange
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSNetworkAdapterTest, OnDeviceTrustChange_001, TestSize.Level3)
|
||||
{
|
||||
std::string udid = "";
|
||||
std::string uuid = "";
|
||||
DnetworkAdapter::GetInstance()->Init();
|
||||
DnetworkAdapter::GetInstance()->devTrustChangeCallback_->OnDeviceTrustChange(
|
||||
udid, uuid, DistributedHardware::DmAuthForm::IDENTICAL_ACCOUNT);
|
||||
|
||||
udid = "udid";
|
||||
DnetworkAdapter::GetInstance()->devTrustChangeCallback_->OnDeviceTrustChange(
|
||||
udid, uuid, DistributedHardware::DmAuthForm::IDENTICAL_ACCOUNT);
|
||||
|
||||
udid = "";
|
||||
uuid = "uuid";
|
||||
DnetworkAdapter::GetInstance()->devTrustChangeCallback_->OnDeviceTrustChange(
|
||||
udid, uuid, DistributedHardware::DmAuthForm::IDENTICAL_ACCOUNT);
|
||||
|
||||
udid = "udid";
|
||||
uuid = "uuid";
|
||||
DnetworkAdapter::GetInstance()->devTrustChangeCallback_->OnDeviceTrustChange(
|
||||
udid, uuid, DistributedHardware::DmAuthForm::IDENTICAL_ACCOUNT);
|
||||
EXPECT_EQ(udid.empty(), false);
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -444,12 +444,70 @@ HWTEST_F(DtbschedmgrDeviceInfoStorageTest, GetNetworkIdList_001, TestSize.Level3
|
||||
std::string netWorkId = "netWorkId";
|
||||
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
|
||||
|
@ -43,7 +43,6 @@ constexpr uint16_t ONE = 1;
|
||||
bool DtbschedmgrDeviceInfoStorage::GetLocalUdid(std::string& udid)
|
||||
{
|
||||
udid = g_mockGetLocalUdid;
|
||||
DTEST_LOG << "shihaojie GetLocalUdid" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,6 @@
|
||||
|
||||
#include "dms_continue_manager_test.h"
|
||||
|
||||
#ifdef DMSFWK_INTERACTIVE_ADAPTER
|
||||
#include "broadcast.h"
|
||||
#endif
|
||||
|
||||
#include "datetime_ex.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
@ -27,18 +23,12 @@
|
||||
#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;
|
||||
using namespace testing::ext;
|
||||
|
||||
#ifdef DMSFWK_INTERACTIVE_ADAPTER
|
||||
int32_t SendEvent(const char* pkgName, BroadCastAddr target, EventData *event)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
@ -60,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()
|
||||
{
|
||||
}
|
||||
@ -70,6 +65,7 @@ void DMSContinueManagerTest::TearDownTestCase()
|
||||
|
||||
void DMSContinueManagerTest::SetUp()
|
||||
{
|
||||
MultiUserManager::GetInstance().Init();
|
||||
}
|
||||
|
||||
void DMSContinueManagerTest::TearDown()
|
||||
@ -92,12 +88,8 @@ HWTEST_F(DMSContinueManagerTest, testUnInit001, TestSize.Level3)
|
||||
DTEST_LOG << "DMSContinueManagerTest testUnInit001 begin" << std::endl;
|
||||
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
EXPECT_NE(sendMgr->eventHandler_, nullptr);
|
||||
|
||||
@ -127,12 +119,8 @@ HWTEST_F(DMSContinueManagerTest, testUnInit002, TestSize.Level3)
|
||||
DTEST_LOG << "DMSContinueManagerTest testUnInit002 begin" << std::endl;
|
||||
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
EXPECT_NE(sendMgr->eventHandler_, nullptr);
|
||||
|
||||
@ -151,12 +139,8 @@ HWTEST_F(DMSContinueManagerTest, testPostUnfocusedTaskWithDelay001, TestSize.Lev
|
||||
DTEST_LOG << "DMSContinueManagerTest testPostUnfocusedTaskWithDelay001 begin" << std::endl;
|
||||
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
|
||||
/**
|
||||
@ -186,12 +170,8 @@ HWTEST_F(DMSContinueManagerTest, testNotifyMissionFocused001, TestSize.Level3)
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyMissionFocused001 begin" << std::endl;
|
||||
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
|
||||
/**
|
||||
@ -221,12 +201,8 @@ HWTEST_F(DMSContinueManagerTest, testNotifyMissionUnfocused001, TestSize.Level3)
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyMissionUnfocused001 begin" << std::endl;
|
||||
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
/**
|
||||
* @tc.steps: step1. test NotifyMissionUnfocused when eventHandler is not nullptr;
|
||||
@ -252,10 +228,7 @@ HWTEST_F(DMSContinueManagerTest, testRegisterOnListener001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testRegisterOnListener001 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->Init();
|
||||
sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
|
||||
int32_t ret = recvMgr->RegisterOnListener(TYPE, obj01);
|
||||
@ -281,10 +254,7 @@ HWTEST_F(DMSContinueManagerTest, testRegisterOffListener001, TestSize.Level1)
|
||||
DTEST_LOG << "DMSContinueManagerTest testRegisterOffListener001 start" << std::endl;
|
||||
sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->RegisterOnListener(TYPE, obj01);
|
||||
ret = recvMgr->RegisterOffListener(TYPE, obj01);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -305,10 +275,7 @@ HWTEST_F(DMSContinueManagerTest, testRegisterOffListener002, TestSize.Level3)
|
||||
DTEST_LOG << "DMSContinueManagerTest testRegisterOffListener002 start" << std::endl;
|
||||
sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->RegisterOnListener(TYPE, obj01);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
@ -330,10 +297,7 @@ HWTEST_F(DMSContinueManagerTest, testGetMissionId001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetMissionId001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->focusedMission_[BUNDLENAME_01] = MISSIONID_01;
|
||||
int32_t missionId;
|
||||
int32_t ret = sendMgr->GetMissionIdByBundleName(BUNDLENAME_01, missionId);
|
||||
@ -359,10 +323,7 @@ HWTEST_F(DMSContinueManagerTest, testDealFocusedBusiness001, TestSize.Level3)
|
||||
* @tc.steps: step1. test DealFocusedBusiness when missionId is invalid;
|
||||
*/
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
int32_t ret = sendMgr->DealFocusedBusiness(-1, FocusedReason::MIN);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
|
||||
@ -383,10 +344,7 @@ HWTEST_F(DMSContinueManagerTest, testDealUnfocusedBusiness001, TestSize.Level3)
|
||||
* @tc.steps: step1. test DealUnfocusedBusiness when missionId is invalid;
|
||||
*/
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
int32_t ret = sendMgr->DealUnfocusedBusiness(-1, UnfocusedReason::NORMAL);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
|
||||
@ -403,10 +361,7 @@ HWTEST_F(DMSContinueManagerTest, testDealUnfocusedBusiness001, TestSize.Level3)
|
||||
*/
|
||||
sptr<IRemoteObject> obj01 = nullptr;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->NotifyDied(obj01);
|
||||
|
||||
/**
|
||||
@ -438,10 +393,7 @@ HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource001, TestSize.Level3)
|
||||
std::string sinkBundleName = "test sinkBundleName";
|
||||
std::string continueType = "test continueType";
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->VerifyBroadcastSource(networkId,
|
||||
sourceBundleName, sinkBundleName, continueType, state);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -466,10 +418,7 @@ HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource002, TestSize.Level3)
|
||||
std::string sinkBundleName = "test sinkBundleName";
|
||||
std::string continueType = "test continueType";
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->VerifyBroadcastSource(networkId, sourceBundleName, sinkBundleName, continueType, state);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
@ -494,10 +443,7 @@ HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource003, TestSize.Level3)
|
||||
std::string sinkBundleName = "test sinkBundleName";
|
||||
std::string continueType = "test continueType";
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->VerifyBroadcastSource(networkId, sourceBundleName, sinkBundleName, continueType, state);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
@ -527,10 +473,7 @@ HWTEST_F(DMSContinueManagerTest, testDealOnBroadcastBusiness001, TestSize.Level3
|
||||
int32_t state = 0;
|
||||
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->PostOnBroadcastBusiness(senderNetworkId, bundleNameId, continueTypeId, state);
|
||||
|
||||
int32_t ret = recvMgr->DealOnBroadcastBusiness(senderNetworkId, bundleNameId, continueTypeId, state, 0);
|
||||
@ -569,10 +512,7 @@ HWTEST_F(DMSContinueManagerTest, testGetBundleName001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetBundleName001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->focusedMission_[BUNDLENAME_01] = MISSIONID_01;
|
||||
std::string bundleName;
|
||||
int32_t ret = sendMgr->GetBundleNameByMissionId(MISSIONID_01, bundleName);
|
||||
@ -593,10 +533,7 @@ HWTEST_F(DMSContinueManagerTest, testIsContinue001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testIsContinue001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->focusedMission_[BUNDLENAME_02] = MISSIONID_02;
|
||||
sendMgr->info_.currentMissionId = MISSIONID_01;
|
||||
sendMgr->info_.currentIsContinuable = true;
|
||||
@ -622,10 +559,7 @@ HWTEST_F(DMSContinueManagerTest, testNotifyDied001, TestSize.Level1)
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDied001 start" << std::endl;
|
||||
sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->RegisterOnListener(TYPE, obj01);
|
||||
EXPECT_EQ(false, recvMgr->registerOnListener_.empty());
|
||||
recvMgr->NotifyDied(obj01);
|
||||
@ -641,12 +575,8 @@ HWTEST_F(DMSContinueManagerTest, testSetMissionContinueState001, TestSize.Level3
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testSetMissionContinueState001 start" << std::endl;
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_ACTIVE;
|
||||
|
||||
@ -674,12 +604,8 @@ HWTEST_F(DMSContinueManagerTest, testSetMissionContinueState002, TestSize.Level3
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testSetMissionContinueState002 start" << std::endl;
|
||||
DistributedSchedUtil::MockManageMissions();
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_INACTIVE;
|
||||
|
||||
@ -708,10 +634,7 @@ HWTEST_F(DMSContinueManagerTest, testDealSetMissionContinueStateBusiness001, Tes
|
||||
DTEST_LOG << "DMSContinueManagerTest testDealSetMissionContinueStateBusiness001 start" << std::endl;
|
||||
OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_ACTIVE;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->info_.currentMissionId = MISSIONID_01;
|
||||
|
||||
/**
|
||||
@ -739,10 +662,7 @@ HWTEST_F(DMSContinueManagerTest, testDealSetMissionContinueStateBusiness002, Tes
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testDealSetMissionContinueStateBusiness002 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->info_.currentIsContinuable = true;
|
||||
OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_ACTIVE;
|
||||
int32_t ret = sendMgr->DealSetMissionContinueStateBusiness(MISSIONID_01, state);
|
||||
@ -764,12 +684,8 @@ HWTEST_F(DMSContinueManagerTest, testOnDeviceScreenOff001, TestSize.Level1)
|
||||
/**
|
||||
* @tc.steps: step1. test OnDeviceScreenOff when eventHandler is not nullptr;
|
||||
*/
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->Init();
|
||||
sendMgr->OnDeviceScreenOff();
|
||||
EXPECT_NE(sendMgr->eventHandler_, nullptr);
|
||||
@ -793,10 +709,7 @@ HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.senderNetworkId = NETWORKID_01;
|
||||
recvMgr->NotifyDeviceOffline(NETWORKID_01);
|
||||
|
||||
@ -815,10 +728,7 @@ HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline002, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline002 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.senderNetworkId = NETWORKID_01;
|
||||
recvMgr->NotifyDeviceOffline("");
|
||||
EXPECT_EQ(recvMgr->iconInfo_.senderNetworkId, NETWORKID_01);
|
||||
@ -835,10 +745,7 @@ HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline003, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline003 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.senderNetworkId = NETWORKID_01;
|
||||
recvMgr->NotifyDeviceOffline(NETWORKID_02);
|
||||
EXPECT_EQ(recvMgr->iconInfo_.senderNetworkId, NETWORKID_01);
|
||||
@ -856,10 +763,7 @@ HWTEST_F(DMSContinueManagerTest, notifyPackageRemoved001, TestSize.Level1)
|
||||
DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved001 start" << std::endl;
|
||||
sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->RegisterOnListener(TYPE, obj01);
|
||||
EXPECT_NE(recvMgr->registerOnListener_.size(), 0);
|
||||
|
||||
@ -879,10 +783,7 @@ HWTEST_F(DMSContinueManagerTest, notifyPackageRemoved002, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved002 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.bundleName = BUNDLENAME_01;
|
||||
recvMgr->NotifyPackageRemoved("");
|
||||
EXPECT_EQ(recvMgr->iconInfo_.bundleName, BUNDLENAME_01);
|
||||
@ -899,10 +800,7 @@ HWTEST_F(DMSContinueManagerTest, notifyPackageRemoved003, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved003 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.bundleName = BUNDLENAME_01;
|
||||
recvMgr->NotifyPackageRemoved(BUNDLENAME_02);
|
||||
EXPECT_EQ(recvMgr->iconInfo_.bundleName, BUNDLENAME_01);
|
||||
@ -922,10 +820,7 @@ HWTEST_F(DMSContinueManagerTest, testNotifyDataRecv001, TestSize.Level1)
|
||||
uint8_t payload[] = {0xf0};
|
||||
uint32_t dataLen1 = DMS_SEND_LEN - 1;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->NotifyDataRecv(senderNetworkId, payload, dataLen1);
|
||||
|
||||
uint32_t dataLen2 = DMS_SEND_LEN;
|
||||
@ -946,10 +841,7 @@ HWTEST_F(DMSContinueManagerTest, testSendSoftbusEvent001, TestSize.Level1)
|
||||
uint8_t continueType = 1;
|
||||
uint8_t type = 0;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
bool ret = sendMgr->SendSoftbusEvent(bundleNameId, continueType, type);
|
||||
EXPECT_NE(ret, CAN_NOT_FOUND_ABILITY_ERR);
|
||||
DTEST_LOG << "DMSContinueManagerTest testSendSoftbusEvent001 end" << std::endl;
|
||||
@ -964,10 +856,7 @@ HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOnline001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOnline001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
int32_t ret = sendMgr->NotifyDeviceOnline();
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOnline001 end" << std::endl;
|
||||
@ -982,10 +871,7 @@ HWTEST_F(DMSContinueManagerTest, testGetAbilityNameByMissionId_001, TestSize.Lev
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetAbilityNameByMissionId_001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->focusedMissionAbility_[MISSIONID_01] = ABILITY_NAME_01;
|
||||
std::string abilityName;
|
||||
int32_t ret = sendMgr->GetAbilityNameByMissionId(MISSIONID_01, abilityName);
|
||||
@ -1003,10 +889,7 @@ HWTEST_F(DMSContinueManagerTest, testFocusedBusinessSendEvent_001, TestSize.Leve
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testFocusedBusinessSendEvent_001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
int32_t ret = sendMgr->FocusedBusinessSendEvent(BUNDLENAME_01, ABILITY_NAME_01);
|
||||
|
||||
EXPECT_EQ(ret, CAN_NOT_FOUND_ABILITY_ERR);
|
||||
@ -1022,10 +905,7 @@ HWTEST_F(DMSContinueManagerTest, testGetBundleNameIdAndContinueTypeId_001, TestS
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetBundleNameIdAndContinueTypeId_001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->focusedMission_[BUNDLENAME_01] = MISSIONID_01;
|
||||
sendMgr->focusedMissionAbility_[MISSIONID_01] = ABILITY_NAME_01;
|
||||
uint16_t bundleNameId = 0;
|
||||
@ -1051,10 +931,7 @@ HWTEST_F(DMSContinueManagerTest, testGetContinueType_001, TestSize.Level1)
|
||||
std::string sinkBundleName = "test sinkBundleName";
|
||||
std::string continueType = "test continueType";
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
int32_t ret = recvMgr->VerifyBroadcastSource(networkId, sourceBundleName, sinkBundleName, continueType, state);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
@ -1075,10 +952,7 @@ HWTEST_F(DMSContinueManagerTest, testSetScreenOffInfo_001, TestSize.Level1)
|
||||
uint16_t bundleNameId = 0;
|
||||
std::string abilityName = "abilityName";
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->screenOffHandler_ =
|
||||
std::make_shared<DMSContinueSendMgr::ScreenOffHandler>();
|
||||
sendMgr->screenOffHandler_->SetScreenOffInfo(missionId, bundleName,
|
||||
@ -1099,10 +973,7 @@ HWTEST_F(DMSContinueManagerTest, testSetStateSendEvent_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testSetStateSendEvent_001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
int32_t ret = sendMgr->SetStateSendEvent(0, 0, AAFwk::ContinueState::CONTINUESTATE_INACTIVE);
|
||||
EXPECT_NE(ret, DMS_PERMISSION_DENIED);
|
||||
|
||||
@ -1121,10 +992,7 @@ HWTEST_F(DMSContinueManagerTest, testGetContinueLaunchMissionInfo_001, TestSize.
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetContinueLaunchMissionInfo_001 start" << std::endl;
|
||||
ContinueLaunchMissionInfo missionInfo = {"com.test.missionInfo", "MainAbility"};
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->continueLaunchMission_.clear();
|
||||
int32_t ret = sendMgr->GetContinueLaunchMissionInfo(MISSIONID_01, missionInfo);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -1151,10 +1019,7 @@ HWTEST_F(DMSContinueManagerTest, testUpdateContinueLaunchMission_001, TestSize.L
|
||||
info.id = MISSIONID_01;
|
||||
info.want = want;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
EXPECT_FALSE(sendMgr->UpdateContinueLaunchMission(info));
|
||||
|
||||
info.want.SetFlags(AAFwk::Want::FLAG_ABILITY_CONTINUATION);
|
||||
@ -1178,10 +1043,7 @@ HWTEST_F(DMSContinueManagerTest, testGetFinalBundleName_001, TestSize.Level1)
|
||||
AppExecFwk::BundleInfo localBundleInfo;
|
||||
std::string continueType;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
bool ret = recvMgr->GetFinalBundleName(info, finalBundleName, localBundleInfo, continueType);
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetFinalBundleName_001 end" << std::endl;
|
||||
@ -1210,10 +1072,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_001, TestSize.Level1)
|
||||
|
||||
localBundleInfo.abilityInfos = abilityInfos;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||
EXPECT_EQ(ret, false);
|
||||
|
||||
@ -1243,10 +1102,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_002, TestSize.Level1)
|
||||
|
||||
localBundleInfo.abilityInfos = abilityInfos;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||
EXPECT_EQ(ret, true);
|
||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_002 end" << std::endl;
|
||||
@ -1277,10 +1133,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_003, TestSize.Level1)
|
||||
|
||||
localBundleInfo.abilityInfos = abilityInfos;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_003 end" << std::endl;
|
||||
@ -1311,10 +1164,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_004, TestSize.Level1)
|
||||
|
||||
localBundleInfo.abilityInfos = abilityInfos;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_004 end" << std::endl;
|
||||
@ -1345,10 +1195,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_005, TestSize.Level1)
|
||||
|
||||
localBundleInfo.abilityInfos = abilityInfos;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_005 end" << std::endl;
|
||||
@ -1363,10 +1210,7 @@ HWTEST_F(DMSContinueManagerTest, GetBundleNameByScreenOffInfo_001, TestSize.Leve
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest GetBundleNameByScreenOffInfo_001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->screenOffHandler_ = nullptr;
|
||||
int32_t missionId = 0;
|
||||
std::string bundleName;
|
||||
@ -1396,10 +1240,7 @@ HWTEST_F(DMSContinueManagerTest, SendScreenOffEvent_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest SendScreenOffEvent_001 start" << std::endl;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->screenOffHandler_ = nullptr;
|
||||
int32_t ret = sendMgr->SendScreenOffEvent(DMS_FOCUSED_TYPE);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -1420,10 +1261,7 @@ HWTEST_F(DMSContinueManagerTest, DeleteContinueLaunchMissionInfo_001, TestSize.L
|
||||
DTEST_LOG << "DMSContinueManagerTest DeleteContinueLaunchMissionInfo_001 start" << std::endl;
|
||||
int32_t missionId = 0;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
sendMgr->continueLaunchMission_.clear();
|
||||
sendMgr->DeleteContinueLaunchMissionInfo(missionId);
|
||||
|
||||
@ -1444,10 +1282,7 @@ HWTEST_F(DMSContinueManagerTest, CheckContinueState_001, TestSize.Level1)
|
||||
DTEST_LOG << "DMSContinueManagerTest CheckContinueState_001 start" << std::endl;
|
||||
int32_t missionId = 0;
|
||||
auto sendMgr = MultiUserManager::GetInstance().GetCurrentSendMgr();
|
||||
if (sendMgr == nullptr) {
|
||||
DTEST_LOG << "GetSendMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, sendMgr);
|
||||
int32_t ret = sendMgr->CheckContinueState(missionId);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
DTEST_LOG << "DMSContinueManagerTest CheckContinueState_001 end" << std::endl;
|
||||
@ -1462,10 +1297,7 @@ HWTEST_F(DMSContinueManagerTest, OnContinueSwitchOff_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest OnContinueSwitchOff_001 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.senderNetworkId = "";
|
||||
recvMgr->iconInfo_.bundleName = "";
|
||||
recvMgr->iconInfo_.continueType = "";
|
||||
@ -1490,10 +1322,7 @@ HWTEST_F(DMSContinueManagerTest, OnUserSwitch_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest OnUserSwitch_001 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
recvMgr->iconInfo_.senderNetworkId = "";
|
||||
recvMgr->iconInfo_.bundleName = "";
|
||||
recvMgr->iconInfo_.continueType = "";
|
||||
@ -1518,10 +1347,7 @@ HWTEST_F(DMSContinueManagerTest, FindToNotifyRecvBroadcast_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest FindToNotifyRecvBroadcast_001 start" << std::endl;
|
||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
if (recvMgr == nullptr) {
|
||||
DTEST_LOG << "GetRecvMgr failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
ASSERT_NE(nullptr, recvMgr);
|
||||
std::string senderNetworkId = "senderNetworkId";
|
||||
std::string bundleName = "bundleName";
|
||||
std::string continueType = "senderNetworkId";
|
||||
|
@ -179,11 +179,8 @@ HWTEST_F(MultiUserManagerTest, MultiUserManager_CreateNewSendMgr_001, TestSize.L
|
||||
/**
|
||||
* @tc.steps: step1. test OnUserRemoved with create current user sendMgr;
|
||||
*/
|
||||
MultiUserManager::GetInstance().Init();
|
||||
int32_t ret = MultiUserManager::GetInstance().CreateNewSendMgr();
|
||||
int32_t ret = MultiUserManager::GetInstance().CreateNewSendMgrLocked();
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
MultiUserManager::GetInstance().UnInit();
|
||||
DTEST_LOG << "MultiUserManager_CreateNewSendMgr_001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -198,11 +195,8 @@ HWTEST_F(MultiUserManagerTest, MultiUserManager_CreateNewRecvMgr_001, TestSize.L
|
||||
/**
|
||||
* @tc.steps: step1. test OnUserRemoved with create current user recvMgr;
|
||||
*/
|
||||
MultiUserManager::GetInstance().Init();
|
||||
int32_t ret = MultiUserManager::GetInstance().CreateNewRecvMgr();
|
||||
int32_t ret = MultiUserManager::GetInstance().CreateNewRecvMgrLocked();
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
|
||||
MultiUserManager::GetInstance().UnInit();
|
||||
DTEST_LOG << "MultiUserManager_CreateNewRecvMgr_001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -246,7 +240,7 @@ HWTEST_F(MultiUserManagerTest, MultiUserManager_GetCurrentRecvMgr_001, TestSize.
|
||||
int32_t accountId = 100;
|
||||
MultiUserManager::GetInstance().Init();
|
||||
auto recvMgr = MultiUserManager::GetInstance().recvMgrMap_.find(accountId)->second;
|
||||
|
||||
MultiUserManager::GetInstance().hasRegSoftbusEventListener_ = true;
|
||||
auto ret = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||
EXPECT_EQ(ret, recvMgr);
|
||||
|
||||
@ -259,6 +253,25 @@ HWTEST_F(MultiUserManagerTest, MultiUserManager_GetCurrentRecvMgr_001, TestSize.
|
||||
DTEST_LOG << "MultiUserManager_GetCurrentRecvMgr_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MultiUserManager_CheckRegSoftbusListener_001
|
||||
* @tc.desc: test CheckRegSoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(MultiUserManagerTest, MultiUserManager_CheckRegSoftbusListener_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "MultiUserManager_CheckRegSoftbusListener_001 start" << std::endl;
|
||||
/**
|
||||
* @tc.steps: step1. test OnUserRemoved with create current user recvMgr;
|
||||
*/
|
||||
MultiUserManager::GetInstance().hasRegSoftbusEventListener_ = false;
|
||||
EXPECT_FALSE(MultiUserManager::GetInstance().CheckRegSoftbusListener());
|
||||
MultiUserManager::GetInstance().RegisterSoftbusListener();
|
||||
EXPECT_TRUE(MultiUserManager::GetInstance().hasRegSoftbusEventListener_);
|
||||
EXPECT_TRUE(MultiUserManager::GetInstance().CheckRegSoftbusListener());
|
||||
DTEST_LOG << "MultiUserManager_CheckRegSoftbusListener_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MultiUserManager_OnRegisterOnListener_001
|
||||
* @tc.desc: test OnRegisterOnListener
|
||||
|
@ -28,6 +28,7 @@ namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string NETWORKID_01 = "networkId01";
|
||||
constexpr int32_t RETRY_SENT_EVENT_MAX_TIME = 3;
|
||||
const int32_t WAITTIME = 2000;
|
||||
}
|
||||
|
||||
void SoftbusAdapterTest::SetUpTestCase()
|
||||
@ -64,8 +65,8 @@ HWTEST_F(SoftbusAdapterTest, SendSoftbusEvent_001, TestSize.Level3)
|
||||
int32_t result = SoftbusAdapter::GetInstance().SendSoftbusEvent(buffer);
|
||||
EXPECT_EQ(result, SOFTBUS_OK);
|
||||
|
||||
SoftbusMock sortbusMock;
|
||||
SoftbusAdapter::GetInstance().Init();
|
||||
usleep(WAITTIME);
|
||||
result = SoftbusAdapter::GetInstance().SendSoftbusEvent(buffer);
|
||||
EXPECT_EQ(result, SOFTBUS_OK);
|
||||
SoftbusAdapter::GetInstance().UnInit();
|
||||
@ -88,6 +89,7 @@ HWTEST_F(SoftbusAdapterTest, DealSendSoftbusEvent_001, TestSize.Level3)
|
||||
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
|
||||
|
||||
SoftbusAdapter::GetInstance().Init();
|
||||
usleep(WAITTIME);
|
||||
result = SoftbusAdapter::GetInstance().DealSendSoftbusEvent(nullptr, retry);
|
||||
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
|
||||
|
||||
@ -124,6 +126,7 @@ HWTEST_F(SoftbusAdapterTest, RetrySendSoftbusEvent_001, TestSize.Level3)
|
||||
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
|
||||
|
||||
SoftbusAdapter::GetInstance().Init();
|
||||
usleep(WAITTIME);
|
||||
result = SoftbusAdapter::GetInstance().RetrySendSoftbusEvent(buffer, retry);
|
||||
EXPECT_EQ(result, ERR_OK);
|
||||
SoftbusAdapter::GetInstance().UnInit();
|
||||
|
@ -465,12 +465,10 @@ HWTEST_F(DSchedSoftbusSessionTest, GetFragDataHeader_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, PackRecvData_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest PackRecvData_001 begin" << std::endl;
|
||||
int32_t sessionId = 0;
|
||||
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(DSCHED_BUFFER_SIZE_100);
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
softbusSessionTest_->PackRecvData(buffer);
|
||||
EXPECT_EQ(0, sessionId);
|
||||
EXPECT_NO_FATAL_FAILURE(softbusSessionTest_->PackRecvData(buffer));
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest PackRecvData_001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -483,7 +481,6 @@ HWTEST_F(DSchedSoftbusSessionTest, PackRecvData_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, AssembleNoFrag_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest AssembleFrag_001 begin" << std::endl;
|
||||
int32_t sessionId = 0;
|
||||
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara = {0, 0, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
|
||||
@ -491,8 +488,7 @@ HWTEST_F(DSchedSoftbusSessionTest, AssembleNoFrag_001, TestSize.Level3)
|
||||
softbusSessionTest_->AssembleNoFrag(buffer, headerPara);
|
||||
|
||||
headerPara.totalLen = TOTALLEN_1;
|
||||
softbusSessionTest_->AssembleNoFrag(buffer, headerPara);
|
||||
EXPECT_EQ(0, sessionId);
|
||||
EXPECT_NO_FATAL_FAILURE(softbusSessionTest_->AssembleNoFrag(buffer, headerPara));
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest AssembleNoFrag_001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -504,7 +500,6 @@ HWTEST_F(DSchedSoftbusSessionTest, AssembleNoFrag_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, AssembleFrag_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest AssembleFrag_001 begin" << std::endl;
|
||||
int32_t sessionId = 0;
|
||||
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara =
|
||||
{0, DSchedSoftbusSession::FRAG_START, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
|
||||
@ -514,8 +509,7 @@ HWTEST_F(DSchedSoftbusSessionTest, AssembleFrag_001, TestSize.Level3)
|
||||
headerPara.fragFlag = DSchedSoftbusSession::FRAG_MID;
|
||||
softbusSessionTest_->AssembleFrag(buffer, headerPara);
|
||||
headerPara.fragFlag = DSchedSoftbusSession::FRAG_END;
|
||||
softbusSessionTest_->AssembleFrag(buffer, headerPara);
|
||||
EXPECT_EQ(0, sessionId);
|
||||
EXPECT_NO_FATAL_FAILURE(softbusSessionTest_->AssembleFrag(buffer, headerPara));
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest AssembleFrag_001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -527,7 +521,6 @@ HWTEST_F(DSchedSoftbusSessionTest, AssembleFrag_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, SetHeadParaDataLen_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest SetHeadParaDataLen_001 begin" << std::endl;
|
||||
int32_t sessionId = 0;
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara = {0, 0, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
|
||||
uint32_t totalLen = TOTALLEN;
|
||||
uint32_t offset = OFFSET_1;
|
||||
@ -537,8 +530,7 @@ HWTEST_F(DSchedSoftbusSessionTest, SetHeadParaDataLen_001, TestSize.Level3)
|
||||
softbusSessionTest_->SetHeadParaDataLen(headerPara, totalLen, offset, maxSendSize);
|
||||
offset = DSCHED_BUFFER_SIZE_100;
|
||||
softbusSessionTest_->SetHeadParaDataLen(headerPara, totalLen, offset, maxSendSize);
|
||||
softbusSessionTest_->GetNowTimeStampUs();
|
||||
EXPECT_EQ(0, sessionId);
|
||||
EXPECT_NO_FATAL_FAILURE(softbusSessionTest_->GetNowTimeStampUs());
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest SetHeadParaDataLen_001 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -550,7 +542,6 @@ HWTEST_F(DSchedSoftbusSessionTest, SetHeadParaDataLen_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, MakeFragDataHeader_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest MakeFragDataHeader_001 begin" << std::endl;
|
||||
int32_t sessionId = 0;
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara = {0};
|
||||
uint8_t *header = new uint8_t[DSCHED_BUFFER_SIZE_100] {0};
|
||||
uint32_t len = HEADERLEN;
|
||||
@ -558,8 +549,7 @@ HWTEST_F(DSchedSoftbusSessionTest, MakeFragDataHeader_001, TestSize.Level3)
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
softbusSessionTest_->MakeFragDataHeader(headerPara, header, len);
|
||||
uint8_t *header1 = new uint8_t[HEADERLEN] {0};
|
||||
softbusSessionTest_->MakeFragDataHeader(headerPara, header1, len);
|
||||
EXPECT_EQ(0, sessionId);
|
||||
EXPECT_NO_FATAL_FAILURE(softbusSessionTest_->MakeFragDataHeader(headerPara, header1, len));
|
||||
delete[] header;
|
||||
delete[] header1;
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest MakeFragDataHeader_001 end" << std::endl;
|
||||
@ -573,7 +563,6 @@ HWTEST_F(DSchedSoftbusSessionTest, MakeFragDataHeader_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, WriteTlvToBuffer_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest WriteTlvToBuffer_001 begin" << std::endl;
|
||||
int32_t sessionId = 0;
|
||||
DSchedSoftbusSession::TlvItem tlvItem = {SIZE_4, SIZE_4, SEQ_2};
|
||||
uint8_t *buffer = new uint8_t[SIZE_50] {0};
|
||||
uint32_t bufLen = SIZE_50;
|
||||
@ -582,8 +571,7 @@ HWTEST_F(DSchedSoftbusSessionTest, WriteTlvToBuffer_001, TestSize.Level3)
|
||||
softbusSessionTest_->WriteTlvToBuffer(tlvItem, buffer, bufLen);
|
||||
uint8_t * buffer1 = new uint8_t[SEQ_1] {0};
|
||||
uint32_t bufLen1 = SIZE_1;
|
||||
softbusSessionTest_->WriteTlvToBuffer(tlvItem, buffer1, bufLen1);
|
||||
EXPECT_EQ(0, sessionId);
|
||||
EXPECT_NO_FATAL_FAILURE(softbusSessionTest_->WriteTlvToBuffer(tlvItem, buffer1, bufLen1));
|
||||
delete[] buffer;
|
||||
delete[] buffer1;
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest WriteTlvToBuffer_001 end" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user