10704ebd2Sopenharmony_ci/*
20704ebd2Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
30704ebd2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
40704ebd2Sopenharmony_ci * you may not use this file except in compliance with the License.
50704ebd2Sopenharmony_ci * You may obtain a copy of the License at
60704ebd2Sopenharmony_ci *
70704ebd2Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
80704ebd2Sopenharmony_ci *
90704ebd2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
100704ebd2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
110704ebd2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120704ebd2Sopenharmony_ci * See the License for the specific language governing permissions and
130704ebd2Sopenharmony_ci * limitations under the License.
140704ebd2Sopenharmony_ci */
150704ebd2Sopenharmony_ci
160704ebd2Sopenharmony_ci#ifndef DISRIBUTED_INPUT_INNER_TEST_H
170704ebd2Sopenharmony_ci#define DISRIBUTED_INPUT_INNER_TEST_H
180704ebd2Sopenharmony_ci
190704ebd2Sopenharmony_ci#include <functional>
200704ebd2Sopenharmony_ci#include <iostream>
210704ebd2Sopenharmony_ci#include <refbase.h>
220704ebd2Sopenharmony_ci#include <thread>
230704ebd2Sopenharmony_ci
240704ebd2Sopenharmony_ci#include <gtest/gtest.h>
250704ebd2Sopenharmony_ci#include "ipc_skeleton.h"
260704ebd2Sopenharmony_ci#include "iservice_registry.h"
270704ebd2Sopenharmony_ci#include "system_ability_definition.h"
280704ebd2Sopenharmony_ci
290704ebd2Sopenharmony_ci#include "constants_dinput.h"
300704ebd2Sopenharmony_ci#include "distributed_input_kit.h"
310704ebd2Sopenharmony_ci#include "input_node_listener_stub.h"
320704ebd2Sopenharmony_ci#include "i_distributed_sink_input.h"
330704ebd2Sopenharmony_ci#include "i_distributed_source_input.h"
340704ebd2Sopenharmony_ci#include "start_stop_d_inputs_call_back_stub.h"
350704ebd2Sopenharmony_ci#include "prepare_d_input_call_back_stub.h"
360704ebd2Sopenharmony_ci#include "start_d_input_call_back_stub.h"
370704ebd2Sopenharmony_ci#include "stop_d_input_call_back_stub.h"
380704ebd2Sopenharmony_ci#include "simulation_event_listener_stub.h"
390704ebd2Sopenharmony_ci#include "unprepare_d_input_call_back_stub.h"
400704ebd2Sopenharmony_ci
410704ebd2Sopenharmony_cinamespace OHOS {
420704ebd2Sopenharmony_cinamespace DistributedHardware {
430704ebd2Sopenharmony_cinamespace DistributedInput {
440704ebd2Sopenharmony_ciclass DistributedInputTest : public testing::Test {
450704ebd2Sopenharmony_cipublic:
460704ebd2Sopenharmony_ci    static void SetUpTestCase();
470704ebd2Sopenharmony_ci    static void TearDownTestCase();
480704ebd2Sopenharmony_ci    void SetUp() override;
490704ebd2Sopenharmony_ci    void TearDown() override;
500704ebd2Sopenharmony_ci    int CheckSourceProxy() const;
510704ebd2Sopenharmony_ci    int CheckSinkProxy() const;
520704ebd2Sopenharmony_ci
530704ebd2Sopenharmony_ci    class TestPrepareDInputCallback : public
540704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::PrepareDInputCallbackStub {
550704ebd2Sopenharmony_ci    public:
560704ebd2Sopenharmony_ci        TestPrepareDInputCallback() = default;
570704ebd2Sopenharmony_ci        virtual ~TestPrepareDInputCallback() = default;
580704ebd2Sopenharmony_ci        void OnResult(const std::string& deviceId, const int32_t& status);
590704ebd2Sopenharmony_ci    };
600704ebd2Sopenharmony_ci
610704ebd2Sopenharmony_ci    class TestUnprepareDInputCallback : public
620704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::UnprepareDInputCallbackStub {
630704ebd2Sopenharmony_ci    public:
640704ebd2Sopenharmony_ci        TestUnprepareDInputCallback() = default;
650704ebd2Sopenharmony_ci        virtual ~TestUnprepareDInputCallback() = default;
660704ebd2Sopenharmony_ci        void OnResult(const std::string& deviceId, const int32_t& status);
670704ebd2Sopenharmony_ci    };
680704ebd2Sopenharmony_ci
690704ebd2Sopenharmony_ci    class TestStartDInputCallback : public
700704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::StartDInputCallbackStub {
710704ebd2Sopenharmony_ci    public:
720704ebd2Sopenharmony_ci        TestStartDInputCallback() = default;
730704ebd2Sopenharmony_ci        virtual ~TestStartDInputCallback() = default;
740704ebd2Sopenharmony_ci        void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status);
750704ebd2Sopenharmony_ci    };
760704ebd2Sopenharmony_ci
770704ebd2Sopenharmony_ci    class TestStopDInputCallback : public
780704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::StopDInputCallbackStub {
790704ebd2Sopenharmony_ci    public:
800704ebd2Sopenharmony_ci        TestStopDInputCallback() = default;
810704ebd2Sopenharmony_ci        virtual ~TestStopDInputCallback() = default;
820704ebd2Sopenharmony_ci        void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status);
830704ebd2Sopenharmony_ci    };
840704ebd2Sopenharmony_ci
850704ebd2Sopenharmony_ci    class TestStartStopDInputCallback : public
860704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::StartStopDInputsCallbackStub {
870704ebd2Sopenharmony_ci    public:
880704ebd2Sopenharmony_ci        TestStartStopDInputCallback() = default;
890704ebd2Sopenharmony_ci        virtual ~TestStartStopDInputCallback() = default;
900704ebd2Sopenharmony_ci        void OnResultDhids(const std::string &devId, const int32_t &status);
910704ebd2Sopenharmony_ci    };
920704ebd2Sopenharmony_ci
930704ebd2Sopenharmony_ci    class TestInputNodeListener : public
940704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::InputNodeListenerStub {
950704ebd2Sopenharmony_ci    public:
960704ebd2Sopenharmony_ci        TestInputNodeListener() = default;
970704ebd2Sopenharmony_ci        virtual ~TestInputNodeListener() = default;
980704ebd2Sopenharmony_ci        void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId,
990704ebd2Sopenharmony_ci            const std::string &sinkNodeId, const std::string &sinkNodeDesc);
1000704ebd2Sopenharmony_ci
1010704ebd2Sopenharmony_ci        void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId,
1020704ebd2Sopenharmony_ci            const std::string &sinkNodeId);
1030704ebd2Sopenharmony_ci    };
1040704ebd2Sopenharmony_ci
1050704ebd2Sopenharmony_ci    class TestSimulationEventListenerStub : public
1060704ebd2Sopenharmony_ci        OHOS::DistributedHardware::DistributedInput::SimulationEventListenerStub {
1070704ebd2Sopenharmony_ci    public:
1080704ebd2Sopenharmony_ci        TestSimulationEventListenerStub() = default;
1090704ebd2Sopenharmony_ci        virtual ~TestSimulationEventListenerStub() = default;
1100704ebd2Sopenharmony_ci        int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value);
1110704ebd2Sopenharmony_ci    };
1120704ebd2Sopenharmony_ci};
1130704ebd2Sopenharmony_ci} // namespace DistributedInput
1140704ebd2Sopenharmony_ci} // namespace DistributedHardware
1150704ebd2Sopenharmony_ci} // namespace OHOS
1160704ebd2Sopenharmony_ci
1170704ebd2Sopenharmony_ci#endif // DISRIBUTED_INPUT_INNER_TEST_H
118