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_MOCK_DEVICE_INFO_H_
18#define SHILL_MOCK_DEVICE_INFO_H_
19
20#include <string>
21#include <vector>
22
23#include <base/macros.h>
24#include <gmock/gmock.h>
25
26#include "shill/device_info.h"
27
28namespace shill {
29
30class ByteString;
31class ControlInterface;
32class EventDispatcher;
33class IPAddress;
34class Manager;
35class Metrics;
36
37class MockDeviceInfo : public DeviceInfo {
38 public:
39  MockDeviceInfo(ControlInterface* control_interface,
40                 EventDispatcher* dispatcher,
41                 Metrics* metrics,
42                 Manager* manager);
43  ~MockDeviceInfo() override;
44
45  MOCK_METHOD1(IsDeviceBlackListed, bool(const std::string& device_name));
46  MOCK_METHOD1(AddDeviceToBlackList, void(const std::string& device_name));
47  MOCK_METHOD1(RemoveDeviceFromBlackList, void(const std::string& device_name));
48  MOCK_CONST_METHOD1(GetDevice, DeviceRefPtr(int interface_index));
49  MOCK_CONST_METHOD1(GetIndex, int(const std::string& interface_name));
50  MOCK_CONST_METHOD2(GetMACAddress, bool(int interface_index,
51                                         ByteString* address));
52  MOCK_CONST_METHOD1(GetMACAddressFromKernel, ByteString(int interface_index));
53  MOCK_CONST_METHOD3(GetMACAddressOfPeer,
54                     bool(int interface_index,
55                          const IPAddress& peer,
56                          ByteString* address));
57  MOCK_CONST_METHOD3(GetByteCounts, bool(int interface_index,
58                                         uint64_t* rx_bytes,
59                                         uint64_t* tx_bytes));
60  MOCK_CONST_METHOD2(GetFlags, bool(int interface_index,
61                                    unsigned int* flags));
62  MOCK_CONST_METHOD2(GetAddresses, bool(int interface_index,
63                                        std::vector<AddressData>* addresses));
64  MOCK_CONST_METHOD1(FlushAddresses, void(int interface_index));
65  MOCK_CONST_METHOD2(HasOtherAddress,
66                     bool(int interface_index,
67                          const IPAddress& excluded_address));
68  MOCK_CONST_METHOD2(HasDirectConnectivityTo,
69                     bool(int interface_index,
70                          const IPAddress& address));
71  MOCK_METHOD2(GetPrimaryIPv6Address,
72               bool(int interface_index, IPAddress* address));
73  MOCK_METHOD3(GetIPv6DnsServerAddresses,
74               bool(int interface_index,
75                    std::vector<IPAddress>* address_list,
76                    uint32_t* life_time));
77  MOCK_CONST_METHOD1(CreateTunnelInterface,  bool(std::string* interface_name));
78  MOCK_CONST_METHOD1(OpenTunnelInterface,
79                     int(const std::string& interface_name));
80  MOCK_CONST_METHOD1(DeleteInterface, bool(int interface_index));
81  MOCK_METHOD1(RegisterDevice, void(const DeviceRefPtr&));
82  MOCK_METHOD1(DeregisterDevice, void(const DeviceRefPtr&));
83  MOCK_CONST_METHOD1(SetHostname, bool(const std::string& hostname));
84
85 private:
86  DISALLOW_COPY_AND_ASSIGN(MockDeviceInfo);
87};
88
89}  // namespace shill
90
91#endif  // SHILL_MOCK_DEVICE_INFO_H_
92