1// 2// Copyright (C) 2012 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17#ifndef SHILL_NET_MOCK_RTNL_HANDLER_H_ 18#define SHILL_NET_MOCK_RTNL_HANDLER_H_ 19 20#include <string> 21 22#include <base/macros.h> 23#include <gmock/gmock.h> 24 25#include "shill/net/rtnl_handler.h" 26 27namespace shill { 28 29class MockRTNLHandler : public RTNLHandler { 30 public: 31 MockRTNLHandler() {} 32 ~MockRTNLHandler() override {} 33 34 MOCK_METHOD1(Start, void(uint32_t netlink_groups_mask)); 35 MOCK_METHOD1(AddListener, void(RTNLListener* to_add)); 36 MOCK_METHOD1(RemoveListener, void(RTNLListener* to_remove)); 37 MOCK_METHOD3(SetInterfaceFlags, void(int interface_index, 38 unsigned int flags, 39 unsigned int change)); 40 MOCK_METHOD2(SetInterfaceMTU, void(int interface_index, unsigned int mtu)); 41 MOCK_METHOD4(AddInterfaceAddress, bool(int interface_index, 42 const IPAddress& local, 43 const IPAddress& broadcast, 44 const IPAddress& peer)); 45 MOCK_METHOD2(RemoveInterfaceAddress, bool(int interface_index, 46 const IPAddress& local)); 47 MOCK_METHOD1(RemoveInterface, bool(int interface_index)); 48 MOCK_METHOD1(RequestDump, void(int request_flags)); 49 MOCK_METHOD1(GetInterfaceIndex, int(const std::string& interface_name)); 50 MOCK_METHOD2(SendMessageWithErrorMask, bool(RTNLMessage* message, 51 const ErrorMask& error_mask)); 52 MOCK_METHOD1(SendMessage, bool(RTNLMessage* message)); 53 54 private: 55 DISALLOW_COPY_AND_ASSIGN(MockRTNLHandler); 56}; 57 58} // namespace shill 59 60#endif // SHILL_NET_MOCK_RTNL_HANDLER_H_ 61