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