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" |
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 | |
| 28 | MOCK_METHOD0(UpdateEnabled, void(void)); |
| 29 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 30 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 31 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 32 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
Darin Petkov | 3cfbf21 | 2011-11-21 16:02:09 +0100 | [diff] [blame] | 33 | MOCK_METHOD2(EmitStringmapsChanged, void(const std::string &, |
| 34 | const Stringmaps &)); |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 35 | |
| 36 | private: |
| 37 | const std::string rpc_id; |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 38 | const std::string rpc_conn_id; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | // These are the functions that a IPConfig adaptor must support |
| 42 | class IPConfigMockAdaptor : public IPConfigAdaptorInterface { |
| 43 | public: |
| 44 | static const char kRpcId[]; |
| 45 | |
| 46 | IPConfigMockAdaptor(); |
| 47 | virtual ~IPConfigMockAdaptor(); |
| 48 | virtual const std::string &GetRpcIdentifier(); |
| 49 | |
| 50 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 51 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 52 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 53 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 54 | |
| 55 | private: |
| 56 | const std::string rpc_id; |
| 57 | }; |
| 58 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 59 | // These are the functions that a Manager adaptor must support |
| 60 | class ManagerMockAdaptor : public ManagerAdaptorInterface { |
| 61 | public: |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 62 | static const char kRpcId[]; |
| 63 | |
| 64 | ManagerMockAdaptor(); |
| 65 | virtual ~ManagerMockAdaptor(); |
| 66 | virtual const std::string &GetRpcIdentifier(); |
| 67 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 68 | MOCK_METHOD0(UpdateRunning, void(void)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 69 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 70 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 71 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 72 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 73 | MOCK_METHOD2(EmitStringsChanged, |
| 74 | void(const std::string &, const std::vector<std::string> &)); |
mukesh agrawal | 3239932 | 2011-09-01 10:53:43 -0700 | [diff] [blame] | 75 | MOCK_METHOD2(EmitRpcIdentifierArrayChanged, |
| 76 | void(const std::string &, const std::vector<std::string> &)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 77 | |
| 78 | MOCK_METHOD1(EmitStateChanged, void(const std::string&)); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 79 | |
| 80 | private: |
| 81 | const std::string rpc_id; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 84 | // These are the functions that a Profile adaptor must support |
| 85 | class ProfileMockAdaptor : public ProfileAdaptorInterface { |
| 86 | public: |
| 87 | static const char kRpcId[]; |
| 88 | |
| 89 | ProfileMockAdaptor(); |
| 90 | virtual ~ProfileMockAdaptor(); |
| 91 | virtual const std::string &GetRpcIdentifier(); |
| 92 | |
| 93 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 94 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 95 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 96 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
| 97 | |
| 98 | private: |
| 99 | const std::string rpc_id; |
| 100 | }; |
| 101 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 102 | // These are the functions that a Service adaptor must support |
| 103 | class ServiceMockAdaptor : public ServiceAdaptorInterface { |
| 104 | public: |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 105 | static const char kRpcId[]; |
| 106 | |
| 107 | ServiceMockAdaptor(); |
| 108 | virtual ~ServiceMockAdaptor(); |
| 109 | virtual const std::string &GetRpcIdentifier(); |
| 110 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 111 | MOCK_METHOD0(UpdateConnected, void(void)); |
Chris Masone | d0ceb8c | 2011-06-02 10:05:39 -0700 | [diff] [blame] | 112 | MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool)); |
| 113 | MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32)); |
| 114 | MOCK_METHOD2(EmitIntChanged, void(const std::string&, int)); |
| 115 | MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&)); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 116 | |
| 117 | private: |
| 118 | const std::string rpc_id; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 119 | }; |
| 120 | |
Darin Petkov | e5bc2cb | 2011-12-07 14:47:32 +0100 | [diff] [blame] | 121 | class MockReturner : public ReturnerInterface { |
| 122 | public: |
| 123 | MockReturner(); |
| 124 | virtual ~MockReturner(); |
| 125 | |
| 126 | MOCK_METHOD0(Return, void()); |
| 127 | MOCK_METHOD1(ReturnError, void(const Error &error)); |
| 128 | }; |
| 129 | |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 130 | } // namespace shill |
| 131 | #endif // SHILL_MOCK_ADAPTORS_ |