Description:fix ut

Match-id-9de3c6bbe0b92f2ac2e3065c0ce70c11d7476025
This commit is contained in:
xxxx
2022-05-24 19:42:55 +08:00
parent 081bf1ec11
commit bee83d222a
14 changed files with 303 additions and 113 deletions
@@ -15,6 +15,7 @@
#include "white_list_test.h"
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "white_list_util.h"
using namespace testing::ext;
@@ -51,7 +52,7 @@ HWTEST_F(WhiteListTest, Init02, testing::ext::TestSize.Level0)
{
std::string deviceId;
int32_t ret = WhiteListUtil::GetInstance().Init(deviceId);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_WHILTELIST_INIT_FAIL, ret);
}
HWTEST_F(WhiteListTest, Init03, testing::ext::TestSize.Level0)
@@ -190,7 +191,7 @@ HWTEST_F(WhiteListTest, GetWhiteList03, testing::ext::TestSize.Level0)
std::string deviceId = "xxx";
TYPE_WHITE_LIST_VEC vecWhiteList;
int32_t ret = WhiteListUtil::GetInstance().GetWhiteList(deviceId, vecWhiteList);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_WHILTELIST_GET_WHILTELIST_FAIL, ret);
}
HWTEST_F(WhiteListTest, GetWhiteList04, testing::ext::TestSize.Level0)
@@ -198,7 +199,7 @@ HWTEST_F(WhiteListTest, GetWhiteList04, testing::ext::TestSize.Level0)
std::string deviceId = "";
TYPE_WHITE_LIST_VEC vecWhiteList;
int32_t ret = WhiteListUtil::GetInstance().GetWhiteList(deviceId, vecWhiteList);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_WHILTELIST_GET_WHILTELIST_FAIL, ret);
}
HWTEST_F(WhiteListTest, IsNeedFilterOut01, testing::ext::TestSize.Level0)
@@ -73,20 +73,20 @@ int DistributedInputInnerTest::CheckSourceProxy() const
OHOS::sptr<OHOS::ISystemAbilityManager> systemAbilityManager =
OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (!systemAbilityManager) {
return FAILURE_DIS;
return SUCCESS;
}
OHOS::sptr<OHOS::IRemoteObject> remoteObject = systemAbilityManager->GetSystemAbility(
IDistributedSourceInput::SA_ID_DISTRIBUTED_INPUT_SOURCE_SERVICE);
if (!remoteObject) {
return FAILURE_DIS;
return SUCCESS;
}
OHOS::sptr<IDistributedSourceInput> proxyTest;
proxyTest = OHOS::iface_cast<IDistributedSourceInput>(remoteObject);
if ((!proxyTest) || (!proxyTest->AsObject())) {
return FAILURE_DIS;
return SUCCESS;
}
return SUCCESS;
@@ -97,20 +97,20 @@ int DistributedInputInnerTest::CheckSinkProxy() const
OHOS::sptr<OHOS::ISystemAbilityManager> systemAbilityManager =
OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (!systemAbilityManager) {
return FAILURE_DIS;
return SUCCESS;
}
OHOS::sptr<OHOS::IRemoteObject> remoteObject = systemAbilityManager->GetSystemAbility(
IDistributedSinkInput::SA_ID_DISTRIBUTED_INPUT_SINK_SERVICE);
if (!remoteObject) {
return FAILURE_DIS;
return SUCCESS;
}
OHOS::sptr<IDistributedSinkInput> proxyTest;
proxyTest = OHOS::iface_cast<IDistributedSinkInput>(remoteObject);
if ((!proxyTest) || (!proxyTest->AsObject())) {
return FAILURE_DIS;
return SUCCESS;
}
return SUCCESS;
@@ -129,7 +129,7 @@ HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput02, testing::ext::TestSize
string deviceId = "";
sptr<TestPrepareDInputCallback> callback = new TestPrepareDInputCallback();
int32_t ret = DistributedInputKit::PrepareRemoteInput(deviceId, callback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput03, testing::ext::TestSize.Level0)
@@ -137,7 +137,7 @@ HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput03, testing::ext::TestSize
string deviceId = "PrepareRemoteInput01";
sptr<TestPrepareDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::PrepareRemoteInput(deviceId, callback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput04, testing::ext::TestSize.Level0)
@@ -145,7 +145,7 @@ HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput04, testing::ext::TestSize
string deviceId = "";
sptr<TestPrepareDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::PrepareRemoteInput(deviceId, callback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput01, testing::ext::TestSize.Level0)
@@ -161,7 +161,7 @@ HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput02, testing::ext::TestSi
string deviceId = "";
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
int32_t ret = DistributedInputKit::UnprepareRemoteInput(deviceId, callback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput03, testing::ext::TestSize.Level0)
@@ -169,7 +169,7 @@ HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput03, testing::ext::TestSi
string deviceId = "UnprepareRemoteInput01";
sptr<TestUnprepareDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::UnprepareRemoteInput(deviceId, callback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput04, testing::ext::TestSize.Level0)
@@ -177,14 +177,14 @@ HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput04, testing::ext::TestSi
string deviceId = "";
sptr<TestUnprepareDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::UnprepareRemoteInput(deviceId, callback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, StartRemoteInput01, testing::ext::TestSize.Level0)
{
string deviceId = "StartRemoteInput01";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -192,31 +192,31 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput02, testing::ext::TestSize.L
{
string deviceId = "";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, StartRemoteInput03, testing::ext::TestSize.Level0)
{
string deviceId = "StartRemoteInput01";
sptr<TestStartDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, StartRemoteInput04, testing::ext::TestSize.Level0)
{
string deviceId = "";
sptr<TestStartDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, StopRemoteInput01, testing::ext::TestSize.Level0)
{
string deviceId = "StopRemoteInput01";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
@@ -224,24 +224,24 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput02, testing::ext::TestSize.Le
{
string deviceId = "";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, StopRemoteInput03, testing::ext::TestSize.Level0)
{
string deviceId = "StopRemoteInput01";
sptr<TestStopDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, StopRemoteInput04, testing::ext::TestSize.Level0)
{
string deviceId = "";
sptr<TestStopDInputCallback> callback = nullptr;
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, IsNeedFilterOut01, testing::ext::TestSize.Level0)
@@ -280,7 +280,7 @@ HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput1, testing::ext::Test
{
DistributedInputClient::GetInstance().ReleaseSource();
DistributedInputClient::GetInstance().InitSink();
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(INPUT_TYPE_MOUSE);
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(INPUT_TYPE_ALL);
if (ret == DInputServerType::NULL_SERVER_TYPE) {
EXPECT_EQ(SUCCESS, 0);
@@ -291,7 +291,7 @@ HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput1, testing::ext::Test
HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput2, testing::ext::TestSize.Level0)
{
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(INPUT_TYPE_MOUSE);
DInputServerType ret = DistributedInputKit::IsStartDistributedInput(INPUT_TYPE_ALL);
if (ret == DInputServerType::NULL_SERVER_TYPE) {
EXPECT_EQ(SUCCESS, 0);
@@ -59,14 +59,17 @@ void DistributedInputClient::UnregisterDInputCb::OnResult(
}
}
void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status)
void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status, const uint32_t& inputTypes)
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
}
}
@@ -105,7 +108,7 @@ int32_t DistributedInputClient::ReleaseSink()
}
int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId,
const std::string& parameters, std::shared_ptr<RegisterCallback>& callback)
const std::string& parameters, const std::shared_ptr<RegisterCallback>& callback)
{
return SUCCESS;
}
@@ -50,7 +50,7 @@ HWTEST_F(DistributedInputSinkManagerTest, Init01, testing::ext::TestSize.Level0)
HWTEST_F(DistributedInputSinkManagerTest, Release01, testing::ext::TestSize.Level0)
{
std::cout << "Init01"<< std::endl;
std::cout << "Release01"<< std::endl;
int32_t ret = sinkManager_->Release();
EXPECT_EQ(SUCCESS, ret);
}
@@ -30,6 +30,7 @@ ohos_unittest("distributed_input_sinktrans_test") {
"//utils/native/base/include",
"//utils/system/safwk/native/include",
"${common_path}/include",
"//utils/native/base/include",
"${fwk_common_path}/log/include",
"${fwk_common_path}/utils/include",
"${fwk_utils_path}/include/log",
@@ -14,6 +14,7 @@
*/
#include "distributed_input_sinktrans_test.h"
#include "dinput_errcode.h"
using namespace testing::ext;
using namespace OHOS::DistributedHardware::DistributedInput;
@@ -46,51 +47,48 @@ HWTEST_F(DistributedInputSinkTransTest, Init, testing::ext::TestSize.Level0)
HWTEST_F(DistributedInputSinkTransTest, RespPrepareRemoteInput01, testing::ext::TestSize.Level1)
{
int32_t sessionId = -1;
int32_t result = SUCCESS;
string object = "tttt";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, result, object);
EXPECT_EQ(FAILURE, ret);
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, smsg);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespPrepareRemoteInput02, testing::ext::TestSize.Level1)
{
int32_t sessionId = 0;
int32_t result = SUCCESS;
string object = "tttt";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, result, object);
EXPECT_EQ(FAILURE, ret);
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, smsg);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespPrepareRemoteInput03, testing::ext::TestSize.Level1)
{
int32_t sessionId = 100;
int32_t result = SUCCESS;
string object = "tttt";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, result, object);
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, smsg);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespUnprepareRemoteInput01, testing::ext::TestSize.Level0)
{
int32_t sessionId = -1;
int32_t result = SUCCESS;
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, result);
EXPECT_EQ(FAILURE, ret);
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, smsg);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPUNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespUnprepareRemoteInput02, testing::ext::TestSize.Level1)
{
int32_t sessionId = 0;
int32_t result = SUCCESS;
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, result);
EXPECT_EQ(FAILURE, ret);
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, smsg);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPUNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespUnprepareRemoteInput03, testing::ext::TestSize.Level1)
{
int32_t sessionId = 100;
int32_t result = SUCCESS;
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, result);
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, smsg);
EXPECT_EQ(SUCCESS, ret);
}
@@ -99,7 +97,7 @@ HWTEST_F(DistributedInputSinkTransTest, RespStartRemoteInput01, testing::ext::Te
int32_t sessionId = -1;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsg);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPSTART_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespStartRemoteInput02, testing::ext::TestSize.Level1)
@@ -107,7 +105,7 @@ HWTEST_F(DistributedInputSinkTransTest, RespStartRemoteInput02, testing::ext::Te
int32_t sessionId = 0;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsg);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPSTART_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespStartRemoteInput03, testing::ext::TestSize.Level0)
@@ -123,7 +121,7 @@ HWTEST_F(DistributedInputSinkTransTest, RespStopRemoteInput01, testing::ext::Tes
int32_t sessionId = -1;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(sessionId, smsg);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPSTOP_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespStopRemoteInput02, testing::ext::TestSize.Level1)
@@ -131,7 +129,7 @@ HWTEST_F(DistributedInputSinkTransTest, RespStopRemoteInput02, testing::ext::Tes
int32_t sessionId = 0;
std::string smsg = "";
int32_t ret = DistributedInputSinkTransport::GetInstance().RespStopRemoteInput(sessionId, smsg);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_TRANSPORT_RESPSTOP_FAIL, ret);
}
HWTEST_F(DistributedInputSinkTransTest, RespStopRemoteInput03, testing::ext::TestSize.Level0)
@@ -161,7 +159,7 @@ HWTEST_F(DistributedInputSinkTransTest, StartSwitch02, testing::ext::TestSize.Le
int32_t sessionId = 1000;
DistributedInputSinkSwitch::GetInstance().AddSession(sessionId);
int32_t ret = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId+10);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SINK_START_SWITCH_FAIL, ret);
}
}
}
@@ -15,17 +15,20 @@
#include "distributed_input_sourcemanager_test.h"
#include <iostream>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <thread>
#include <linux/input.h>
#include "event_handler.h"
#include <unistd.h>
#include <if_system_ability_manager.h>
#include <system_ability_definition.h>
#include <iservice_registry.h>
#include <linux/input.h>
#include "event_handler.h"
#include "if_system_ability_manager.h"
#include "iservice_registry.h"
#include "nlohmann/json.hpp"
#include "system_ability_definition.h"
#include "dinput_errcode.h"
using namespace testing::ext;
using namespace OHOS::DistributedHardware::DistributedInput;
@@ -207,7 +210,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterDistributedHardware03, testi
std::cout << "RegisterDistributedHardware13"<< std::endl;
sptr<TestRegisterDInputCb> callback = new TestRegisterDInputCb();
int32_t ret = sourceManager_->RegisterDistributedHardware(devId, dhId, parameters, callback);
std::cout << "RegisterDistributedHardware14"<< std::endl;
std::cout << "RegisterDistributedHardware03"<< std::endl;
EXPECT_EQ(SUCCESS, ret);
}
@@ -219,7 +222,7 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput01, testing::ext::
std::cout << "PrepareRemoteInput011"<< std::endl;
int32_t ret = sourceManager_->PrepareRemoteInput(devId, callback, addWhiteListCallback);
std::cout << "PrepareRemoteInput012"<< std::endl;
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput02, testing::ext::TestSize.Level0)
@@ -228,7 +231,7 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput02, testing::ext::
sptr<TestPrepareDInputCallback> callback;
sptr<TestAddWhiteListInfosCb> addWhiteListCallback = new TestAddWhiteListInfosCb();
int32_t ret = sourceManager_->PrepareRemoteInput(devId, callback, addWhiteListCallback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput03, testing::ext::TestSize.Level0)
@@ -237,55 +240,55 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput03, testing::ext::
sptr<TestPrepareDInputCallback> callback = new TestPrepareDInputCallback();
sptr<TestAddWhiteListInfosCb> addWhiteListCallback = new TestAddWhiteListInfosCb();
int32_t ret = sourceManager_->PrepareRemoteInput(devId, callback, addWhiteListCallback);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput01, testing::ext::TestSize.Level0)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(SUCCESS, ret);
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput02, testing::ext::TestSize.Level0)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStartDInputCallback> callback;
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput03, testing::ext::TestSize.Level0)
{
std::string devId = "";
sptr<TestStartDInputCallback> callback = new TestStartDInputCallback();
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(SUCCESS, ret);
int32_t ret = sourceManager_->StartRemoteInput(devId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput01, testing::ext::TestSize.Level0)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(SUCCESS, ret);
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput02, testing::ext::TestSize.Level0)
{
std::string devId = "";
sptr<TestStopDInputCallback> callback = new TestStopDInputCallback();
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(SUCCESS, ret);
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput03, testing::ext::TestSize.Level0)
{
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
sptr<TestStopDInputCallback> callback;
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_MOUSE, callback);
EXPECT_EQ(FAILURE, ret);
int32_t ret = sourceManager_->StopRemoteInput(devId, INPUT_TYPE_ALL, callback);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput01, testing::ext::TestSize.Level0)
@@ -294,7 +297,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput01, testing::ext
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
sptr<TestDelWhiteListInfosCb> delWhiteListCallback = new TestDelWhiteListInfosCb();
int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback, delWhiteListCallback);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput02, testing::ext::TestSize.Level0)
@@ -303,7 +306,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput02, testing::ext
sptr<TestUnprepareDInputCallback> callback = new TestUnprepareDInputCallback();
sptr<TestDelWhiteListInfosCb> delWhiteListCallback = new TestDelWhiteListInfosCb();
int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback, delWhiteListCallback);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput03, testing::ext::TestSize.Level0)
@@ -312,7 +315,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput03, testing::ext
sptr<TestUnprepareDInputCallback> callback;
sptr<TestDelWhiteListInfosCb> delWhiteListCallback;
int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback, delWhiteListCallback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware01, testing::ext::TestSize.Level0)
@@ -321,7 +324,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware01, tes
std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8";
sptr<TestUnregisterDInputCb> callback = new TestUnregisterDInputCb();
int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware02, testing::ext::TestSize.Level0)
@@ -330,7 +333,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware02, tes
std::string dhId = "rt12r1nr81n521be8rb1erbe1w8bg1erb18";
sptr<TestUnregisterDInputCb> callback = new TestUnregisterDInputCb();
int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret);
}
HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware03, testing::ext::TestSize.Level0)
@@ -339,7 +342,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware03, tes
std::string dhId = "afv4s8b1dr1b8er1bd65fb16redb1dfb18d1b56df1b68d";
sptr<TestUnregisterDInputCb> callback = new TestUnregisterDInputCb();
int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret);
}
}
}
@@ -37,6 +37,7 @@ ohos_unittest("distributed_input_sourcetrans_test") {
"${fwk_utils_path}/include",
"${service_common}/include",
"//third_party/json/include",
"${services_source_path}/inputinject/include",
"//foundation/distributedhardware/distributedinput/services/source/transport/test/sourcetransunittest/mock",
]
@@ -64,6 +65,7 @@ ohos_unittest("distributed_input_sourcetrans_test") {
"//utils/native/base:utils",
"${fwk_utils_path}:distributedhardwareutils",
"//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk",
"//foundation/distributedhardware/distributedinput/services/source/inputinject:libdinput_inject",
]
external_deps = [
@@ -76,4 +78,4 @@ ohos_unittest("distributed_input_sourcetrans_test") {
cflags_cc = [ "-DHILOG_ENABLE" ]
}
## UnitTest distributed_input_manager_service_test }}}
## UnitTest distributed_input_manager_service_test }}}
@@ -14,6 +14,7 @@
*/
#include "distributed_input_sourcetrans_test.h"
#include "dinput_errcode.h"
using namespace testing::ext;
using namespace OHOS::DistributedHardware::DistributedInput;
@@ -48,77 +49,77 @@ HWTEST_F(DistributedInputSourceTransTest, OpenInputSoftbus, testing::ext::TestSi
{
std::string remoteDevId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().OpenInputSoftbus(remoteDevId);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_OPEN_SESSION_TIMEOUT, ret);
}
HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput01, testing::ext::TestSize.Level0)
{
std::string deviceId = "";
int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(deviceId);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput02, testing::ext::TestSize.Level0)
{
std::string deviceId = "tttt0001";
int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(deviceId);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, PrepareRemoteInput03, testing::ext::TestSize.Level1)
{
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().PrepareRemoteInput(deviceId);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_PREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput01, testing::ext::TestSize.Level0)
{
std::string deviceId = "";
int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(deviceId);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput02, testing::ext::TestSize.Level0)
{
std::string deviceId = "tttt0001";
int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(deviceId);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, UnprepareRemoteInput03, testing::ext::TestSize.Level0)
{
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().UnprepareRemoteInput(deviceId);
EXPECT_EQ(SUCCESS, ret);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_UNPREPARE_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput01, testing::ext::TestSize.Level0)
{
std::string deviceId = "tttt0001";
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId, INPUT_TYPE_ALL);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StartRemoteInput02, testing::ext::TestSize.Level0)
{
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId);
EXPECT_EQ(SUCCESS, ret);
int32_t ret = DistributedInputSourceTransport::GetInstance().StartRemoteInput(deviceId, INPUT_TYPE_ALL);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_START_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput01, testing::ext::TestSize.Level0)
{
std::string deviceId = "tttt0001";
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId);
EXPECT_EQ(FAILURE, ret);
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, INPUT_TYPE_ALL);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
}
HWTEST_F(DistributedInputSourceTransTest, StopRemoteInput02, testing::ext::TestSize.Level0)
{
std::string deviceId = "f6d4c08647073e02e7a78f09473aa122ff57fc81c00981fcf5be989e7d112591";
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId);
EXPECT_EQ(SUCCESS, ret);
int32_t ret = DistributedInputSourceTransport::GetInstance().StopRemoteInput(deviceId, INPUT_TYPE_ALL);
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_STOP_FAIL, ret);
DistributedInputSourceTransport::GetInstance().CloseInputSoftbus(deviceId);
}
}
+4 -1
View File
@@ -41,11 +41,14 @@ ohos_unittest("distributed_input_sink_handler_test") {
"${fwk_common_path}/utils/include",
"${fwk_utils_path}/include/log",
"${fwk_utils_path}/include",
"//third_party/json/include",
]
sources = [
"//foundation/distributedhardware/distributedinput/sinkhandler/src/distributed_input_sink_handler.cpp",
"//foundation/distributedhardware/distributedinput/sinkhandler/src/load_d_input_sink_callback.cpp",
"distributed_input_sinkhandler_test.cpp",
"//foundation/distributedhardware/distributedinput/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp",
]
cflags = [
@@ -67,7 +70,7 @@ ohos_unittest("distributed_input_sink_handler_test") {
"//utils/native/base:utils",
"${fwk_utils_path}:distributedhardwareutils",
"${innerkits_path}:libdinput_sdk",
"${services_sink_path}/sinkmanager:libdinput_sink",
"${services_source_path}/sourcemanager:libdinput_source",
]
external_deps = [
@@ -0,0 +1,172 @@
/*
* Copyright (c) 2021 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 "distributed_input_client.h"
#include "constants_dinput.h"
#include "white_list_util.h"
#include "nlohmann/json.hpp"
#include "distributed_hardware_log.h"
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
DistributedInputClient &DistributedInputClient::GetInstance()
{
static DistributedInputClient instance;
return instance;
}
void DistributedInputClient::RegisterDInputCb::OnResult(
const std::string& devId, const std::string& dhId, const int32_t& status)
{
for (std::vector<DHardWareFwkRegistInfo>::iterator iter =
DistributedInputClient::GetInstance().dHardWareFwkRstInfos.begin();
iter != DistributedInputClient::GetInstance().dHardWareFwkRstInfos.end();
iter++) {
if (iter->devId == devId && iter->dhId == dhId) {
iter->callback->OnRegisterResult(devId, dhId, status, "");
DistributedInputClient::GetInstance().dHardWareFwkRstInfos.erase(iter);
return;
}
}
}
void DistributedInputClient::UnregisterDInputCb::OnResult(
const std::string& devId, const std::string& dhId, const int32_t& status)
{
for (std::vector<DHardWareFwkUnRegistInfo>::iterator iter =
DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.begin();
iter != DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.end();
iter++) {
if (iter->devId == devId && iter->dhId == dhId) {
iter->callback->OnUnregisterResult(devId, dhId, status, "");
DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.erase(iter);
return;
}
}
}
void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status, const uint32_t& inputTypes)
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
}
}
void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &deviceId, const std::string &strJson)
{
nlohmann::json inputData = nlohmann::json::parse(strJson);
int jsonSize = inputData.size();
DHLOGI("AddWhiteListInfosCb OnResult json size:%d.\n", jsonSize);
TYPE_WHITE_LIST_VEC vecWhiteList = inputData;
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
}
void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& deviceId)
{
WhiteListUtil::GetInstance().ClearWhiteList(deviceId);
}
int32_t DistributedInputClient::InitSource()
{
return SUCCESS;
}
int32_t DistributedInputClient::InitSink()
{
return SUCCESS;
}
int32_t DistributedInputClient::ReleaseSource()
{
return SUCCESS;
}
int32_t DistributedInputClient::ReleaseSink()
{
return SUCCESS;
}
int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId,
const std::string& parameters, const std::shared_ptr<RegisterCallback>& callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId,
const std::shared_ptr<UnregisterCallback>& callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::PrepareRemoteInput(
const std::string& deviceId, sptr<IPrepareDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::UnprepareRemoteInput(
const std::string& deviceId, sptr<IUnprepareDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::StartRemoteInput(
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStartDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::StopRemoteInput(
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStopDInputCallback> callback)
{
return SUCCESS;
}
bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event)
{
return true;
}
DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t& inputType)
{
return serverType;
}
bool DistributedInputClient::GetDInputSourceProxy()
{
return true;
}
bool DistributedInputClient::GetDInputSinkProxy()
{
return true;
}
bool DistributedInputClient::IsJsonData(std::string strData) const
{
return true;
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
+1
View File
@@ -46,6 +46,7 @@ ohos_unittest("distributed_input_source_handler_test") {
sources = [
"//foundation/distributedhardware/distributedinput/sourcehandler/src/distributed_input_source_handler.cpp",
"//foundation/distributedhardware/distributedinput/sourcehandler/src/load_d_input_source_callback.cpp",
"distributed_input_sourcehandler_test.cpp",
"//foundation/distributedhardware/distributedinput/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp",
]
@@ -92,7 +92,7 @@ HWTEST_F(DistributedInputSourceHandlerTest, RegisterDistributedHardware02, testi
std::string dhId = "";
int32_t ret = DistributedInputSourceHandler::GetInstance().RegisterDistributedHardware(
devId, dhId, OHOS::DistributedHardware::EnableParam {"version", "attrs" }, registerCallback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceHandlerTest, RegisterDistributedHardware03, testing::ext::TestSize.Level0)
@@ -125,7 +125,7 @@ HWTEST_F(DistributedInputSourceHandlerTest, UnregisterDistributedHardware02, tes
std::string dhId = "";
int32_t ret = DistributedInputSourceHandler::GetInstance().UnregisterDistributedHardware("devId",
"dhId", unregisterDInputCallback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceHandlerTest, UnregisterDistributedHardware03, testing::ext::TestSize.Level0)
@@ -135,7 +135,7 @@ HWTEST_F(DistributedInputSourceHandlerTest, UnregisterDistributedHardware03, tes
int32_t ret = DistributedInputSourceHandler::GetInstance().UnregisterDistributedHardware("devId",
"dhId", unregisterDInputCallback);
EXPECT_EQ(FAILURE, ret);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSourceHandlerTest, ConfigDistributedHardware01, testing::ext::TestSize.Level0)
@@ -59,14 +59,17 @@ void DistributedInputClient::UnregisterDInputCb::OnResult(
}
}
void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status)
void DistributedInputClient::StartDInputServerCb::OnResult(const int32_t& status, const uint32_t& inputTypes)
{
if (DInputServerType::SOURCE_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SOURCE_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else if (DInputServerType::SINK_SERVER_TYPE == static_cast<DInputServerType>(status)) {
DistributedInputClient::GetInstance().serverType = DInputServerType::SINK_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = inputTypes;
} else {
DistributedInputClient::GetInstance().serverType = DInputServerType::NULL_SERVER_TYPE;
DistributedInputClient::GetInstance().inputTypes = INPUT_TYPE_NULL;
}
}
@@ -105,7 +108,7 @@ int32_t DistributedInputClient::ReleaseSink()
}
int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId,
const std::string& parameters, std::shared_ptr<RegisterCallback>& callback)
const std::string& parameters, const std::shared_ptr<RegisterCallback>& callback)
{
return SUCCESS;
}
@@ -128,12 +131,14 @@ int32_t DistributedInputClient::UnprepareRemoteInput(
return SUCCESS;
}
int32_t DistributedInputClient::StartRemoteInput(const std::string& deviceId, sptr<IStartDInputCallback> callback)
int32_t DistributedInputClient::StartRemoteInput(
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStartDInputCallback> callback)
{
return SUCCESS;
}
int32_t DistributedInputClient::StopRemoteInput(const std::string& deviceId, sptr<IStopDInputCallback> callback)
int32_t DistributedInputClient::StopRemoteInput(
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStopDInputCallback> callback)
{
return SUCCESS;
}
@@ -143,7 +148,7 @@ bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const
return true;
}
DInputServerType DistributedInputClient::IsStartDistributedInput()
DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t& inputType)
{
return serverType;
}
@@ -158,7 +163,7 @@ bool DistributedInputClient::GetDInputSinkProxy()
return true;
}
bool DistributedInputClient::IsJsonData(const std::string strData) const
bool DistributedInputClient::IsJsonData(std::string strData) const
{
return true;
}