Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 5 | #ifndef SHILL_MOCK_DEVICE_INFO_H_ |
| 6 | #define SHILL_MOCK_DEVICE_INFO_H_ |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 7 | |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 8 | #include <string> |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
Darin Petkov | 1bdedf1 | 2011-08-26 13:32:11 -0700 | [diff] [blame] | 11 | #include <base/basictypes.h> |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 12 | #include <gmock/gmock.h> |
| 13 | |
| 14 | #include "shill/device_info.h" |
| 15 | |
| 16 | namespace shill { |
| 17 | |
| 18 | class ByteString; |
| 19 | class ControlInterface; |
| 20 | class EventDispatcher; |
Paul Stewart | 05a42c2 | 2012-08-02 16:47:21 -0700 | [diff] [blame] | 21 | class IPAddress; |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 22 | class Manager; |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 23 | class Metrics; |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 24 | |
| 25 | class MockDeviceInfo : public DeviceInfo { |
| 26 | public: |
| 27 | MockDeviceInfo(ControlInterface *control_interface, |
| 28 | EventDispatcher *dispatcher, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 29 | Metrics *metrics, |
Darin Petkov | 1bdedf1 | 2011-08-26 13:32:11 -0700 | [diff] [blame] | 30 | Manager *manager); |
| 31 | virtual ~MockDeviceInfo(); |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 32 | |
mukesh agrawal | 12533ad | 2013-08-01 15:43:23 -0700 | [diff] [blame] | 33 | MOCK_METHOD1(IsDeviceBlackListed, bool(const std::string &device_name)); |
Paul Stewart | c8f4bef | 2011-12-13 09:45:51 -0800 | [diff] [blame] | 34 | MOCK_CONST_METHOD1(GetDevice, DeviceRefPtr(int interface_index)); |
Darin Petkov | f8046b8 | 2012-04-24 16:29:23 +0200 | [diff] [blame] | 35 | MOCK_CONST_METHOD1(GetIndex, int(const std::string &interface_name)); |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 36 | MOCK_CONST_METHOD2(GetMACAddress, bool(int interface_index, |
Paul Stewart | c67f0bd | 2013-12-06 12:14:50 -0800 | [diff] [blame] | 37 | ByteString *address)); |
Gary Morain | bf74a67 | 2012-07-30 16:27:19 -0700 | [diff] [blame] | 38 | MOCK_CONST_METHOD1(GetMACAddressFromKernel, ByteString(int interface_index)); |
Paul Stewart | c67f0bd | 2013-12-06 12:14:50 -0800 | [diff] [blame] | 39 | MOCK_CONST_METHOD3(GetMACAddressOfPeer, |
| 40 | bool(int interface_index, |
| 41 | const IPAddress &peer, |
| 42 | ByteString *address)); |
Paul Stewart | 6ff27f5 | 2012-07-11 06:51:41 -0700 | [diff] [blame] | 43 | MOCK_CONST_METHOD3(GetByteCounts, bool(int interface_index, |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame] | 44 | uint64_t *rx_bytes, |
| 45 | uint64_t *tx_bytes)); |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 46 | MOCK_CONST_METHOD2(GetFlags, bool(int interface_index, |
| 47 | unsigned int* flags)); |
| 48 | MOCK_CONST_METHOD2(GetAddresses, bool(int interface_index, |
| 49 | std::vector<AddressData>* addresses)); |
| 50 | MOCK_CONST_METHOD1(FlushAddresses, void(int interface_index)); |
Paul Stewart | 05a42c2 | 2012-08-02 16:47:21 -0700 | [diff] [blame] | 51 | MOCK_CONST_METHOD2(HasOtherAddress, |
| 52 | bool(int interface_index, |
| 53 | const IPAddress &excluded_address)); |
Paul Stewart | a0db0ff | 2013-12-09 09:48:47 -0800 | [diff] [blame] | 54 | MOCK_CONST_METHOD2(HasDirectConnectivityTo, |
| 55 | bool(int interface_index, |
| 56 | const IPAddress &address)); |
Paul Stewart | d4f2648 | 2014-04-25 19:12:03 -0700 | [diff] [blame] | 57 | MOCK_METHOD2(GetPrimaryIPv6Address, |
| 58 | bool(int interface_index, IPAddress *address)); |
Paul Stewart | ca6abd4 | 2012-03-01 15:45:29 -0800 | [diff] [blame] | 59 | MOCK_CONST_METHOD1(CreateTunnelInterface, bool(std::string *interface_name)); |
| 60 | MOCK_CONST_METHOD1(DeleteInterface, bool(int interface_index)); |
David Rochberg | fa1d31d | 2012-03-20 10:38:07 -0400 | [diff] [blame] | 61 | MOCK_METHOD1(RegisterDevice, void(const DeviceRefPtr &)); |
| 62 | MOCK_METHOD1(DeregisterDevice, void(const DeviceRefPtr &)); |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 63 | |
| 64 | private: |
| 65 | DISALLOW_COPY_AND_ASSIGN(MockDeviceInfo); |
| 66 | }; |
| 67 | |
| 68 | } // namespace shill |
| 69 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 70 | #endif // SHILL_MOCK_DEVICE_INFO_H_ |