blob: 6ea3461319d805b305ce905ab67defe518cd4e79 [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_METHOD2(EmitBoolChanged, void(const std::string &name, bool value));
29 MOCK_METHOD2(EmitUintChanged, void(const std::string &name, uint32 value));
30 MOCK_METHOD2(EmitIntChanged, void(const std::string &name, int value));
31 MOCK_METHOD2(EmitStringChanged, void(const std::string &name,
32 const std::string &value));
33 MOCK_METHOD2(EmitStringmapsChanged, void(const std::string &name,
34 const Stringmaps &value));
35 MOCK_METHOD2(EmitKeyValueStoreChanged, void(const std::string &name,
36 const KeyValueStore &value));
Chris Masonec6c6c132011-06-30 11:29:52 -070037
38 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +010039 const std::string rpc_id_;
40 const std::string rpc_conn_id_;
Chris Masonec6c6c132011-06-30 11:29:52 -070041};
42
43// These are the functions that a IPConfig adaptor must support
44class IPConfigMockAdaptor : public IPConfigAdaptorInterface {
45 public:
46 static const char kRpcId[];
47
48 IPConfigMockAdaptor();
49 virtual ~IPConfigMockAdaptor();
50 virtual const std::string &GetRpcIdentifier();
51
52 MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool));
53 MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32));
54 MOCK_METHOD2(EmitIntChanged, void(const std::string&, int));
55 MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&));
mukesh agrawal7aed61c2013-04-22 16:01:24 -070056 MOCK_METHOD2(EmitStringsChanged,
57 void(const std::string&, const std::vector<std::string>&));
Chris Masonec6c6c132011-06-30 11:29:52 -070058
59 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +010060 const std::string rpc_id_;
Chris Masonec6c6c132011-06-30 11:29:52 -070061};
62
Chris Masoned7732e42011-05-20 11:08:56 -070063// These are the functions that a Manager adaptor must support
64class ManagerMockAdaptor : public ManagerAdaptorInterface {
65 public:
Chris Masone95207da2011-06-29 16:50:49 -070066 static const char kRpcId[];
67
68 ManagerMockAdaptor();
69 virtual ~ManagerMockAdaptor();
70 virtual const std::string &GetRpcIdentifier();
71
Chris Masoned7732e42011-05-20 11:08:56 -070072 MOCK_METHOD0(UpdateRunning, void(void));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070073 MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool));
74 MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32));
75 MOCK_METHOD2(EmitIntChanged, void(const std::string&, int));
76 MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&));
Gaurav Shah435de2c2011-11-17 19:01:07 -080077 MOCK_METHOD2(EmitStringsChanged,
78 void(const std::string &, const std::vector<std::string> &));
Paul Stewart49739c02012-08-08 17:24:03 -070079 MOCK_METHOD2(EmitRpcIdentifierChanged,
80 void(const std::string &, const std::string &));
mukesh agrawal32399322011-09-01 10:53:43 -070081 MOCK_METHOD2(EmitRpcIdentifierArrayChanged,
82 void(const std::string &, const std::vector<std::string> &));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070083
84 MOCK_METHOD1(EmitStateChanged, void(const std::string&));
Chris Masone95207da2011-06-29 16:50:49 -070085
86 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +010087 const std::string rpc_id_;
Chris Masoned7732e42011-05-20 11:08:56 -070088};
89
Chris Masonec6c6c132011-06-30 11:29:52 -070090// These are the functions that a Profile adaptor must support
91class ProfileMockAdaptor : public ProfileAdaptorInterface {
92 public:
93 static const char kRpcId[];
94
95 ProfileMockAdaptor();
96 virtual ~ProfileMockAdaptor();
97 virtual const std::string &GetRpcIdentifier();
98
99 MOCK_METHOD2(EmitBoolChanged, void(const std::string&, bool));
100 MOCK_METHOD2(EmitUintChanged, void(const std::string&, uint32));
101 MOCK_METHOD2(EmitIntChanged, void(const std::string&, int));
102 MOCK_METHOD2(EmitStringChanged, void(const std::string&, const std::string&));
103
104 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +0100105 const std::string rpc_id_;
106};
107
108// These are the functions that a Task adaptor must support
109class RPCTaskMockAdaptor : public RPCTaskAdaptorInterface {
110 public:
111 static const char kRpcId[];
112 static const char kRpcInterfaceId[];
113 static const char kRpcConnId[];
114
115 RPCTaskMockAdaptor();
116 virtual ~RPCTaskMockAdaptor();
117
118 virtual const std::string &GetRpcIdentifier();
119 virtual const std::string &GetRpcInterfaceIdentifier();
120 virtual const std::string &GetRpcConnectionIdentifier();
121
122 private:
123 const std::string rpc_id_;
124 const std::string rpc_interface_id_;
125 const std::string rpc_conn_id_;
Chris Masonec6c6c132011-06-30 11:29:52 -0700126};
127
Chris Masoned7732e42011-05-20 11:08:56 -0700128// These are the functions that a Service adaptor must support
129class ServiceMockAdaptor : public ServiceAdaptorInterface {
130 public:
Chris Masone95207da2011-06-29 16:50:49 -0700131 static const char kRpcId[];
132
133 ServiceMockAdaptor();
134 virtual ~ServiceMockAdaptor();
135 virtual const std::string &GetRpcIdentifier();
136
Darin Petkov9cb02682012-01-28 00:17:38 +0100137 MOCK_METHOD0(UpdateConnected, void());
138 MOCK_METHOD2(EmitBoolChanged, void(const std::string &name, bool value));
139 MOCK_METHOD2(EmitUint8Changed, void(const std::string &name, uint8 value));
mukesh agrawale1d90e92012-02-15 17:36:08 -0800140 MOCK_METHOD2(EmitUint16Changed, void(const std::string &name, uint16 value));
mukesh agrawale7c7e652013-06-18 17:19:39 -0700141 MOCK_METHOD2(EmitUint16sChanged, void(const std::string &name,
142 const Uint16s &value));
Darin Petkov9cb02682012-01-28 00:17:38 +0100143 MOCK_METHOD2(EmitUintChanged, void(const std::string &name, uint32 value));
144 MOCK_METHOD2(EmitIntChanged, void(const std::string &name, int value));
Paul Stewart1e3bc4962012-09-14 12:20:22 -0700145 MOCK_METHOD2(EmitRpcIdentifierChanged,
146 void(const std::string &name, const std::string &value));
Darin Petkov9cb02682012-01-28 00:17:38 +0100147 MOCK_METHOD2(EmitStringChanged,
148 void(const std::string &name, const std::string &value));
149 MOCK_METHOD2(EmitStringmapChanged,
150 void(const std::string &name, const Stringmap &value));
Chris Masone95207da2011-06-29 16:50:49 -0700151
152 private:
Darin Petkova9b1fed2012-02-29 11:49:05 +0100153 const std::string rpc_id_;
Chris Masoned7732e42011-05-20 11:08:56 -0700154};
155
Chris Masoned7732e42011-05-20 11:08:56 -0700156} // namespace shill
157#endif // SHILL_MOCK_ADAPTORS_