Description:add ut

Match-id-3673385e15bc59cc76b80fd8e51e51f17e0e0d60
This commit is contained in:
xxxx
2022-12-01 20:30:08 +08:00
parent 43dade533d
commit ba5667e98e
14 changed files with 547 additions and 35 deletions
+3 -3
View File
@@ -25,9 +25,9 @@ const uint32_t AUTH_SESSION_SIDE_CLIENT = 1;
constexpr int32_t DH_ERROR = -1;
constexpr int32_t MOCK_SESSION_ID = 1;
static ISessionListener g_listener;
static char g_peerDeviceId[CHAR_ARRAY_SIZE];
static char g_peerSessionName[CHAR_ARRAY_SIZE];
static char g_mySessionName[CHAR_ARRAY_SIZE];
static char g_peerDeviceId[CHAR_ARRAY_SIZE + 1];
static char g_peerSessionName[CHAR_ARRAY_SIZE + 1];
static char g_mySessionName[CHAR_ARRAY_SIZE + 1];
int CreateSessionServer(const char *pkgName, const char *sessionName, const ISessionListener *listener)
{
std::cout << "CreateSessionServer start sessionName:" << sessionName << std::endl;
@@ -64,6 +64,11 @@ HWTEST_F(DInputDfxUtilsTest, HiDump_002, testing::ext::TestSize.Level1)
args.push_back("-sessioninfo");
ret = HiDumper::GetInstance().HiDump(args, result);
EXPECT_EQ(true, ret);
args.clear();
args.push_back("args_test");
ret = HiDumper::GetInstance().HiDump(args, result);
EXPECT_EQ(false, ret);
}
HWTEST_F(DInputDfxUtilsTest, GetAllNodeInfos_001, testing::ext::TestSize.Level1)
@@ -85,17 +90,24 @@ HWTEST_F(DInputDfxUtilsTest, GetAllNodeInfos_001, testing::ext::TestSize.Level1)
HWTEST_F(DInputDfxUtilsTest, GetSessionInfo_001, testing::ext::TestSize.Level1)
{
std::string remoteDevId = "umkyu1b165e1be98151891erbe8r91ev";
std::string remoteDevId1 = "remoteDevId_test";
int32_t sessionId = 1;
std::string mySessionName = "mySessionName_test";
std::string peerSessionName = "peerSessionName_test";
SessionStatus sessionStatus = SessionStatus::OPENED;
std::string result = "";
HiDumper::GetInstance().CreateSessionInfo(remoteDevId, sessionId, mySessionName, peerSessionName, sessionStatus);
EXPECT_EQ(1, HiDumper::GetInstance().sessionInfos_.size());
sessionStatus = SessionStatus::CLOSED;
HiDumper::GetInstance().SetSessionStatus(remoteDevId, sessionStatus);
HiDumper::GetInstance().SetSessionStatus(remoteDevId1, sessionStatus);
HiDumper::GetInstance().DeleteSessionInfo(remoteDevId);
EXPECT_EQ(0, HiDumper::GetInstance().sessionInfos_.size());
HiDumper::GetInstance().DeleteSessionInfo(remoteDevId1);
std::string result = "";
int32_t ret = HiDumper::GetInstance().GetSessionInfo(result);
EXPECT_EQ(DH_SUCCESS, ret);
}
@@ -70,6 +70,13 @@ HWTEST_F(DistributedInputCollectorTest, Init02, testing::ext::TestSize.Level1)
HWTEST_F(DistributedInputCollectorTest, IsAllDevicesStoped01, testing::ext::TestSize.Level1)
{
uint32_t inputTypes = 1;
std::map<int32_t, std::string> deviceInfo;
std::vector<std::string> dhIds;
std::string mouseNodePath = "mouseNodePath_test";
std::string dhid = "dhid_test";
DistributedInputCollector::GetInstance().GetDeviceInfoByType(inputTypes, deviceInfo);
DistributedInputCollector::GetInstance().GetMouseNodePath(dhIds, mouseNodePath, dhid);
bool isStop = DistributedInputCollector::GetInstance().IsAllDevicesStoped();
EXPECT_EQ(true, isStop);
}
@@ -77,17 +84,24 @@ HWTEST_F(DistributedInputCollectorTest, IsAllDevicesStoped01, testing::ext::Test
HWTEST_F(DistributedInputCollectorTest, IsAllDevicesStoped02, testing::ext::TestSize.Level1)
{
DistributedInputCollector::GetInstance().inputHub_ = nullptr;
uint32_t inputTypes = 1;
std::map<int32_t, std::string> deviceInfo;
std::vector<std::string> dhIds;
std::string mouseNodePath = "mouseNodePath_test";
std::string dhid = "dhid_test";
DistributedInputCollector::GetInstance().GetDeviceInfoByType(inputTypes, deviceInfo);
DistributedInputCollector::GetInstance().GetMouseNodePath(dhIds, mouseNodePath, dhid);
bool isStop = DistributedInputCollector::GetInstance().IsAllDevicesStoped();
EXPECT_EQ(false, isStop);
}
HWTEST_F(DistributedInputCollectorTest, GetDeviceInfoByType01, testing::ext::TestSize.Level1)
HWTEST_F(DistributedInputCollectorTest, SetSharingTypes01, testing::ext::TestSize.Level1)
{
DistributedInputCollector::GetInstance().inputHub_ = nullptr;
uint32_t inputTypes = 1;
std::map<int32_t, std::string> deviceInfo;
DistributedInputCollector::GetInstance().GetDeviceInfoByType(inputTypes, deviceInfo);
EXPECT_EQ(0, deviceInfo.size());
DistributedInputCollector::GetInstance().inputHub_ = std::make_unique<InputHub>();
bool enabled = true;
uint32_t inputType = static_cast<uint32_t>(DInputDeviceType::ALL);
AffectDhIds ret = DistributedInputCollector::GetInstance().SetSharingTypes(enabled, inputType);
EXPECT_EQ(0, ret.sharingDhIds.size());
}
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -72,6 +72,8 @@ ohos_unittest("distributed_input_sinkmanager_test") {
"distributed_input_sinkmanager_test.cpp",
"${common_path}/test/mock/session_mock.cpp",
"${common_path}/test/mock/softbus_bus_center_mock.cpp",
"${ipc_path}/src/get_sink_screen_infos_call_back_stub.cpp",
"${ipc_path}/src/sharing_dhid_listener_stub.cpp",
]
cflags = [
@@ -18,6 +18,7 @@
#include "if_system_ability_manager.h"
#include "iservice_registry.h"
#include "system_ability_definition.h"
#include "nlohmann/json.hpp"
#include "dinput_errcode.h"
@@ -48,6 +49,23 @@ void DistributedInputSinkManagerTest::TearDownTestCase()
{
}
void DistributedInputSinkManagerTest::TestGetSinkScreenInfosCb::OnResult(const std::string& strJson)
{
(void)strJson;
}
int32_t DistributedInputSinkManagerTest::TestSharingDhIdListenerStub::OnSharing(std::string dhId)
{
(void)dhId;
return DH_SUCCESS;
}
int32_t DistributedInputSinkManagerTest::TestSharingDhIdListenerStub::OnNoSharing(std::string dhId)
{
(void)dhId;
return DH_SUCCESS;
}
HWTEST_F(DistributedInputSinkManagerTest, InitAuto, testing::ext::TestSize.Level0)
{
bool ret = sinkManager_->InitAuto();
@@ -89,26 +107,20 @@ HWTEST_F(DistributedInputSinkManagerTest, IsStopDhidOnCmdStillNeed01, testing::e
dhIds.push_back("Input_123123123123");
dhIds.push_back("Input_456456456456");
dhIds.push_back("Input_789789789789");
sinkManager_->StoreStartDhids(100, dhIds);
sinkManager_->StoreStartDhids(sessionId, dhIds);
std::string stopDhId = "Input_123123123123";
bool ret = sinkManager_->IsStopDhidOnCmdStillNeed(sessionId, stopDhId);
EXPECT_EQ(false, ret);
EXPECT_EQ(true, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, IsStopDhidOnCmdStillNeed02, testing::ext::TestSize.Level0)
{
int32_t sessionId = 1;
std::vector<std::string> dhIds;
dhIds.push_back("Input_123123123123");
dhIds.push_back("Input_456456456456");
dhIds.push_back("Input_789789789789");
sinkManager_->StoreStartDhids(sessionId, dhIds);
sessionId = 1000;
int32_t sessionId = 1000;
std::string stopDhId = "Input_123123123123";
bool ret = sinkManager_->IsStopDhidOnCmdStillNeed(sessionId, stopDhId);
EXPECT_EQ(true, ret);
EXPECT_EQ(false, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, DeleteStopDhids01, testing::ext::TestSize.Level0)
@@ -121,16 +133,120 @@ HWTEST_F(DistributedInputSinkManagerTest, DeleteStopDhids01, testing::ext::TestS
sinkManager_->sharingDhIds_.insert(iter);
}
sinkManager_->sharingDhIdsMap_[sessionId] = sinkManager_->sharingDhIds_;
sinkManager_->DeleteStopDhids(100, stopDhIds, stopIndeedDhIds);
sinkManager_->DeleteStopDhids(sessionId, stopDhIds, stopIndeedDhIds);
EXPECT_EQ(0, sinkManager_->sharingDhIdsMap_.size());
}
HWTEST_F(DistributedInputSinkManagerTest, GetSinkScreenInfosCbackSize01, testing::ext::TestSize.Level0)
{
uint32_t ret = sinkManager_->GetSinkScreenInfosCbackSize();
EXPECT_EQ(0, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, RegisterGetSinkScreenInfosCallback_01, testing::ext::TestSize.Level1)
{
sptr<TestGetSinkScreenInfosCb> callback = new TestGetSinkScreenInfosCb();
int32_t ret = sinkManager_->RegisterGetSinkScreenInfosCallback(callback);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, StringSplit_01, testing::ext::TestSize.Level1)
{
char splitPoint = '.';
std::string str = "";
std::vector<std::string> vecStr;
sinkManager_->statuslistener_->StringSplit(str, splitPoint, vecStr);
str = "123,123,123,123";
sinkManager_->statuslistener_->StringSplit(str, splitPoint, vecStr);
EXPECT_NE(0, vecStr.size());
}
HWTEST_F(DistributedInputSinkManagerTest, OnMessage_01, testing::ext::TestSize.Level1)
{
int32_t ret = sinkManager_->Init();
sinkManager_->OnStart();
sinkManager_->OnStop();
std::string message = "";
sinkManager_->projectWindowListener_->OnMessage(DHTopic::TOPIC_START_DSCREEN, message);
sinkManager_->projectWindowListener_->OnMessage(DHTopic::TOPIC_SINK_PROJECT_WINDOW_INFO, message);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, ParseMessage_01, testing::ext::TestSize.Level1)
{
std::string message = "";
std::string srcDeviceId = "";
uint64_t srcWinId = 0;
SinkScreenInfo sinkScreenInfo;
int32_t ret = sinkManager_->projectWindowListener_->ParseMessage(message, srcDeviceId, srcWinId, sinkScreenInfo);
EXPECT_EQ(ERR_DH_INPUT_JSON_PARSE_FAIL, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, ParseMessage_02, testing::ext::TestSize.Level1)
{
std::string srcDevId = "umkyu1b165e1be98151891erbe8r91ev";
uint64_t srcWinId = 1;
uint64_t sinkShowWinId = 1;
uint32_t sinkShowWidth = 1860;
uint32_t sinkShowHeigth = 980;
uint32_t sinkShowX = 100;
uint32_t sinkShowY = 100;
nlohmann::json jsonObj;
jsonObj[SOURCE_DEVICE_ID] = srcDevId;
jsonObj[SOURCE_WINDOW_ID] = srcWinId;
jsonObj[SINK_SHOW_WINDOW_ID] = sinkShowWinId;
jsonObj[SINK_PROJECT_SHOW_WIDTH] = sinkShowWidth;
jsonObj[SINK_PROJECT_SHOW_HEIGHT] = sinkShowHeigth;
jsonObj[SINK_WINDOW_SHOW_X] = sinkShowX;
jsonObj[SINK_WINDOW_SHOW_Y] = sinkShowY;
SinkScreenInfo sinkScreenInfo;
int32_t ret = sinkManager_->projectWindowListener_->ParseMessage(jsonObj.dump(),
srcDevId, srcWinId, sinkScreenInfo);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, UpdateSinkScreenInfoCache_01, testing::ext::TestSize.Level1)
{
int32_t ret = sinkManager_->Init();
EXPECT_EQ(DH_SUCCESS, ret);
std::string srcDevId = "umkyu1b165e1be98151891erbe8r91ev";
uint64_t srcWinId = 1;
SinkScreenInfo sinkScreenInfoTmp {2, 1860, 980, 200, 200};
ret = sinkManager_->projectWindowListener_->UpdateSinkScreenInfoCache(srcDevId, srcWinId, sinkScreenInfoTmp);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, NotifyStartDScreen_01, testing::ext::TestSize.Level1)
{
SrcScreenInfo srcScreenInfo {"devid_test", "uuid_test", 1, 1, 1860, 980, "srcphyid", 1, 980, 490};
int32_t ret = sinkManager_->NotifyStartDScreen(srcScreenInfo);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, NotifyStopDScreen_01, testing::ext::TestSize.Level1)
{
std::string srcScreenInfoKey = "";
int32_t ret = sinkManager_->NotifyStopDScreen(srcScreenInfoKey);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_SCREEN_INFO_IS_EMPTY, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, NotifyStopDScreen_02, testing::ext::TestSize.Level1)
{
std::string srcScreenInfoKey = "srcScreenInfoKey_test";
int32_t ret = sinkManager_->NotifyStopDScreen(srcScreenInfoKey);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, RegisterSharingDhIdListener_01, testing::ext::TestSize.Level1)
{
sptr<TestSharingDhIdListenerStub> sharingDhIdListener = new TestSharingDhIdListenerStub();
int32_t ret = sinkManager_->RegisterSharingDhIdListener(sharingDhIdListener);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkManagerTest, Dump_01, testing::ext::TestSize.Level1)
{
int32_t fd = 1;
@@ -26,6 +26,8 @@
#include "constants_dinput.h"
#include "distributed_input_sink_manager.h"
#include "get_sink_screen_infos_call_back_stub.h"
#include "sharing_dhid_listener_stub.h"
namespace OHOS {
namespace DistributedHardware {
@@ -37,6 +39,22 @@ public:
virtual void SetUp() override;
virtual void TearDown() override;
class TestGetSinkScreenInfosCb : public
OHOS::DistributedHardware::DistributedInput::GetSinkScreenInfosCallbackStub {
public:
TestGetSinkScreenInfosCb() = default;
virtual ~TestGetSinkScreenInfosCb() = default;
void OnResult(const std::string& strJson) override;
};
class TestSharingDhIdListenerStub : public
OHOS::DistributedHardware::DistributedInput::SharingDhIdListenerStub {
public:
TestSharingDhIdListenerStub() = default;
virtual ~TestSharingDhIdListenerStub() = default;
int32_t OnSharing(std::string dhId) override;
int32_t OnNoSharing(std::string dhId) override;
};
private:
DistributedInputSinkManager* sinkManager_;
};
@@ -13,17 +13,83 @@
* limitations under the License.
*/
#include "dinput_errcode.h"
#include "distributed_input_sinktrans_test.h"
#include "nlohmann/json.hpp"
#include "dinput_errcode.h"
using namespace testing::ext;
using namespace OHOS::DistributedHardware::DistributedInput;
using namespace std;
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
namespace {
const int32_t SESSIONID = 1;
const int32_t SRCTSRCSEID = 1;
const std::string DEVID = "umkyu1b165e1be98151891erbe8r91ev";
const std::string DHID = "Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
const std::string SINKID = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
const uint32_t INPUTTYPE = static_cast<uint32_t>(DInputDeviceType::ALL);
}
void DistributedInputSinkTransTest::SetUp()
{
jsonStr1_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_PREPARE;
jsonStr1_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr1_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SESSIONID;
jsonStr2_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_UNPREPARE;
jsonStr2_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr2_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SESSIONID;
jsonStr3_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_PREPARE_FOR_REL;
jsonStr3_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr3_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SRCTSRCSEID;
jsonStr4_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_UNPREPARE_FOR_REL;
jsonStr4_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr4_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SRCTSRCSEID;
jsonStr5_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_DHID_FOR_REL;
jsonStr5_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr5_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SRCTSRCSEID;
jsonStr5_[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = DHID;
jsonStr6_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_STOP_DHID_FOR_REL;
jsonStr6_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr6_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SRCTSRCSEID;
jsonStr6_[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = DHID;
jsonStr7_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_TYPE_FOR_REL;
jsonStr7_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr7_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SRCTSRCSEID;
jsonStr7_[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = INPUTTYPE;
jsonStr8_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_STOP_TYPE_FOR_REL;
jsonStr8_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr8_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SRCTSRCSEID;
jsonStr8_[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = INPUTTYPE;
jsonStr9_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_PREPARE;
jsonStr9_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = SINKID;
jsonStr10_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_TO_SOURCE_MSG_UNPREPARE;
jsonStr10_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = SINKID;
jsonStr11_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_START_TYPE;
jsonStr11_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr11_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SESSIONID;
jsonStr11_[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = INPUTTYPE;
jsonStr12_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_STOP_TYPE;
jsonStr12_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr12_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SESSIONID;
jsonStr12_[DINPUT_SOFTBUS_KEY_INPUT_TYPE] = INPUTTYPE;
jsonStr13_[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SOURCE_MSG_LATENCY;
jsonStr13_[DINPUT_SOFTBUS_KEY_DEVICE_ID] = DEVID;
jsonStr13_[DINPUT_SOFTBUS_KEY_SESSION_ID] = SESSIONID;
}
void DistributedInputSinkTransTest::TearDown()
@@ -44,13 +110,22 @@ HWTEST_F(DistributedInputSinkTransTest, Init, testing::ext::TestSize.Level0)
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, GetSessionIdByNetId, testing::ext::TestSize.Level0)
HWTEST_F(DistributedInputSinkTransTest, GetSessionIdByNetId_001, testing::ext::TestSize.Level0)
{
std::string srcId = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().GetSessionIdByNetId(srcId);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_GET_SESSIONID_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, GetSessionIdByNetId_002, testing::ext::TestSize.Level0)
{
std::string srcId = "umkyu1b165e1be98151891erbe8r91ev";
DistributedInputSinkTransport::GetInstance().sessionDevMap_[srcId] = 1;
DistributedInputSinkTransport::GetInstance().GetDeviceIdBySessionId(1, srcId);
int32_t ret = DistributedInputSinkTransport::GetInstance().GetSessionIdByNetId(srcId);
EXPECT_EQ(1, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespPrepareRemoteInput01, testing::ext::TestSize.Level1)
{
int32_t sessionId = -1;
@@ -69,6 +144,8 @@ HWTEST_F(DistributedInputSinkTransTest, RespPrepareRemoteInput02, testing::ext::
HWTEST_F(DistributedInputSinkTransTest, RespPrepareRemoteInput03, testing::ext::TestSize.Level1)
{
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr1_.dump());
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr3_.dump());
int32_t sessionId = 1;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, smsg);
@@ -93,6 +170,8 @@ HWTEST_F(DistributedInputSinkTransTest, RespUnprepareRemoteInput02, testing::ext
HWTEST_F(DistributedInputSinkTransTest, RespUnprepareRemoteInput03, testing::ext::TestSize.Level1)
{
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr2_.dump());
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr4_.dump());
int32_t sessionId = 1;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, smsg);
@@ -117,6 +196,9 @@ HWTEST_F(DistributedInputSinkTransTest, RespStartRemoteInput02, testing::ext::Te
HWTEST_F(DistributedInputSinkTransTest, RespStartRemoteInput03, testing::ext::TestSize.Level1)
{
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr5_.dump());
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr7_.dump());
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr11_.dump());
int32_t sessionId = 1;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsg);
@@ -141,6 +223,9 @@ HWTEST_F(DistributedInputSinkTransTest, RespStopRemoteInput02, testing::ext::Tes
HWTEST_F(DistributedInputSinkTransTest, RespStopRemoteInput03, testing::ext::TestSize.Level1)
{
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr6_.dump());
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr8_.dump());
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr12_.dump());
int32_t sessionId = 1;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(sessionId, smsg);
@@ -178,6 +263,34 @@ HWTEST_F(DistributedInputSinkTransTest, StartSwitch03, testing::ext::TestSize.Le
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_START_SWITCH_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, StopSwitch01, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1000;
SwitchStateData switchStateData {sessionId, true};
DistributedInputSinkSwitch::GetInstance().switchVector_.push_back(switchStateData);
DistributedInputSinkSwitch::GetInstance().StopSwitch(sessionId);
EXPECT_EQ(false, DistributedInputSinkSwitch::GetInstance().switchVector_[0].switchState);
}
HWTEST_F(DistributedInputSinkTransTest, StopAllSwitch01, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1000;
SwitchStateData switchStateData {sessionId, true};
DistributedInputSinkSwitch::GetInstance().switchVector_.push_back(switchStateData);
DistributedInputSinkSwitch::GetInstance().StopAllSwitch();
EXPECT_EQ(false, DistributedInputSinkSwitch::GetInstance().switchVector_[0].switchState);
}
HWTEST_F(DistributedInputSinkTransTest, RemoveSession01, testing::ext::TestSize.Level1)
{
DistributedInputSinkSwitch::GetInstance().switchVector_.clear();
int32_t sessionId = 1000;
SwitchStateData switchStateData {sessionId, true};
DistributedInputSinkSwitch::GetInstance().switchVector_.push_back(switchStateData);
DistributedInputSinkSwitch::GetInstance().RemoveSession(sessionId);
EXPECT_EQ(0, DistributedInputSinkSwitch::GetInstance().switchVector_.size());
}
HWTEST_F(DistributedInputSinkTransTest, GetAllSessionId, testing::ext::TestSize.Level1)
{
DistributedInputSinkSwitch::GetInstance().InitSwitch();
@@ -201,6 +314,7 @@ HWTEST_F(DistributedInputSinkTransTest, GetSwitchOpenedSession01, testing::ext::
HWTEST_F(DistributedInputSinkTransTest, GetSwitchOpenedSession02, testing::ext::TestSize.Level1)
{
DistributedInputSinkSwitch::GetInstance().switchVector_.clear();
int32_t ret = DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession();
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_GET_OPEN_SESSION_FAIL, ret);
}
@@ -224,27 +338,50 @@ HWTEST_F(DistributedInputSinkTransTest, RespLatency01, testing::ext::TestSize.Le
HWTEST_F(DistributedInputSinkTransTest, RespLatency02, testing::ext::TestSize.Level1)
{
DistributedInputSinkTransport::GetInstance().HandleSessionData(1, jsonStr13_.dump());
int32_t sessionId = 1;
std::string smsg = "";
DistributedInputSinkTransport::GetInstance().GetDeviceIdBySessionId(sessionId, smsg);
int32_t ret = DistributedInputSinkTransport::GetInstance().RespLatency(sessionId, smsg);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, GetDeviceIdBySessionId, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1;
std::string smsg = "";
DistributedInputSinkTransport::GetInstance().GetDeviceIdBySessionId(sessionId, smsg);
EXPECT_EQ("", smsg);
}
HWTEST_F(DistributedInputSinkTransTest, SendMessage, testing::ext::TestSize.Level1)
HWTEST_F(DistributedInputSinkTransTest, SendMessage_001, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1;
std::string smsg = "qwerzsdgertgdfgbrtyhuert6345634tgadsgfq13451234rfaDSFQ34FQQWEFWQERQWEFQWEFASEFQWERQWERQWER123";
int32_t ret = DistributedInputSinkTransport::GetInstance().SendMessage(sessionId, smsg);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, OnSessionOpened_001, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1;
int32_t result = 1;
int32_t ret = DistributedInputSinkTransport::GetInstance().OnSessionOpened(sessionId, result);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, OnSessionOpened_002, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1;
int32_t result = 0;
int32_t ret = DistributedInputSinkTransport::GetInstance().OnSessionOpened(sessionId, result);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, OnSessionClosed_001, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1;
std::string networkId = "umkyu1b165e1be98151891erbe8r91ev";
char *data = nullptr;
uint32_t dataLen = 100;
DistributedInputSinkTransport::GetInstance().sessionDevMap_.clear();
DistributedInputSinkTransport::GetInstance().OnBytesReceived(sessionId, data, dataLen);
DistributedInputSinkTransport::GetInstance().sessionDevMap_[networkId] = sessionId;
DistributedInputSinkTransport::GetInstance().OnSessionClosed(sessionId);
EXPECT_EQ(0, DistributedInputSinkTransport::GetInstance().sessionDevMap_.size());
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
@@ -35,6 +35,20 @@ public:
static void TearDownTestCase();
virtual void SetUp() override;
virtual void TearDown() override;
private:
nlohmann::json jsonStr1_;
nlohmann::json jsonStr2_;
nlohmann::json jsonStr3_;
nlohmann::json jsonStr4_;
nlohmann::json jsonStr5_;
nlohmann::json jsonStr6_;
nlohmann::json jsonStr7_;
nlohmann::json jsonStr8_;
nlohmann::json jsonStr9_;
nlohmann::json jsonStr10_;
nlohmann::json jsonStr11_;
nlohmann::json jsonStr12_;
nlohmann::json jsonStr13_;
};
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -53,6 +53,7 @@ ohos_unittest("distributed_input_inner_sourceinject_test") {
"//base/notification/eventhandler/interfaces/inner_api",
"//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk",
"//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
"${common_path}/test/mock",
]
sources = [
@@ -66,6 +67,7 @@ ohos_unittest("distributed_input_inner_sourceinject_test") {
"//foundation/distributedhardware/distributed_input/services/source/inputinject/src/virtual_touchpad.cpp",
"//foundation/distributedhardware/distributed_input/services/source/inputinject/src/virtual_touchscreen.cpp",
"distributed_input_sourceinject_test.cpp",
"${common_path}/test/mock/softbus_bus_center_mock.cpp",
]
cflags = [
@@ -139,6 +139,25 @@ HWTEST_F(DistributedInputSourceInjectTest, UnregisterDistributedHardware_001, te
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedHardware04, testing::ext::TestSize.Level1)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
std::string parameters;
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedHardware(devId, dhId, parameters);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, UnregisterDistributedHardware_002, testing::ext::TestSize.Level1)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
int32_t ret = DistributedInputInject::GetInstance().UnregisterDistributedHardware(devId, dhId);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent01, testing::ext::TestSize.Level1)
{
struct RawEvent writeBuffer[4];
@@ -172,6 +191,7 @@ HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent01, testing::
event->descriptor = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
size_t count = (size_t)(sizeof(writeBuffer) / sizeof(RawEvent));
DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedEvent(writeBuffer, count);
EXPECT_EQ(DH_SUCCESS, ret);
}
@@ -256,6 +276,15 @@ HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent03, testing::
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent04, testing::ext::TestSize.Level1)
{
struct RawEvent writeBuffer[4];
size_t count = (size_t)(sizeof(writeBuffer) / sizeof(RawEvent));
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
int32_t ret = DistributedInputInject::GetInstance().RegisterDistributedEvent(writeBuffer, count);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RegisterInputNodeListener, testing::ext::TestSize.Level1)
{
inputNodelistener_ = (std::make_unique<TestInputNodeListener>()).release();
@@ -275,11 +304,27 @@ HWTEST_F(DistributedInputSourceInjectTest, GetDhIdsByInputType_001, testing::ext
std::vector<std::string> dhIds;
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
dhIds.push_back(dhId);
std::shared_ptr<RawEvent> rawEvent = nullptr;
DistributedInputInject::GetInstance().InputDeviceEventInject(rawEvent);
DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
int32_t ret = DistributedInputInject::GetInstance().GetDhIdsByInputType(devId,
static_cast<uint32_t>(DInputDeviceType::ALL), dhIds);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GetDhIdsByInputType_002, testing::ext::TestSize.Level1)
{
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
std::shared_ptr<RawEvent> rawEvent = std::make_shared<RawEvent>();
DistributedInputInject::GetInstance().InputDeviceEventInject(rawEvent);
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::vector<std::string> dhIds;
int32_t ret = DistributedInputInject::GetInstance().GetDhIdsByInputType(devId,
static_cast<uint32_t>(DInputDeviceType::ALL), dhIds);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GenerateVirtualTouchScreenDHId_001, testing::ext::TestSize.Level1)
{
std::string ret = DistributedInputInject::GetInstance().GenerateVirtualTouchScreenDHId(1, 1860, 980);
@@ -290,10 +335,17 @@ HWTEST_F(DistributedInputSourceInjectTest, CreateVirtualTouchScreenNode_001, tes
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
int32_t ret = DistributedInputInject::GetInstance().CreateVirtualTouchScreenNode(devId, dhId, 1, 1860, 980);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_001, testing::ext::TestSize.Level1)
{
int32_t ret = DistributedInputInject::GetInstance().GetVirtualTouchScreenFd();
EXPECT_NE(-1, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_001, testing::ext::TestSize.Level1)
{
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
@@ -301,11 +353,88 @@ HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_001, tes
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_001, testing::ext::TestSize.Level1)
HWTEST_F(DistributedInputSourceInjectTest, CreateVirtualTouchScreenNode_002, testing::ext::TestSize.Level1)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
int32_t ret = DistributedInputInject::GetInstance().CreateVirtualTouchScreenNode(devId, dhId, 1, 1860, 980);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_002, testing::ext::TestSize.Level1)
{
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
int32_t ret = DistributedInputInject::GetInstance().RemoveVirtualTouchScreenNode(dhId);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_002, testing::ext::TestSize.Level1)
{
DistributedInputInject::GetInstance().inputNodeManager_ = nullptr;
int32_t ret = DistributedInputInject::GetInstance().GetVirtualTouchScreenFd();
EXPECT_EQ(-1, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, CreateVirtualTouchScreenNode_003, testing::ext::TestSize.Level1)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
const uint64_t srcWinId = 1;
DistributedInputInject::GetInstance().inputNodeManager_ = std::make_unique<DistributedInputNodeManager>();
int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->
CreateVirtualTouchScreenNode(devId, dhId, srcWinId, 1860, 980);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, RemoveVirtualTouchScreenNode_003, testing::ext::TestSize.Level1)
{
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->RemoveVirtualTouchScreenNode(dhId);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GetVirtualTouchScreenFd_003, testing::ext::TestSize.Level1)
{
std::string networkId = "umkyu1b165e1be98151891erbe8r91ev";
uint32_t inputTypes = 1;
std::map<int32_t, std::string> datas;
DistributedInputInject::GetInstance().inputNodeManager_->GetDevicesInfoByType(networkId, inputTypes, datas);
inputTypes = 2;
DistributedInputInject::GetInstance().inputNodeManager_->GetDevicesInfoByType(networkId, inputTypes, datas);
std::vector<std::string> dhidsVec;
DistributedInputInject::GetInstance().inputNodeManager_->GetDevicesInfoByDhId(dhidsVec, datas);
int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->GetVirtualTouchScreenFd();
EXPECT_NE(-1, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, getDevice_001, testing::ext::TestSize.Level1)
{
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
VirtualDevice* device = nullptr;
int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->getDevice(dhId, device);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_GET_DEVICE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, openDevicesNode_001, testing::ext::TestSize.Level1)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
std::string parameters = "";
int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->openDevicesNode(devId, dhId, parameters);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_OPEN_DEVICE_NODE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceInjectTest, GetDeviceInfo_001, testing::ext::TestSize.Level1)
{
std::string deviceId = "";
DistributedInputInject::GetInstance().inputNodeManager_->InjectEvent();
int32_t ret = DistributedInputInject::GetInstance().inputNodeManager_->GetDeviceInfo(deviceId);
EXPECT_EQ(DH_SUCCESS, ret);
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
@@ -25,6 +25,7 @@
#include "constants_dinput.h"
#include "distributed_input_inject.h"
#include "distributed_input_node_manager.h"
#include "input_node_listener_stub.h"
namespace OHOS {
@@ -410,7 +410,6 @@ int32_t DistributedInputSourceTransport::UnprepareRemoteInput(const std::string&
return DH_SUCCESS;
}
int32_t DistributedInputSourceTransport::PrepareRemoteInput(int32_t srcTsrcSeId, const std::string &deviceId)
{
int32_t sinkSessionId = FindSessionIdByDevId(false, deviceId);
+6 -1
View File
@@ -40,9 +40,14 @@ ohos_unittest("distributed_input_utils_test") {
"${frameworks_path}/include",
"//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
"//third_party/json/include",
"${common_path}/test/mock",
"${service_common}/include",
]
sources = [ "dinput_context_test.cpp" ]
sources = [
"dinput_context_test.cpp",
"${common_path}/test/mock/softbus_bus_center_mock.cpp",
]
cflags = [
"-Wall",
@@ -17,6 +17,8 @@
#include "dinput_context.h"
#include "dinput_errcode.h"
#include "dinput_utils_tool.h"
#include "dinput_softbus_define.h"
using namespace testing::ext;
using namespace OHOS::DistributedHardware::DistributedInput;
@@ -176,6 +178,67 @@ HWTEST_F(DInputContextTest, CalculateTransformInfo003, testing::ext::TestSize.Le
int32_t ret = DInputContext::GetInstance().CalculateTransformInfo(sinkScreenInfo);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DInputContextTest, GetLocalDeviceInfo_001, testing::ext::TestSize.Level1)
{
DevInfo devInfo = GetLocalDeviceInfo();
EXPECT_NE(0, devInfo.networkId.size());
}
HWTEST_F(DInputContextTest, GetLocalNetworkId_001, testing::ext::TestSize.Level1)
{
std::string ret = GetLocalNetworkId();
EXPECT_NE(0, ret.size());
}
HWTEST_F(DInputContextTest, GetUUIDBySoftBus_001, testing::ext::TestSize.Level1)
{
std::string networkId = "";
std::string ret = GetUUIDBySoftBus(networkId);
EXPECT_EQ(0, ret.size());
networkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
ret = GetUUIDBySoftBus(networkId);
EXPECT_EQ(0, ret.size());
}
HWTEST_F(DInputContextTest, GetCurrentTime_001, testing::ext::TestSize.Level1)
{
uint64_t ret = GetCurrentTime();
EXPECT_NE(0, ret);
}
HWTEST_F(DInputContextTest, SetAnonyId_001, testing::ext::TestSize.Level1)
{
std::string message = "";
std::string ret = SetAnonyId(message);
EXPECT_EQ(0, ret.size());
}
HWTEST_F(DInputContextTest, SetAnonyId_002, testing::ext::TestSize.Level1)
{
nlohmann::json jsonObj;
std::string deviceId = "deviceId_test";
std::string inputData = "inputData_data";
std::string vecDhId = "dhId_123.dhId_456.dhId_789";
std::string srcDevId = "srcDevId_test";
std::string sinkDevId = "sinkDevId_test";
jsonObj[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
jsonObj[DINPUT_SOFTBUS_KEY_INPUT_DATA] = inputData;
jsonObj[DINPUT_SOFTBUS_KEY_VECTOR_DHID] = vecDhId;
jsonObj[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = srcDevId;
jsonObj[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = sinkDevId;
std::string ret = SetAnonyId(jsonObj.dump());
EXPECT_NE(0, ret.size());
}
HWTEST_F(DInputContextTest, GetNodeDesc_001, testing::ext::TestSize.Level1)
{
std::string parameters = "";
std::string ret = GetNodeDesc(parameters);
EXPECT_EQ(0, ret.size());
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS