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 DISC_MANAGER_MOCK_H 17 #define DISC_MANAGER_MOCK_H 18 19 #include <gmock/gmock.h> 20 #include "disc_manager.h" 21 #include "lnn_ohos_account_adapter.h" 22 23 namespace OHOS { 24 class DiscManagerInterface { 25 public: DiscManagerInterface()26 DiscManagerInterface() {}; ~DiscManagerInterface()27 virtual ~DiscManagerInterface() {}; 28 29 virtual int32_t DiscPublishService(const char *packageName, const PublishInfo *info) = 0; 30 virtual int32_t DiscStartScan(DiscModule moduleId, const PublishInfo *info) = 0; 31 virtual int32_t DiscUnPublishService(const char *packageName, int32_t publishId) = 0; 32 virtual int32_t DiscUnpublish(DiscModule moduleId, int32_t publishId) = 0; 33 virtual int32_t DiscStartDiscovery(const char *packageName, const SubscribeInfo *info, 34 const IServerDiscInnerCallback *cb) = 0; 35 virtual int32_t DiscSetDiscoverCallback(DiscModule moduleId, const DiscInnerCallback *callback) = 0; 36 virtual int32_t DiscStartAdvertise(DiscModule moduleId, const SubscribeInfo *info) = 0; 37 virtual int32_t DiscStopDiscovery(const char *packageName, int32_t subscribeId) = 0; 38 virtual int32_t DiscStopAdvertise(DiscModule moduleId, int32_t subscribeId) = 0; 39 }; 40 class DiscManagerInterfaceMock : public DiscManagerInterface { 41 public: 42 DiscManagerInterfaceMock(); 43 ~DiscManagerInterfaceMock() override; 44 MOCK_METHOD2(DiscPublishService, int32_t(const char *, const PublishInfo *)); 45 MOCK_METHOD2(DiscStartScan, int32_t(DiscModule, const PublishInfo *)); 46 MOCK_METHOD2(DiscUnPublishService, int32_t(const char *, int32_t)); 47 MOCK_METHOD2(DiscUnpublish, int32_t(DiscModule, int32_t)); 48 MOCK_METHOD3(DiscStartDiscovery, int32_t(const char *, const SubscribeInfo *, const IServerDiscInnerCallback *)); 49 MOCK_METHOD2(DiscSetDiscoverCallback, int32_t(DiscModule, const DiscInnerCallback *)); 50 MOCK_METHOD2(DiscStartAdvertise, int32_t(DiscModule, const SubscribeInfo *)); 51 MOCK_METHOD2(DiscStopDiscovery, int32_t(const char *, int32_t)); 52 MOCK_METHOD2(DiscStopAdvertise, int32_t(DiscModule, int32_t)); 53 }; 54 } // namespace OHOS 55 #endif // DISC_MANAGER_MOCK_H 56