blob: e5d3df4a169f6e5be74064efec09a5fa15624200 [file] [log] [blame]
mukesh agrawal8a3188d2011-12-01 20:56:44 +00001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masone9be4a9d2011-05-16 15:44:09 -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_SERVICE_
6#define SHILL_MOCK_SERVICE_
7
Hristo Stefanoved2c28c2011-11-29 15:37:30 -08008#include <string>
9
Chris Masone9be4a9d2011-05-16 15:44:09 -070010#include <base/memory/ref_counted.h>
11#include <gmock/gmock.h>
12
Paul Stewartbe5f5b32011-12-07 17:11:11 -080013#include "shill/connection.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070014#include "shill/refptr_types.h"
Chris Masone9be4a9d2011-05-16 15:44:09 -070015#include "shill/service.h"
Gaurav Shah435de2c2011-11-17 19:01:07 -080016#include "shill/technology.h"
Chris Masone9be4a9d2011-05-16 15:44:09 -070017
18namespace shill {
19
Chris Masone9be4a9d2011-05-16 15:44:09 -070020class MockService : public Service {
21 public:
22 // A constructor for the Service object
23 MockService(ControlInterface *control_interface,
24 EventDispatcher *dispatcher,
mukesh agrawal51a7e932011-07-27 16:18:26 -070025 Manager *manager);
Chris Masonea82b7112011-05-25 15:16:29 -070026 virtual ~MockService();
Chris Masone9be4a9d2011-05-16 15:44:09 -070027
mukesh agrawal8a3188d2011-12-01 20:56:44 +000028 MOCK_METHOD0(AutoConnect, void());
Darin Petkov4d6d9412011-08-24 13:19:54 -070029 MOCK_METHOD1(Connect, void(Error *error));
mukesh agrawal0ed0f2e2011-12-05 20:36:17 +000030 MOCK_METHOD1(Disconnect, void(Error *error));
Gaurav Shah1b7a6162011-11-09 11:41:01 -080031 MOCK_METHOD1(CalculateState, std::string(Error *error));
Paul Stewart22aa71b2011-09-16 12:15:11 -070032 MOCK_CONST_METHOD1(TechnologyIs,
33 bool(const Technology::Identifier technology));
Paul Stewart03dba0b2011-08-22 16:32:45 -070034 MOCK_CONST_METHOD0(state, ConnectState());
Gaurav Shah435de2c2011-11-17 19:01:07 -080035 MOCK_METHOD1(SetState, void(ConnectState state));
36 MOCK_CONST_METHOD0(IsConnected, bool());
37 MOCK_CONST_METHOD0(IsConnecting, bool());
mukesh agrawal8a3188d2011-12-01 20:56:44 +000038 MOCK_CONST_METHOD0(IsFailed, bool());
Paul Stewart03dba0b2011-08-22 16:32:45 -070039 MOCK_METHOD1(SetFailure, void(ConnectFailure failure));
40 MOCK_CONST_METHOD0(failure, ConnectFailure());
Gaurav Shah1b7a6162011-11-09 11:41:01 -080041 MOCK_METHOD1(GetDeviceRpcId, std::string(Error *error));
Chris Masone6791a432011-07-12 13:23:19 -070042 MOCK_CONST_METHOD0(GetRpcIdentifier, std::string());
Chris Masone6515aab2011-10-12 16:19:09 -070043 MOCK_CONST_METHOD0(GetStorageIdentifier, std::string());
Paul Stewart22aa71b2011-09-16 12:15:11 -070044 MOCK_METHOD1(Load, bool(StoreInterface *store_interface));
45 MOCK_METHOD1(Save, bool(StoreInterface *store_interface));
Paul Stewartc1dec4d2011-12-08 15:25:28 -080046 MOCK_METHOD1(SetConnection, void(ConnectionRefPtr connection));
Gaurav Shah435de2c2011-11-17 19:01:07 -080047 MOCK_CONST_METHOD0(technology, Technology::Identifier());
Chris Masone6515aab2011-10-12 16:19:09 -070048 // Set a string for this Service via |store|. Can be wired to Save() for
49 // test purposes.
50 bool FauxSave(StoreInterface *store);
51
Chris Masone9be4a9d2011-05-16 15:44:09 -070052 private:
53 DISALLOW_COPY_AND_ASSIGN(MockService);
54};
55
56} // namespace shill
57
58#endif // SHILL_MOCK_SERVICE_