mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -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_SERVICE_ |
| 6 | #define SHILL_MOCK_SERVICE_ |
| 7 | |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 10 | #include <base/memory/ref_counted.h> |
| 11 | #include <gmock/gmock.h> |
| 12 | |
Paul Stewart | be5f5b3 | 2011-12-07 17:11:11 -0800 | [diff] [blame] | 13 | #include "shill/connection.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 14 | #include "shill/refptr_types.h" |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 15 | #include "shill/service.h" |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 16 | #include "shill/technology.h" |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 17 | |
| 18 | namespace shill { |
| 19 | |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 20 | class MockService : public Service { |
| 21 | public: |
| 22 | // A constructor for the Service object |
| 23 | MockService(ControlInterface *control_interface, |
| 24 | EventDispatcher *dispatcher, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 25 | Manager *manager); |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 26 | virtual ~MockService(); |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 27 | |
mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 28 | MOCK_METHOD0(AutoConnect, void()); |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 29 | MOCK_METHOD1(Connect, void(Error *error)); |
mukesh agrawal | 0ed0f2e | 2011-12-05 20:36:17 +0000 | [diff] [blame] | 30 | MOCK_METHOD1(Disconnect, void(Error *error)); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 31 | MOCK_METHOD1(CalculateState, std::string(Error *error)); |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 32 | MOCK_CONST_METHOD1(TechnologyIs, |
| 33 | bool(const Technology::Identifier technology)); |
Paul Stewart | 03dba0b | 2011-08-22 16:32:45 -0700 | [diff] [blame] | 34 | MOCK_CONST_METHOD0(state, ConnectState()); |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 35 | MOCK_METHOD1(SetState, void(ConnectState state)); |
| 36 | MOCK_CONST_METHOD0(IsConnected, bool()); |
| 37 | MOCK_CONST_METHOD0(IsConnecting, bool()); |
mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 38 | MOCK_CONST_METHOD0(IsFailed, bool()); |
Paul Stewart | 03dba0b | 2011-08-22 16:32:45 -0700 | [diff] [blame] | 39 | MOCK_METHOD1(SetFailure, void(ConnectFailure failure)); |
| 40 | MOCK_CONST_METHOD0(failure, ConnectFailure()); |
Gaurav Shah | 1b7a616 | 2011-11-09 11:41:01 -0800 | [diff] [blame] | 41 | MOCK_METHOD1(GetDeviceRpcId, std::string(Error *error)); |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 42 | MOCK_CONST_METHOD0(GetRpcIdentifier, std::string()); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 43 | MOCK_CONST_METHOD0(GetStorageIdentifier, std::string()); |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 44 | MOCK_METHOD1(Load, bool(StoreInterface *store_interface)); |
| 45 | MOCK_METHOD1(Save, bool(StoreInterface *store_interface)); |
Paul Stewart | c1dec4d | 2011-12-08 15:25:28 -0800 | [diff] [blame] | 46 | MOCK_METHOD1(SetConnection, void(ConnectionRefPtr connection)); |
Gaurav Shah | 435de2c | 2011-11-17 19:01:07 -0800 | [diff] [blame] | 47 | MOCK_CONST_METHOD0(technology, Technology::Identifier()); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 48 | // Set a string for this Service via |store|. Can be wired to Save() for |
| 49 | // test purposes. |
| 50 | bool FauxSave(StoreInterface *store); |
| 51 | |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 52 | private: |
| 53 | DISALLOW_COPY_AND_ASSIGN(MockService); |
| 54 | }; |
| 55 | |
| 56 | } // namespace shill |
| 57 | |
| 58 | #endif // SHILL_MOCK_SERVICE_ |