1 /* 2 * Copyright (c) 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_DATA_DEV_MANAGER_MOCK_H 17 #define OHOS_DISTRIBUTED_DATA_DEV_MANAGER_MOCK_H 18 19 #include "dev_manager.h" 20 #include <gmock/gmock.h> 21 22 namespace OHOS::DistributedKv { 23 class BDevManager { 24 public: 25 virtual std::string ToUUID(const std::string &) = 0; 26 virtual const DevManager::DetailInfo &GetLocalDevice() = 0; 27 virtual std::string ToNetworkId(const std::string &) = 0; 28 virtual std::string GetUnEncryptedUuid() = 0; 29 BDevManager() = default; 30 virtual ~BDevManager() = default; 31 32 public: 33 static inline std::shared_ptr<BDevManager> devManager = nullptr; 34 }; 35 36 class DevManagerMock : public BDevManager { 37 public: 38 MOCK_METHOD(std::string, ToUUID, (const std::string &)); 39 MOCK_METHOD(const DevManager::DetailInfo &, GetLocalDevice, ()); 40 MOCK_METHOD(std::string, ToNetworkId, (const std::string &)); 41 MOCK_METHOD(std::string, GetUnEncryptedUuid, ()); 42 }; 43 } // namespace OHOS::DistributedKv 44 #endif // OHOS_DISTRIBUTED_DATA_DEV_MANAGER_MOCK_H