mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-20 21:41:02 -04:00
Description:add ut
Match-id-6cb8f9e88b7dc61f079b5f2a959b1605fe7915f0
This commit is contained in:
@@ -999,9 +999,9 @@ InputHub::Device* InputHub::GetSupportDeviceByFd(int fd)
|
||||
DHLOGI("GetSupportDeviceByFd fd: %d", fd);
|
||||
std::unique_lock<std::mutex> deviceLock(devicesMutex_);
|
||||
for (const auto& [id, device] : devices_) {
|
||||
DHLOGI("GetSupportDeviceByFd device: %d, fd: %d, path: %s, dhId: %s, classes=0x%x", id, device->fd,
|
||||
device->path.c_str(), GetAnonyString(device->identifier.descriptor).c_str(), device->classes);
|
||||
if (device != nullptr && device->fd == fd) {
|
||||
DHLOGI("GetSupportDeviceByFd device: %d, fd: %d, path: %s, dhId: %s, classes=0x%x", id, device->fd,
|
||||
device->path.c_str(), GetAnonyString(device->identifier.descriptor).c_str(), device->classes);
|
||||
return device.get();
|
||||
}
|
||||
}
|
||||
@@ -1095,6 +1095,10 @@ void InputHub::GetShareMousePathByDhId(std::vector<std::string> dhIds, std::stri
|
||||
std::unique_lock<std::mutex> deviceLock(devicesMutex_);
|
||||
for (auto dhId_ : dhIds) {
|
||||
for (const auto &[id, device] : devices_) {
|
||||
if (device == nullptr) {
|
||||
DHLOGE("device is nullptr");
|
||||
continue;
|
||||
}
|
||||
DHLOGI("descriptor:%s, isShare[%d], type[%d]", GetAnonyString(device->identifier.descriptor).c_str(),
|
||||
device->isShare, device->classes);
|
||||
if ((device->identifier.descriptor == dhId_) &&
|
||||
|
||||
+363
-106
@@ -32,6 +32,7 @@
|
||||
#include "dinput_errcode.h"
|
||||
#include "distributed_input_inject.h"
|
||||
#include "distributed_input_source_transport.h"
|
||||
#include "dinput_utils_tool.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::DistributedHardware::DistributedInput;
|
||||
@@ -39,6 +40,10 @@ using namespace std;
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
namespace DistributedInput {
|
||||
namespace {
|
||||
const uint32_t INPUTTYPE = static_cast<uint32_t>(DInputDeviceType::ALL);
|
||||
}
|
||||
|
||||
void DistributedInputSourceManagerTest::SetUp()
|
||||
{
|
||||
sourceManager_ = new DistributedInputSourceManager(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, true);
|
||||
@@ -218,6 +223,45 @@ HWTEST_F(DistributedInputSourceManagerTest, Init01, testing::ext::TestSize.Level
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, CheckRegisterParam_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
std::string dhId = "";
|
||||
std::string parameters = "";
|
||||
sptr<IRegisterDInputCallback> callback = nullptr;
|
||||
bool ret = sourceManager_->CheckRegisterParam(devId, dhId, parameters, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
std::string devcieId(DEV_ID_LENGTH_MAX + 1, 'a');
|
||||
ret = sourceManager_->CheckRegisterParam(devcieId, dhId, parameters, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, CheckRegisterParam_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string dhId = "";
|
||||
std::string parameters = "";
|
||||
sptr<IRegisterDInputCallback> callback = nullptr;
|
||||
bool ret = sourceManager_->CheckRegisterParam(devId, dhId, parameters, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
std::string dhIds(DEV_ID_LENGTH_MAX + 1, 'a');
|
||||
ret = sourceManager_->CheckRegisterParam(devId, dhIds, parameters, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, CheckRegisterParam_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
|
||||
std::string parameters = "";
|
||||
sptr<IRegisterDInputCallback> callback = nullptr;
|
||||
bool ret = sourceManager_->CheckRegisterParam(devId, dhId, parameters, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
parameters = "parameters_test";
|
||||
ret = sourceManager_->CheckRegisterParam(devId, dhId, parameters, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, RegisterDistributedHardware_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
@@ -228,6 +272,69 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterDistributedHardware_01, test
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_REGISTER_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, RegisterDistributedHardware_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
InputDevice pBuffer;
|
||||
pBuffer.name = "uinput_name_touch";
|
||||
pBuffer.bus = 0x03;
|
||||
pBuffer.vendor = 0x1233;
|
||||
pBuffer.product = 0xfedb;
|
||||
pBuffer.version = 3;
|
||||
pBuffer.physicalPath = "usb-hiusb-ehci-2.1/input1";
|
||||
pBuffer.uniqueId = "3";
|
||||
pBuffer.classes = INPUT_DEVICE_CLASS_TOUCH;
|
||||
pBuffer.descriptor = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
|
||||
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string dhId = pBuffer.descriptor;
|
||||
std::string parameters;
|
||||
StructTransJson(pBuffer, parameters);
|
||||
sptr<TestRegisterDInputCb> callback = new TestRegisterDInputCb();
|
||||
DistributedInputSourceManager::InputDeviceId inputDeviceId {devId, dhId, GetNodeDesc(parameters)};
|
||||
sourceManager_->inputDevice_.push_back(inputDeviceId);
|
||||
int32_t ret = sourceManager_->RegisterDistributedHardware(devId, dhId, parameters, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, CheckUnregisterParam_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
std::string dhId = "";
|
||||
sptr<TestUnregisterDInputCb> callback = nullptr;
|
||||
bool ret = sourceManager_->CheckUnregisterParam(devId, dhId, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
std::string devcieId(DEV_ID_LENGTH_MAX + 1, 'a');
|
||||
ret = sourceManager_->CheckUnregisterParam(devcieId, dhId, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
ret = sourceManager_->CheckUnregisterParam(devId, dhId, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
std::string dhIds(DEV_ID_LENGTH_MAX + 1, 'a');
|
||||
sourceManager_->CheckUnregisterParam(devId, dhIds, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
|
||||
sourceManager_->CheckUnregisterParam(devId, dhId, callback);
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
|
||||
sptr<TestUnregisterDInputCb> callback = new TestUnregisterDInputCb();
|
||||
int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
|
||||
sptr<TestUnregisterDInputCb> callback = new TestUnregisterDInputCb();
|
||||
int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PrepareRemoteInput
|
||||
* @tc.desc: verify the function of distributing data from any device.
|
||||
@@ -242,15 +349,17 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_01, testing::ext:
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_01, testing::ext::TestSize.Level1)
|
||||
HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
|
||||
int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestPrepareDInputCallback> callback = new TestPrepareDInputCallback();
|
||||
DistributedInputSourceManager::DInputClientPrepareInfo info {devId, callback};
|
||||
sourceManager_->preCallbacks_.push_back(info);
|
||||
int32_t ret = sourceManager_->PrepareRemoteInput(devId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_02, testing::ext::TestSize.Level1)
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
int32_t sessionId = 1;
|
||||
@@ -261,6 +370,27 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_02, testing::ex
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
|
||||
int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientUnprepareInfo info {devId, callback};
|
||||
sourceManager_->unpreCallbacks_.push_back(info);
|
||||
ret = sourceManager_->UnprepareRemoteInput(devId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "devId_4810input4809_test";
|
||||
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
|
||||
int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartRemoteInput
|
||||
* @tc.desc: verify the function of starting distributed input on InputDeviceType.
|
||||
@@ -269,18 +399,31 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_02, testing::ex
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string devId = "";
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientStartInfo info {devId, INPUTTYPE, callback};
|
||||
sourceManager_->staCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "devId_4810input4809_test";
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,18 +434,31 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_02, testing::ext::T
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "";
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string devId = "";
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(devId, static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientStopInfo info {devId, INPUTTYPE, callback};
|
||||
sourceManager_->stpCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
std::string devId = "devId_4810input4809_test";
|
||||
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,65 +467,113 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_02, testing::ext::Te
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J75
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId,
|
||||
static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_04, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId,
|
||||
static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_05, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
srcId = "srcId_4810input4809_test";
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientStartTypeInfo info(srcId, sinkId, INPUTTYPE, callback);
|
||||
sourceManager_->relayStaTypeCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
DistributedInputSourceManager::DInputClientStartInfo startInfo {sinkId, INPUTTYPE, callback};
|
||||
sourceManager_->staCallbacks_.push_back(startInfo);
|
||||
ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_06, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "devId_4810input4809_test";
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StopRemoteInput
|
||||
* @tc.desc: verify the function of stoping distributed input on InputDeviceType.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J75
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId,
|
||||
static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_04, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId,
|
||||
static_cast<uint32_t>(DInputDeviceType::ALL), callback);
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_05, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId,
|
||||
INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
srcId = "srcId_4810input4809_test";
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientStopTypeInfo info(srcId, sinkId, INPUTTYPE, callback);
|
||||
sourceManager_->relayStpTypeCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
DistributedInputSourceManager::DInputClientStopInfo stopInfo {sinkId, INPUTTYPE, callback};
|
||||
sourceManager_->stpCallbacks_.push_back(stopInfo);
|
||||
ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_06, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "devId_4810input4809_test";
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PrepareRemoteInput
|
||||
* @tc.desc: verify the function of distributing data from any device.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J77
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_02, testing::ext::TestSize.Level1)
|
||||
HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
sptr<TestPrepareDInputCallback> callback = new TestPrepareDInputCallback();
|
||||
int32_t ret = sourceManager_->PrepareRemoteInput(srcId, sinkId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
|
||||
srcId = "srcId_4810input4809_test";
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientRelayPrepareInfo info(srcId, sinkId, callback);
|
||||
sourceManager_->relayPreCallbacks_.push_back(info);
|
||||
ret = sourceManager_->PrepareRemoteInput(srcId, sinkId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
|
||||
srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
DistributedInputSourceManager::DInputClientPrepareInfo preInfo {sinkId, callback};
|
||||
sourceManager_->preCallbacks_.push_back(preInfo);
|
||||
ret = sourceManager_->PrepareRemoteInput(srcId, sinkId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,63 +582,24 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_02, testing::ext:
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J77
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_03, testing::ext::TestSize.Level1)
|
||||
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_04, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
|
||||
int32_t ret = sourceManager_->UnprepareRemoteInput(srcId, sinkId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartRemoteInput
|
||||
* @tc.desc: verify the function of starting distributed input with dhid.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J74
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_05, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_06, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> dhIds;
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StopRemoteInput
|
||||
* @tc.desc: verify the function of stoping distributed input with dhid.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J74
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_05, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_06, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
int32_t ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
srcId = "srcId_4810input4809_test";
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientRelayUnprepareInfo info(srcId, sinkId, callback);
|
||||
sourceManager_->relayUnpreCallbacks_.push_back(info);
|
||||
ret = sourceManager_->UnprepareRemoteInput(srcId, sinkId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
DistributedInputSourceManager::DInputClientUnprepareInfo unpreInfo {sinkId, callback};
|
||||
sourceManager_->unpreCallbacks_.push_back(unpreInfo);
|
||||
ret = sourceManager_->UnprepareRemoteInput(srcId, sinkId, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,23 +610,29 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_06, testing::ext::Te
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_07, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_08, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientStartDhidInfo info {srcId, sinkId, dhIds, callback};
|
||||
sourceManager_->staStringCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,16 +642,78 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_08, testing::ext::T
|
||||
* @tc.require: SR000H9J74
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_07, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
int32_t ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_08, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
DistributedInputSourceManager::DInputClientStopDhidInfo info {srcId, sinkId, dhIds, callback};
|
||||
sourceManager_->stpStringCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartRemoteInput
|
||||
* @tc.desc: verify the function of starting distributed input with dhid.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J74
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_09, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_10, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
srcId = "srcId_4810input4809_test";
|
||||
DistributedInputSourceManager::DInputClientStartDhidInfo info{srcId, sinkId, dhIds, callback};
|
||||
sourceManager_->relayStaDhidCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
|
||||
|
||||
DistributedInputSourceManager::DInputClientStartDhidInfo startDhIdInfo {srcId, sinkId, dhIds, callback};
|
||||
sourceManager_->staStringCallbacks_.push_back(startDhIdInfo);
|
||||
ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_08, testing::ext::TestSize.Level1)
|
||||
/**
|
||||
* @tc.name: StopRemoteInput
|
||||
* @tc.desc: verify the function of stoping distributed input with dhid.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: SR000H9J74
|
||||
*/
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_09, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
@@ -491,6 +724,30 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_08, testing::ext::Te
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_10, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string srcId = "";
|
||||
std::string sinkId = "";
|
||||
std::vector<std::string> dhIds;
|
||||
sptr<TestStartStopVectorCallbackStub> callback = new TestStartStopVectorCallbackStub();
|
||||
int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
|
||||
dhIds.push_back("Input_slkdiek3kddkeojfe");
|
||||
sinkId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
srcId = "srcId_4810input4809_test";
|
||||
DistributedInputSourceManager::DInputClientStopDhidInfo info{srcId, sinkId, dhIds, callback};
|
||||
sourceManager_->relayStpDhidCallbacks_.push_back(info);
|
||||
ret = sourceManager_->StopRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
|
||||
srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00";
|
||||
DistributedInputSourceManager::DInputClientStopDhidInfo stopDhIdInfo {srcId, sinkId, dhIds, callback};
|
||||
sourceManager_->stpStringCallbacks_.push_back(stopDhIdInfo);
|
||||
ret = sourceManager_->StopRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, IsStringDataSame_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> oldDhIds;
|
||||
|
||||
+77
-1
@@ -209,6 +209,24 @@ HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput02, testing::ext::TestS
|
||||
DistributedInputSourceTransport::GetInstance().CloseInputSoftbus(sessionId);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput03, testing::ext::TestSize.Level0)
|
||||
{
|
||||
std::string deviceId = "";
|
||||
std::vector<std::string> dhids;
|
||||
dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
|
||||
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, dhids);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput04, testing::ext::TestSize.Level0)
|
||||
{
|
||||
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
|
||||
std::vector<std::string> dhids;
|
||||
dhids.push_back("Input_1ds56v18e1v21v8v1erv15r1v8r1j1ty8");
|
||||
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, dhids);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInputDhids_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t srcTsrcSeId = 1;
|
||||
@@ -545,6 +563,16 @@ HWTEST_F(DistributedInputSourceTransTest, NotifyResponsePrepareRemoteInput03, te
|
||||
DistributedInputSourceTransport::GetInstance().sessionDevMap_.clear();
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, NotifyResponsePrepareRemoteInput04, testing::ext::TestSize.Level0)
|
||||
{
|
||||
int32_t sessionId = 0;
|
||||
nlohmann::json recMsg;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
|
||||
recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST] = false;
|
||||
DistributedInputSourceTransport::GetInstance().NotifyResponsePrepareRemoteInput(sessionId, recMsg);
|
||||
EXPECT_EQ(false, recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST].is_string());
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, NotifyResponseUnprepareRemoteInput01, testing::ext::TestSize.Level0)
|
||||
{
|
||||
int32_t sessionId = 0;
|
||||
@@ -581,7 +609,7 @@ HWTEST_F(DistributedInputSourceTransTest, NotifyReceivedEventRemoteInput01, test
|
||||
recMsg[DINPUT_SOFTBUS_KEY_INPUT_DATA] = inputData;
|
||||
DistributedInputSourceTransport::GetInstance().NotifyReceivedEventRemoteInput(sessionId, recMsg);
|
||||
std::string inputDatas = "inputDatas_test";
|
||||
recMsg[DINPUT_SOFTBUS_KEY_INPUT_DATA] = inputData;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_INPUT_DATA] = inputDatas;
|
||||
DistributedInputSourceTransport::GetInstance().NotifyReceivedEventRemoteInput(sessionId, recMsg);
|
||||
DistributedInputSourceTransport::GetInstance().CalculateLatency(sessionId, recMsg);
|
||||
std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
|
||||
@@ -598,6 +626,7 @@ HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayUnprepare01, testin
|
||||
int32_t devId = 100;
|
||||
nlohmann::json recMsg;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = devId;
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayPrepare(sessionId, recMsg);
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveSrcTSrcRelayUnprepare(sessionId, recMsg);
|
||||
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
|
||||
recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID] = deviceId;
|
||||
@@ -624,6 +653,53 @@ HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayPrepareRemoteInput0
|
||||
EXPECT_EQ(0, DistributedInputSourceTransport::GetInstance().sessionDevMap_.size());
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, NotifyResponseRelayUnprepareRemoteInput01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t sessionId = 1;
|
||||
std::string remoteId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
|
||||
DistributedInputSourceTransport::DInputSessionInfo dInputSessionInfo {false, remoteId};
|
||||
DistributedInputSourceTransport::GetInstance().sessionDevMap_[sessionId] = dInputSessionInfo;
|
||||
nlohmann::json recMsg;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "false";
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = "sessionId";
|
||||
DistributedInputSourceTransport::GetInstance().NotifyResponseRelayUnprepareRemoteInput(sessionId, recMsg);
|
||||
recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = false;
|
||||
DistributedInputSourceTransport::GetInstance().NotifyResponseRelayUnprepareRemoteInput(sessionId, recMsg);
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID] = sessionId;
|
||||
sessionId = 2;
|
||||
DistributedInputSourceTransport::GetInstance().NotifyResponseRelayUnprepareRemoteInput(sessionId, recMsg);
|
||||
EXPECT_EQ(1, DistributedInputSourceTransport::GetInstance().sessionDevMap_.size());
|
||||
DistributedInputSourceTransport::GetInstance().sessionDevMap_.clear();
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, ReceiveRelayPrepareResult01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t sessionId = 1;
|
||||
nlohmann::json recMsg;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = 100;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = 100;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "resp_value_test";
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveRelayPrepareResult(sessionId, recMsg);
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = "src_devid_test";
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveRelayPrepareResult(sessionId, recMsg);
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = "sink_devid_test";
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveRelayPrepareResult(sessionId, recMsg);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, ReceiveRelayUnprepareResult01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t sessionId = 1;
|
||||
nlohmann::json recMsg;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = 100;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = 100;
|
||||
recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE] = "resp_value_test";
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveRelayUnprepareResult(sessionId, recMsg);
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID] = "src_devid_test";
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveRelayUnprepareResult(sessionId, recMsg);
|
||||
recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID] = "sink_devid_test";
|
||||
DistributedInputSourceTransport::GetInstance().ReceiveRelayUnprepareResult(sessionId, recMsg);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceTransTest, ReceiveSrcTSrcRelayStartDhid01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t sessionId = 1;
|
||||
|
||||
Reference in New Issue
Block a user