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 16 #ifndef OHOS_DM_AUTH_MANAGER_SECOND_TEST_H 17 #define OHOS_DM_AUTH_MANAGER_SECOND_TEST_H 18 19 #include <gmock/gmock.h> 20 #include <gtest/gtest.h> 21 #include <map> 22 #include <string> 23 24 #include "auth_message_processor.h" 25 #include "auth_request_state.h" 26 #include "auth_response_state.h" 27 #include "authentication.h" 28 #include "device_manager_service_listener.h" 29 #include "dm_adapter_manager.h" 30 #include "dm_auth_manager.h" 31 #include "dm_constants.h" 32 #include "dm_timer.h" 33 #include "hichain_connector.h" 34 #include "softbus_connector.h" 35 #include "softbus_session.h" 36 #include "hichain_connector_mock.h" 37 #include "multiple_user_connector_mock.h" 38 #include "softbus_connector_mock.h" 39 #include "hichain_auth_connector_mock.h" 40 #include "deviceprofile_connector_mock.h" 41 #include "dm_crypto_mock.h" 42 43 namespace OHOS { 44 namespace DistributedHardware { 45 class DmAuthManagerTest : public testing::Test { 46 public: 47 static void SetUpTestCase(); 48 static void TearDownTestCase(); 49 void SetUp(); 50 void TearDown(); 51 52 std::shared_ptr<DmAuthManager> authManager_; 53 static inline std::shared_ptr<HiChainConnectorMock> hiChainConnectorMock_ = nullptr; 54 static inline std::shared_ptr<MultipleUserConnectorMock> multipleUserConnectorMock_ = nullptr; 55 static inline std::shared_ptr<SoftbusConnectorMock> softbusConnectorMock_ = nullptr; 56 static inline std::shared_ptr<HiChainAuthConnectorMock> hiChainAuthConnectorMock_ = nullptr; 57 static inline std::shared_ptr<DeviceProfileConnectorMock> deviceProfileConnectorMock_ = nullptr; 58 static inline std::shared_ptr<CryptoMock> cryptoMock_ = nullptr; 59 }; 60 61 class AuthResponseInitStateMock : public AuthResponseInitState { 62 public: 63 MOCK_METHOD(int32_t, GetStateType, (), (override)); 64 }; 65 } // namespace DistributedHardware 66 } // namespace OHOS 67 #endif 68