1 /* 2 * Copyright (C) 2021-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 #ifndef OHOS_MOCK_IF_CONFIG_H 16 #define OHOS_MOCK_IF_CONFIG_H 17 18 #include <gmock/gmock.h> 19 20 namespace OHOS { 21 namespace Wifi { 22 typedef enum IpType { 23 IPTYPE_IPV4, 24 IPTYPE_IPV6, 25 IPTYPE_MIX, 26 IPTYPE_BUTT, 27 } IpType; 28 29 class MockIfConfig { 30 public: 31 virtual ~MockIfConfig() = default; 32 virtual void SetProxy(bool isAuto, const std::string &proxy, const std::string &port, const std::string &noProxys, 33 const std::string &pac) = 0; 34 virtual void FlushIpAddr(const std::string &ifName, const int &ipType) = 0; 35 }; 36 37 class IfConfig : public MockIfConfig { 38 public: 39 IfConfig() = default; 40 ~IfConfig() = default; 41 static IfConfig &GetInstance(void); 42 MOCK_METHOD5(SetProxy, void(bool isAuto, const std::string &proxy, const std::string &port, 43 const std::string &noProxys, const std::string &pac)); 44 MOCK_METHOD2(FlushIpAddr, void(const std::string &ifName, const int &ipType)); 45 }; 46 } // namespace Wifi 47 } // namespace OHOS 48 #endif