Signed-off-by: l30054665 <lishang21@huawei.com>
This commit is contained in:
l30054665
2023-12-02 18:22:40 +08:00
parent 62e6710103
commit cbe4fb1135
4 changed files with 42 additions and 0 deletions
@@ -62,6 +62,8 @@ ohos_unittest("distributed_input_inner_test") {
"${ipc_path}/src/prepare_d_input_call_back_stub.cpp",
"${ipc_path}/src/register_d_input_call_back_proxy.cpp",
"${ipc_path}/src/register_d_input_call_back_stub.cpp",
"${ipc_path}/src/register_session_state_callback_proxy.cpp",
"${ipc_path}/src/register_session_state_callback_stub.cpp",
"${ipc_path}/src/sharing_dhid_listener_proxy.cpp",
"${ipc_path}/src/sharing_dhid_listener_stub.cpp",
"${ipc_path}/src/simulation_event_listener_proxy.cpp",
@@ -113,6 +113,13 @@ int32_t DistributedInputInnerTest::TestSimulationEventListenerStub::OnSimulation
return DH_SUCCESS;
}
void DistributedInputInnerTest::TestRegisterSessionStateCb::OnResult(const std::string &devId, const uint32_t status)
{
(void)devId;
(void)status;
return;
}
int DistributedInputInnerTest::CheckSourceProxy() const
{
OHOS::sptr<OHOS::ISystemAbilityManager> systemAbilityManager =
@@ -486,6 +493,19 @@ HWTEST_F(DistributedInputInnerTest, UnregisterSimulationEventListener02, testing
int32_t ret = DistributedInputKit::UnregisterSimulationEventListener(listener);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, RegisterSessionStateCb01, testing::ext::TestSize.Level0)
{
sptr<TestRegisterSessionStateCb> listener(new TestRegisterSessionStateCb());
int32_t ret = DistributedInputKit::RegisterSessionStateCb(listener);
EXPECT_EQ(DH_SUCCESS, ret);
}
HWTEST_F(DistributedInputInnerTest, UnregisterSessionStateCb01, testing::ext::TestSize.Level0)
{
int32_t ret = DistributedInputKit::UnregisterSessionStateCb();
EXPECT_EQ(DH_SUCCESS, ret);
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS
@@ -37,6 +37,7 @@
#include "stop_d_input_call_back_stub.h"
#include "simulation_event_listener_stub.h"
#include "unprepare_d_input_call_back_stub.h"
#include "register_session_state_callback_stub.h"
namespace OHOS {
namespace DistributedHardware {
@@ -109,6 +110,14 @@ public:
virtual ~TestSimulationEventListenerStub() = default;
int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value);
};
class TestRegisterSessionStateCb : public
OHOS::DistributedHardware::DistributedInput::RegisterSessionStateCallbackStub {
public:
TestRegisterSessionStateCb() = default;
virtual ~TestRegisterSessionStateCb() = default;
void OnResult(const std::string &devId, const uint32_t status);
};
};
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -227,6 +227,17 @@ int32_t DistributedInputClient::UnregisterSimulationEventListener(sptr<ISimulati
{
return DH_SUCCESS;
}
int32_t DistributedInputClient::RegisterSessionStateCb(sptr<ISessionStateCallback> callback)
{
(void)callback;
return DH_SUCCESS;
}
int32_t DistributedInputClient::UnregisterSessionStateCb()
{
return DH_SUCCESS;
}
} // namespace DistributedInput
} // namespace DistributedHardware
} // namespace OHOS