Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_MOCK_NL80211_SOCKET_ |
| 6 | #define SHILL_MOCK_NL80211_SOCKET_ |
| 7 | |
| 8 | #include <gmock/gmock.h> |
| 9 | |
| 10 | #include <netlink/attr.h> |
| 11 | #include <netlink/netlink.h> |
| 12 | |
| 13 | #include <string> |
| 14 | |
| 15 | #include "shill/nl80211_socket.h" |
| 16 | |
| 17 | |
| 18 | namespace shill { |
| 19 | |
| 20 | class MockNl80211Socket : public Nl80211Socket { |
| 21 | public: |
Christopher Wiley | 393b93f | 2012-11-08 17:30:58 -0800 | [diff] [blame] | 22 | MockNl80211Socket() : sequence_number_(1) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 23 | MOCK_METHOD0(Init, bool()); |
| 24 | MOCK_METHOD1(AddGroupMembership, bool(const std::string &group_name)); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 25 | using Nl80211Socket::GetMessages; |
| 26 | MOCK_METHOD0(GetMessages, bool()); |
| 27 | using Nl80211Socket::SetNetlinkCallback; |
| 28 | MOCK_METHOD2(SetNetlinkCallback, bool(nl_recvmsg_msg_cb_t on_netlink_data, |
| 29 | void *callback_parameter)); |
Wade Guthrie | 5d3d6de | 2012-11-02 11:08:34 -0700 | [diff] [blame] | 30 | MOCK_METHOD0(GetSequenceNumber, unsigned int()); |
| 31 | |
Christopher Wiley | 393b93f | 2012-11-08 17:30:58 -0800 | [diff] [blame] | 32 | virtual uint32 Send(KernelBoundNlMessage *message); |
| 33 | |
| 34 | uint32 GetLastSequenceNumber() const { return sequence_number_; } |
Wade Guthrie | 5d3d6de | 2012-11-02 11:08:34 -0700 | [diff] [blame] | 35 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 36 | private: |
Christopher Wiley | 393b93f | 2012-11-08 17:30:58 -0800 | [diff] [blame] | 37 | uint32 sequence_number_; |
Wade Guthrie | 5d3d6de | 2012-11-02 11:08:34 -0700 | [diff] [blame] | 38 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 39 | DISALLOW_COPY_AND_ASSIGN(MockNl80211Socket); |
| 40 | }; |
| 41 | |
| 42 | } // namespace shill |
| 43 | |
| 44 | #endif // SHILL_MOCK_NL80211_SOCKET_ |