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 OHOS_DISTRIBUTED_HARDWARE_STUB_TEST_H
17 #define OHOS_DISTRIBUTED_HARDWARE_STUB_TEST_H
18 
19 #include <gtest/gtest.h>
20 
21 #include "distributed_hardware_errno.h"
22 #include "distributed_hardware_fwk_kit_paras.h"
23 #include "distributed_hardware_stub.h"
24 
25 namespace OHOS {
26 namespace DistributedHardware {
27 class DistributedHardwareStubTest : public testing::Test {
28 public:
29     static void SetUpTestCase(void);
30     static void TearDownTestCase(void);
31     void SetUp();
32     void TearDown();
33     std::shared_ptr<DistributedHardwareStub> stubTest_ = nullptr;
34 };
35 
36 class MockDistributedHardwareStub : public DistributedHardwareStub {
37 public:
RegisterPublisherListener(const DHTopic topic,const sptr<IPublisherListener> listener)38 int32_t RegisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> listener)
39 {
40     (void)topic;
41     (void)listener;
42     return DH_FWK_SUCCESS;
43 }
44 
UnregisterPublisherListener(const DHTopic topic,const sptr<IPublisherListener> listener)45 int32_t UnregisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> listener)
46 {
47     (void)topic;
48     (void)listener;
49     return DH_FWK_SUCCESS;
50 }
51 
PublishMessage(const DHTopic topic,const std::string & msg)52 int32_t PublishMessage(const DHTopic topic, const std::string &msg)
53 {
54     (void)topic;
55     (void)msg;
56     return DH_FWK_SUCCESS;
57 }
58 
QueryLocalSysSpec(QueryLocalSysSpecType spec)59 std::string QueryLocalSysSpec(QueryLocalSysSpecType spec)
60 {
61     (void)spec;
62     return "";
63 }
64 
InitializeAVCenter(const TransRole & transRole,int32_t & engineId)65 int32_t InitializeAVCenter(const TransRole &transRole, int32_t &engineId)
66 {
67     (void)transRole;
68     (void)engineId;
69     return DH_FWK_SUCCESS;
70 }
71 
ReleaseAVCenter(int32_t engineId)72 int32_t ReleaseAVCenter(int32_t engineId)
73 {
74     (void)engineId;
75     return DH_FWK_SUCCESS;
76 }
77 
CreateControlChannel(int32_t engineId,const std::string & peerDevId)78 int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId)
79 {
80     (void)engineId;
81     (void)peerDevId;
82     return DH_FWK_SUCCESS;
83 }
84 
NotifyAVCenter(int32_t engineId,const AVTransEvent & event)85 int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event)
86 {
87     (void)engineId;
88     (void)event;
89     return DH_FWK_SUCCESS;
90 }
91 
RegisterCtlCenterCallback(int32_t engineId,const sptr<IAVTransControlCenterCallback> callback)92 int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr<IAVTransControlCenterCallback> callback)
93 {
94     (void)engineId;
95     (void)callback;
96     return DH_FWK_SUCCESS;
97 }
98 
NotifySourceRemoteSinkStarted(std::string & deviceId)99 int32_t NotifySourceRemoteSinkStarted(std::string &deviceId)
100 {
101     (void)deviceId;
102     return DH_FWK_SUCCESS;
103 }
104 
PauseDistributedHardware(DHType dhType,const std::string & networkId)105 int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId)
106 {
107     (void)dhType;
108     (void)networkId;
109     return DH_FWK_SUCCESS;
110 }
111 
ResumeDistributedHardware(DHType dhType,const std::string & networkId)112 int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId)
113 {
114     (void)dhType;
115     (void)networkId;
116     return DH_FWK_SUCCESS;
117 }
118 
StopDistributedHardware(DHType dhType,const std::string & networkId)119 int32_t StopDistributedHardware(DHType dhType, const std::string &networkId)
120 {
121     (void)dhType;
122     (void)networkId;
123     return DH_FWK_SUCCESS;
124 }
125 };
126 } // namespace DistributedHardware
127 } // namespace OHOS
128 #endif
129