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 #ifndef OHOS_UTTEST_HICHAIN_CONNECTOR_H 16 #define OHOS_UTTEST_HICHAIN_CONNECTOR_H 17 18 #include <gtest/gtest.h> 19 #include <gmock/gmock.h> 20 #include <refbase.h> 21 #include <string> 22 #include <memory> 23 #include <cstdint> 24 #include <map> 25 #include <vector> 26 27 #include "nlohmann/json.hpp" 28 #include "device_auth.h" 29 #include "dm_single_instance.h" 30 #include "hichain_connector_callback.h" 31 #include "device_manager_service_listener.h" 32 #include "dm_auth_manager.h" 33 #include "dm_device_state_manager.h" 34 #include "hichain_connector.h" 35 36 namespace OHOS { 37 namespace DistributedHardware { 38 class HichainConnectorTest : public testing::Test { 39 public: 40 static void SetUpTestCase(); 41 static void TearDownTestCase(); 42 void SetUp(); 43 void TearDown(); 44 }; 45 46 class MockIHiChainConnectorCallback : public IHiChainConnectorCallback { 47 public: 48 MockIHiChainConnectorCallback() = default; 49 virtual ~MockIHiChainConnectorCallback() = default; 50 MOCK_METHOD(void, OnGroupCreated, (int64_t requestId, const std::string &groupId), (override)); 51 MOCK_METHOD(void, OnMemberJoin, (int64_t requestId, int32_t status), (override)); 52 MOCK_METHOD(std::string, GetConnectAddr, (std::string deviceId), (override)); 53 MOCK_METHOD(int32_t, GetPinCode, (int32_t &code), (override)); 54 }; 55 } // namespace DistributedHardware 56 } // namespace OHOS 57 #endif // OHOS_HICHAIN_CONNECTOR_H 58