• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2025 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 
GetDistributedHardware(const std::string & networkId,std::vector<DHDescriptor> & descriptors)126 int32_t GetDistributedHardware(const std::string &networkId, std::vector<DHDescriptor> &descriptors)
127 {
128     (void)networkId;
129     (void)descriptors;
130     return DH_FWK_SUCCESS;
131 }
132 
RegisterDHStatusListener(sptr<IHDSinkStatusListener> listener)133 int32_t RegisterDHStatusListener(sptr<IHDSinkStatusListener> listener)
134 {
135     (void)listener;
136     return DH_FWK_SUCCESS;
137 }
138 
UnregisterDHStatusListener(sptr<IHDSinkStatusListener> listener)139 int32_t UnregisterDHStatusListener(sptr<IHDSinkStatusListener> listener)
140 {
141     (void)listener;
142     return DH_FWK_SUCCESS;
143 }
144 
RegisterDHStatusListener(const std::string & networkId,sptr<IHDSourceStatusListener> listener)145 int32_t RegisterDHStatusListener(const std::string &networkId, sptr<IHDSourceStatusListener> listener)
146 {
147     (void)networkId;
148     (void)listener;
149     return DH_FWK_SUCCESS;
150 }
151 
UnregisterDHStatusListener(const std::string & networkId,sptr<IHDSourceStatusListener> listener)152 int32_t UnregisterDHStatusListener(const std::string &networkId, sptr<IHDSourceStatusListener> listener)
153 {
154     (void)networkId;
155     (void)listener;
156     return DH_FWK_SUCCESS;
157 }
158 
EnableSink(const std::vector<DHDescriptor> & descriptors)159 int32_t EnableSink(const std::vector<DHDescriptor> &descriptors)
160 {
161     (void)descriptors;
162     return DH_FWK_SUCCESS;
163 }
164 
DisableSink(const std::vector<DHDescriptor> & descriptors)165 int32_t DisableSink(const std::vector<DHDescriptor> &descriptors)
166 {
167     (void)descriptors;
168     return DH_FWK_SUCCESS;
169 }
170 
EnableSource(const std::string & networkId,const std::vector<DHDescriptor> & descriptors)171 int32_t EnableSource(const std::string &networkId, const std::vector<DHDescriptor> &descriptors)
172 {
173     (void)networkId;
174     (void)descriptors;
175     return DH_FWK_SUCCESS;
176 }
177 
DisableSource(const std::string & networkId,const std::vector<DHDescriptor> & descriptors)178 int32_t DisableSource(const std::string &networkId, const std::vector<DHDescriptor> &descriptors)
179 {
180     (void)networkId;
181     (void)descriptors;
182     return DH_FWK_SUCCESS;
183 }
184 };
185 } // namespace DistributedHardware
186 } // namespace OHOS
187 #endif
188