Darin Petkov | d78ee7e | 2012-01-12 11:21:10 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -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 | |
| 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" |
Darin Petkov | e5bc2cb | 2011-12-07 14:47:32 +0100 | [diff] [blame] | 13 | #include "shill/error.h" |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 14 | |
| 15 | namespace shill { |
| 16 | |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 17 | // These are the functions that a Device adaptor must support |
| 18 | class DeviceMockAdaptor : public DeviceAdaptorInterface { |
| 19 | public: |
| 20 | static const char kRpcId[]; |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 21 | static const char kRpcConnId[]; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 22 | |
| 23 | DeviceMockAdaptor(); |
| 24 | virtual ~DeviceMockAdaptor(); |
| 25 | virtual const std::string &GetRpcIdentifier(); |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 26 | virtual const std::string &GetRpcConnectionIdentifier(); |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 27 | |
Darin Petkov | 63138a9 | 2012-02-06 14:09:15 +0100 | [diff] [blame] | 28 | MOCK_METHOD0(UpdateEnabled, void()); |
| 29 | MOCK_METHOD2(EmitBoolChanged, void(const std::string &name, bool value)); |
| 30 | MOCK_METHOD2(EmitUintChanged, void(const std::string &name, uint32 value)); |
| 31 | MOCK_METHOD2(EmitIntChanged, void(const std::string &name, int value)); |
| 32 | MOCK_METHOD2(EmitStringChanged, void(const std::string &name, |
| 33 | const std::string &value)); |
| 34 | MOCK_METHOD2(EmitStringmapsChanged, void(const std::string &name, |
| 35 | const Stringmaps &value)); |
| 36 | MOCK_METHOD2(EmitKeyValueStoreChanged, void(const std::string &name, |
| 37 | const KeyValueStore &value)); |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 38 | |
| 39 | private: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 40 | const std::string rpc_id_; |
| 41 | const std::string rpc_conn_id_; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | // These are the functions that a IPConfig adaptor must support |
| 45 | class IPConfigMockAdaptor : public IPConfigAdaptorInterface { |
| 46 | public: |
| 47 | static const char kRpcId[]; |
| 48 | |
| 49 | IPConfigMockAdaptor(); |
| 50 | virtual ~IPConfigMockAdaptor(); |
| 51 | virtual const std::string &GetRpcIdentifier(); |
| 52 | |
| 53 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 54 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 55 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 56 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 57 | |
| 58 | private: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 59 | const std::string rpc_id_; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 62 | // These are the functions that a Manager adaptor must support |
| 63 | class ManagerMockAdaptor : public ManagerAdaptorInterface { |
| 64 | public: |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 65 | static const char kRpcId[]; |
| 66 | |
| 67 | ManagerMockAdaptor(); |
| 68 | virtual ~ManagerMockAdaptor(); |
| 69 | virtual const std::string &GetRpcIdentifier(); |
| 70 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 71 | MOCK_METHOD0(UpdateRunning, void(void)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 72 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 73 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 74 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 75 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 76 | MOCK_METHOD2(EmitStringsChanged, |
| 77 | void(const std::string &, const std::vector<std::string> &)); |
mukesh agrawal | 3239932 | 2011-09-01 10:53:43 -0700 | [diff] [blame] | 78 | MOCK_METHOD2(EmitRpcIdentifierArrayChanged, |
| 79 | void(const std::string &, const std::vector<std::string> &)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 80 | |
| 81 | MOCK_METHOD1(EmitStateChanged, void(const std::string&)); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 82 | |
| 83 | private: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 84 | const std::string rpc_id_; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 87 | // These are the functions that a Profile adaptor must support |
| 88 | class ProfileMockAdaptor : public ProfileAdaptorInterface { |
| 89 | public: |
| 90 | static const char kRpcId[]; |
| 91 | |
| 92 | ProfileMockAdaptor(); |
| 93 | virtual ~ProfileMockAdaptor(); |
| 94 | virtual const std::string &GetRpcIdentifier(); |
| 95 | |
| 96 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 97 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 98 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 99 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 100 | |
| 101 | private: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 102 | const std::string rpc_id_; |
| 103 | }; |
| 104 | |
| 105 | // These are the functions that a Task adaptor must support |
| 106 | class RPCTaskMockAdaptor : public RPCTaskAdaptorInterface { |
| 107 | public: |
| 108 | static const char kRpcId[]; |
| 109 | static const char kRpcInterfaceId[]; |
| 110 | static const char kRpcConnId[]; |
| 111 | |
| 112 | RPCTaskMockAdaptor(); |
| 113 | virtual ~RPCTaskMockAdaptor(); |
| 114 | |
| 115 | virtual const std::string &GetRpcIdentifier(); |
| 116 | virtual const std::string &GetRpcInterfaceIdentifier(); |
| 117 | virtual const std::string &GetRpcConnectionIdentifier(); |
| 118 | |
| 119 | private: |
| 120 | const std::string rpc_id_; |
| 121 | const std::string rpc_interface_id_; |
| 122 | const std::string rpc_conn_id_; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 123 | }; |
| 124 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 125 | // These are the functions that a Service adaptor must support |
| 126 | class ServiceMockAdaptor : public ServiceAdaptorInterface { |
| 127 | public: |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 128 | static const char kRpcId[]; |
| 129 | |
| 130 | ServiceMockAdaptor(); |
| 131 | virtual ~ServiceMockAdaptor(); |
| 132 | virtual const std::string &GetRpcIdentifier(); |
| 133 | |
Darin Petkov | 9cb0268 | 2012-01-28 00:17:38 +0100 | [diff] [blame] | 134 | MOCK_METHOD0(UpdateConnected, void()); |
| 135 | MOCK_METHOD2(EmitBoolChanged, void(const std::string &name, bool value)); |
| 136 | MOCK_METHOD2(EmitUint8Changed, void(const std::string &name, uint8 value)); |
mukesh agrawal | e1d90e9 | 2012-02-15 17:36:08 -0800 | [diff] [blame] | 137 | MOCK_METHOD2(EmitUint16Changed, void(const std::string &name, uint16 value)); |
Darin Petkov | 9cb0268 | 2012-01-28 00:17:38 +0100 | [diff] [blame] | 138 | MOCK_METHOD2(EmitUintChanged, void(const std::string &name, uint32 value)); |
| 139 | MOCK_METHOD2(EmitIntChanged, void(const std::string &name, int value)); |
| 140 | MOCK_METHOD2(EmitStringChanged, |
| 141 | void(const std::string &name, const std::string &value)); |
| 142 | MOCK_METHOD2(EmitStringmapChanged, |
| 143 | void(const std::string &name, const Stringmap &value)); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 144 | |
| 145 | private: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 146 | const std::string rpc_id_; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 147 | }; |
| 148 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 149 | } // namespace shill |
| 150 | #endif // SHILL_MOCK_ADAPTORS_ |