blob: a454b65364d6a2786c8ce22c312c1098d326bd6b [file] [log] [blame]
Darin Petkovd78ee7e2012-01-12 11:21:10 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masoned7732e42011-05-20 11:08:56 -07002// 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 Petkove5bc2cb2011-12-07 14:47:32 +010013#include "shill/error.h"
Chris Masoned7732e42011-05-20 11:08:56 -070014
15namespace shill {
16
Chris Masonec6c6c132011-06-30 11:29:52 -070017// These are the functions that a Device adaptor must support
18class DeviceMockAdaptor : public DeviceAdaptorInterface {
19 public:
20 static const char kRpcId[];
Chris Masone4e851612011-07-01 10:46:53 -070021 static const char kRpcConnId[];
Chris Masonec6c6c132011-06-30 11:29:52 -070022
23 DeviceMockAdaptor();
24 virtual ~DeviceMockAdaptor();
25 virtual const std::string &GetRpcIdentifier();
Chris Masone4e851612011-07-01 10:46:53 -070026 virtual const std::string &GetRpcConnectionIdentifier();
Chris Masonec6c6c132011-06-30 11:29:52 -070027
Darin Petkov63138a92012-02-06 14:09:15 +010028 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 Masonec6c6c132011-06-30 11:29:52 -070038
39 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +010040 const std::string rpc_id_;
41 const std::string rpc_conn_id_;
Chris Masonec6c6c132011-06-30 11:29:52 -070042};
43
44// These are the functions that a IPConfig adaptor must support
45class 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 Petkova9b1fed2012-02-29 11:49:05 +010059 const std::string rpc_id_;
Chris Masonec6c6c132011-06-30 11:29:52 -070060};
61
Chris Masoned7732e42011-05-20 11:08:56 -070062// These are the functions that a Manager adaptor must support
63class ManagerMockAdaptor : public ManagerAdaptorInterface {
64 public:
Chris Masone95207da2011-06-29 16:50:49 -070065 static const char kRpcId[];
66
67 ManagerMockAdaptor();
68 virtual ~ManagerMockAdaptor();
69 virtual const std::string &GetRpcIdentifier();
70
Chris Masoned7732e42011-05-20 11:08:56 -070071 MOCK_METHOD0(UpdateRunning, void(void));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070072 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 Shah435de2c2011-11-17 19:01:07 -080076 MOCK_METHOD2(EmitStringsChanged,
77 void(const std::string &, const std::vector<std::string> &));
Paul Stewart49739c02012-08-08 17:24:03 -070078 MOCK_METHOD2(EmitRpcIdentifierChanged,
79 void(const std::string &, const std::string &));
mukesh agrawal32399322011-09-01 10:53:43 -070080 MOCK_METHOD2(EmitRpcIdentifierArrayChanged,
81 void(const std::string &, const std::vector<std::string> &));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070082
83 MOCK_METHOD1(EmitStateChanged, void(const std::string&));
Chris Masone95207da2011-06-29 16:50:49 -070084
85 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +010086 const std::string rpc_id_;
Chris Masoned7732e42011-05-20 11:08:56 -070087};
88
Chris Masonec6c6c132011-06-30 11:29:52 -070089// These are the functions that a Profile adaptor must support
90class ProfileMockAdaptor : public ProfileAdaptorInterface {
91 public:
92 static const char kRpcId[];
93
94 ProfileMockAdaptor();
95 virtual ~ProfileMockAdaptor();
96 virtual const std::string &GetRpcIdentifier();
97
98 MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool));
99 MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32));
100 MOCK_METHOD2(EmitIntChanged, void(const std::string&, int));
101 MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&));
102
103 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +0100104 const std::string rpc_id_;
105};
106
107// These are the functions that a Task adaptor must support
108class RPCTaskMockAdaptor : public RPCTaskAdaptorInterface {
109 public:
110 static const char kRpcId[];
111 static const char kRpcInterfaceId[];
112 static const char kRpcConnId[];
113
114 RPCTaskMockAdaptor();
115 virtual ~RPCTaskMockAdaptor();
116
117 virtual const std::string &GetRpcIdentifier();
118 virtual const std::string &GetRpcInterfaceIdentifier();
119 virtual const std::string &GetRpcConnectionIdentifier();
120
121 private:
122 const std::string rpc_id_;
123 const std::string rpc_interface_id_;
124 const std::string rpc_conn_id_;
Chris Masonec6c6c132011-06-30 11:29:52 -0700125};
126
Chris Masoned7732e42011-05-20 11:08:56 -0700127// These are the functions that a Service adaptor must support
128class ServiceMockAdaptor : public ServiceAdaptorInterface {
129 public:
Chris Masone95207da2011-06-29 16:50:49 -0700130 static const char kRpcId[];
131
132 ServiceMockAdaptor();
133 virtual ~ServiceMockAdaptor();
134 virtual const std::string &GetRpcIdentifier();
135
Darin Petkov9cb02682012-01-28 00:17:38 +0100136 MOCK_METHOD0(UpdateConnected, void());
137 MOCK_METHOD2(EmitBoolChanged, void(const std::string &name, bool value));
138 MOCK_METHOD2(EmitUint8Changed, void(const std::string &name, uint8 value));
mukesh agrawale1d90e92012-02-15 17:36:08 -0800139 MOCK_METHOD2(EmitUint16Changed, void(const std::string &name, uint16 value));
Darin Petkov9cb02682012-01-28 00:17:38 +0100140 MOCK_METHOD2(EmitUintChanged, void(const std::string &name, uint32 value));
141 MOCK_METHOD2(EmitIntChanged, void(const std::string &name, int value));
Paul Stewart1e3bc4962012-09-14 12:20:22 -0700142 MOCK_METHOD2(EmitRpcIdentifierChanged,
143 void(const std::string &name, const std::string &value));
Darin Petkov9cb02682012-01-28 00:17:38 +0100144 MOCK_METHOD2(EmitStringChanged,
145 void(const std::string &name, const std::string &value));
146 MOCK_METHOD2(EmitStringmapChanged,
147 void(const std::string &name, const Stringmap &value));
Chris Masone95207da2011-06-29 16:50:49 -0700148
149 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +0100150 const std::string rpc_id_;
Chris Masoned7732e42011-05-20 11:08:56 -0700151};
152
Chris Masoned7732e42011-05-20 11:08:56 -0700153} // namespace shill
154#endif // SHILL_MOCK_ADAPTORS_