blob: cbaf55d8206b0a05bd289243828496e39aa4d257 [file] [log] [blame]
Chris Masoned7732e42011-05-20 11:08:56 -07001// 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 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
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 Petkov3cfbf212011-11-21 16:02:09 +010033 MOCK_METHOD2(EmitStringmapsChanged, void(const std::string &,
34 const Stringmaps &));
Chris Masonec6c6c132011-06-30 11:29:52 -070035
36 private:
37 const std::string rpc_id;
Chris Masone4e851612011-07-01 10:46:53 -070038 const std::string rpc_conn_id;
Chris Masonec6c6c132011-06-30 11:29:52 -070039};
40
41// These are the functions that a IPConfig adaptor must support
42class 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 Masoned7732e42011-05-20 11:08:56 -070059// These are the functions that a Manager adaptor must support
60class ManagerMockAdaptor : public ManagerAdaptorInterface {
61 public:
Chris Masone95207da2011-06-29 16:50:49 -070062 static const char kRpcId[];
63
64 ManagerMockAdaptor();
65 virtual ~ManagerMockAdaptor();
66 virtual const std::string &GetRpcIdentifier();
67
Chris Masoned7732e42011-05-20 11:08:56 -070068 MOCK_METHOD0(UpdateRunning, void(void));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070069 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 Shah435de2c2011-11-17 19:01:07 -080073 MOCK_METHOD2(EmitStringsChanged,
74 void(const std::string &, const std::vector<std::string> &));
mukesh agrawal32399322011-09-01 10:53:43 -070075 MOCK_METHOD2(EmitRpcIdentifierArrayChanged,
76 void(const std::string &, const std::vector<std::string> &));
Chris Masoned0ceb8c2011-06-02 10:05:39 -070077
78 MOCK_METHOD1(EmitStateChanged, void(const std::string&));
Chris Masone95207da2011-06-29 16:50:49 -070079
80 private:
81 const std::string rpc_id;
Chris Masoned7732e42011-05-20 11:08:56 -070082};
83
Chris Masonec6c6c132011-06-30 11:29:52 -070084// These are the functions that a Profile adaptor must support
85class 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 Masoned7732e42011-05-20 11:08:56 -0700102// These are the functions that a Service adaptor must support
103class ServiceMockAdaptor : public ServiceAdaptorInterface {
104 public:
Chris Masone95207da2011-06-29 16:50:49 -0700105 static const char kRpcId[];
106
107 ServiceMockAdaptor();
108 virtual ~ServiceMockAdaptor();
109 virtual const std::string &GetRpcIdentifier();
110
Chris Masoned7732e42011-05-20 11:08:56 -0700111 MOCK_METHOD0(UpdateConnected, void(void));
Chris Masoned0ceb8c2011-06-02 10:05:39 -0700112 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 Masone95207da2011-06-29 16:50:49 -0700116
117 private:
118 const std::string rpc_id;
Chris Masoned7732e42011-05-20 11:08:56 -0700119};
120
Darin Petkove5bc2cb2011-12-07 14:47:32 +0100121class 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 Masoned7732e42011-05-20 11:08:56 -0700130} // namespace shill
131#endif // SHILL_MOCK_ADAPTORS_