1 /*
2  * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DISTRIBUTED_INPUT_IPC_TEST_H
17 #define DISTRIBUTED_INPUT_IPC_TEST_H
18 
19 #include <functional>
20 #include <iostream>
21 #include <refbase.h>
22 #include <thread>
23 
24 #include <gtest/gtest.h>
25 
26 #include "constants_dinput.h"
27 #include "dinput_sa_manager.h"
28 #include "distributed_input_client.h"
29 #include "input_node_listener_stub.h"
30 #include "simulation_event_listener_stub.h"
31 
32 
33 namespace OHOS {
34 namespace DistributedHardware {
35 namespace DistributedInput {
36 class DistributedInputIpcTest : public testing::Test {
37 public:
38     static void SetUpTestCase();
39     static void TearDownTestCase();
40     void SetUp() override;
41     void TearDown() override;
42 
43     class TestInputNodeListener : public
44         OHOS::DistributedHardware::DistributedInput::InputNodeListenerStub {
45     public:
46         TestInputNodeListener() = default;
47         virtual ~TestInputNodeListener() = default;
48         void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId,
49             const std::string &sinkNodeId, const std::string &sinkNodeDesc);
50 
51         void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId,
52             const std::string &sinkNodeId);
53     };
54 
55     class TestSimulationEventListenerStub : public
56         OHOS::DistributedHardware::DistributedInput::SimulationEventListenerStub {
57     public:
58         TestSimulationEventListenerStub() = default;
59         virtual ~TestSimulationEventListenerStub() = default;
60         int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value);
61     };
62 };
63 } // namespace DistributedInput
64 } // namespace DistributedHardware
65 } // namespace OHOS
66 
67 #endif // DISTRIBUTED_INPUT_IPC_TEST_H
68