Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 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_ADAPTORS_ |
| 6 | #define SHILL_MOCK_ADAPTORS_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <gmock/gmock.h> |
| 11 | |
| 12 | #include "shill/adaptor_interfaces.h" |
| 13 | |
| 14 | namespace shill { |
| 15 | |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 16 | // These are the functions that a Device adaptor must support |
| 17 | class DeviceMockAdaptor : public DeviceAdaptorInterface { |
| 18 | public: |
| 19 | static const char kRpcId[]; |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 20 | static const char kRpcConnId[]; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 21 | |
| 22 | DeviceMockAdaptor(); |
| 23 | virtual ~DeviceMockAdaptor(); |
| 24 | virtual const std::string &GetRpcIdentifier(); |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 25 | virtual const std::string &GetRpcConnectionIdentifier(); |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 26 | |
| 27 | MOCK_METHOD0(UpdateEnabled, void(void)); |
| 28 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 29 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 30 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 31 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 32 | |
| 33 | private: |
| 34 | const std::string rpc_id; |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 35 | const std::string rpc_conn_id; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | // These are the functions that a IPConfig adaptor must support |
| 39 | class IPConfigMockAdaptor : public IPConfigAdaptorInterface { |
| 40 | public: |
| 41 | static const char kRpcId[]; |
| 42 | |
| 43 | IPConfigMockAdaptor(); |
| 44 | virtual ~IPConfigMockAdaptor(); |
| 45 | virtual const std::string &GetRpcIdentifier(); |
| 46 | |
| 47 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 48 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 49 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 50 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 51 | |
| 52 | private: |
| 53 | const std::string rpc_id; |
| 54 | }; |
| 55 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 56 | // These are the functions that a Manager adaptor must support |
| 57 | class ManagerMockAdaptor : public ManagerAdaptorInterface { |
| 58 | public: |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 59 | static const char kRpcId[]; |
| 60 | |
| 61 | ManagerMockAdaptor(); |
| 62 | virtual ~ManagerMockAdaptor(); |
| 63 | virtual const std::string &GetRpcIdentifier(); |
| 64 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 65 | MOCK_METHOD0(UpdateRunning, void(void)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 66 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 67 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 68 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 69 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 70 | |
| 71 | MOCK_METHOD1(EmitStateChanged, void(const std::string&)); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 72 | |
| 73 | private: |
| 74 | const std::string rpc_id; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 75 | }; |
| 76 | |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 77 | // These are the functions that a Profile adaptor must support |
| 78 | class ProfileMockAdaptor : public ProfileAdaptorInterface { |
| 79 | public: |
| 80 | static const char kRpcId[]; |
| 81 | |
| 82 | ProfileMockAdaptor(); |
| 83 | virtual ~ProfileMockAdaptor(); |
| 84 | virtual const std::string &GetRpcIdentifier(); |
| 85 | |
| 86 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 87 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 88 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 89 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 90 | |
| 91 | private: |
| 92 | const std::string rpc_id; |
| 93 | }; |
| 94 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 95 | // These are the functions that a Service adaptor must support |
| 96 | class ServiceMockAdaptor : public ServiceAdaptorInterface { |
| 97 | public: |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 98 | static const char kRpcId[]; |
| 99 | |
| 100 | ServiceMockAdaptor(); |
| 101 | virtual ~ServiceMockAdaptor(); |
| 102 | virtual const std::string &GetRpcIdentifier(); |
| 103 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 104 | MOCK_METHOD0(UpdateConnected, void(void)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 105 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 106 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 107 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 108 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 109 | |
| 110 | private: |
| 111 | const std::string rpc_id; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 112 | }; |
| 113 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 114 | } // namespace shill |
| 115 | #endif // SHILL_MOCK_ADAPTORS_ |