• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #define private public
24 #include "distributed_hardware_stub.h"
25 #undef private
26 
27 namespace OHOS {
28 namespace DistributedHardware {
29 class DistributedHardwareStubTest : public testing::Test {
30 public:
31     static void SetUpTestCase(void);
32     static void TearDownTestCase(void);
33     void SetUp();
34     void TearDown();
35     std::shared_ptr<DistributedHardwareStub> stubTest_ = nullptr;
36 };
37 
38 class MockDistributedHardwareStub : public DistributedHardwareStub {
39 public:
RegisterPublisherListener(const DHTopic topic,const sptr<IPublisherListener> & listener)40 int32_t RegisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> &listener)
41 {
42     (void)topic;
43     (void)listener;
44     return DH_FWK_SUCCESS;
45 }
46 
UnregisterPublisherListener(const DHTopic topic,const sptr<IPublisherListener> & listener)47 int32_t UnregisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> &listener)
48 {
49     (void)topic;
50     (void)listener;
51     return DH_FWK_SUCCESS;
52 }
53 
PublishMessage(const DHTopic topic,const std::string & msg)54 int32_t PublishMessage(const DHTopic topic, const std::string &msg)
55 {
56     (void)topic;
57     (void)msg;
58     return DH_FWK_SUCCESS;
59 }
60 
QueryLocalSysSpec(QueryLocalSysSpecType spec)61 std::string QueryLocalSysSpec(QueryLocalSysSpecType spec)
62 {
63     (void)spec;
64     return "";
65 }
66 
InitializeAVCenter(const TransRole & transRole,int32_t & engineId)67 int32_t InitializeAVCenter(const TransRole &transRole, int32_t &engineId)
68 {
69     (void)transRole;
70     (void)engineId;
71     return DH_FWK_SUCCESS;
72 }
73 
ReleaseAVCenter(int32_t engineId)74 int32_t ReleaseAVCenter(int32_t engineId)
75 {
76     (void)engineId;
77     return DH_FWK_SUCCESS;
78 }
79 
CreateControlChannel(int32_t engineId,const std::string & peerDevId)80 int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId)
81 {
82     (void)engineId;
83     (void)peerDevId;
84     return DH_FWK_SUCCESS;
85 }
86 
NotifyAVCenter(int32_t engineId,const AVTransEvent & event)87 int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event)
88 {
89     (void)engineId;
90     (void)event;
91     return DH_FWK_SUCCESS;
92 }
93 
RegisterCtlCenterCallback(int32_t engineId,const sptr<IAVTransControlCenterCallback> & callback)94 int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr<IAVTransControlCenterCallback> &callback)
95 {
96     (void)engineId;
97     (void)callback;
98     return DH_FWK_SUCCESS;
99 }
100 };
101 } // namespace DistributedHardware
102 } // namespace OHOS
103 #endif
104