1 /* 2 * Copyright (C) 2021 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_MOCK_DHCPSERVICE_H 16 #define OHOS_MOCK_DHCPSERVICE_H 17 #include <gtest/gtest.h> 18 #include <gmock/gmock.h> 19 #include "dhcp_c_api.h" 20 21 namespace OHOS { 22 namespace Wifi { 23 class MockDhcpService { 24 public: 25 MOCK_METHOD2(RegisterDhcpClientCallBack, DhcpErrorCode(const char *ifname, const ClientCallBack *event)); 26 MOCK_METHOD2(StartDhcpClient, DhcpErrorCode(const char *ifname, bool bIpv6)); 27 MOCK_METHOD2(StopDhcpClient, DhcpErrorCode(const char *ifname, bool bIpv6)); 28 MOCK_METHOD2(RegisterDhcpServerCallBack, DhcpErrorCode(const char *ifname, const ServerCallBack *event)); 29 MOCK_METHOD1(StartDhcpServer, DhcpErrorCode(const char *ifname)); 30 MOCK_METHOD1(StopDhcpServer, DhcpErrorCode(const char *ifname)); 31 MOCK_METHOD2(PutDhcpRange, DhcpErrorCode(const char *tagName, const DhcpRange *range)); 32 MOCK_METHOD2(RemoveDhcpRange, DhcpErrorCode(const char *tagName, const void *range)); 33 MOCK_METHOD1(RemoveAllDhcpRange, DhcpErrorCode(const char *tagName)); 34 MOCK_METHOD2(SetDhcpRange, DhcpErrorCode(const char *ifname, const DhcpRange *range)); 35 MOCK_METHOD2(SetDhcpName, DhcpErrorCode(const char *ifname, const char *tagName)); 36 MOCK_METHOD4(GetDhcpClientInfos, DhcpErrorCode(const char *ifname, int staNumber, DhcpStationInfo *staInfo, int *staSize)); 37 MOCK_METHOD1(UpdateLeasesTime, DhcpErrorCode(const char *leaseTime)); 38 39 static MockDhcpService &GetInstance(); 40 private: 41 MockDhcpService(); 42 ~MockDhcpService(); 43 }; 44 } // namespace Wifi 45 } // namespace OHOS 46 #endif 47