summaryrefslogtreecommitdiff
path: root/mock_service.h
blob: a56ab43235f2f97a76aed84d9605c8a1c9925b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SHILL_MOCK_SERVICE_
#define SHILL_MOCK_SERVICE_

#include <string>

#include <base/memory/ref_counted.h>
#include <gmock/gmock.h>

#include "shill/connection.h"
#include "shill/refptr_types.h"
#include "shill/service.h"
#include "shill/technology.h"

namespace shill {

class MockService : public Service {
 public:
  // A constructor for the Service object
  MockService(ControlInterface *control_interface,
              EventDispatcher *dispatcher,
              Metrics *metrics,
              Manager *manager);
  virtual ~MockService();

  MOCK_METHOD0(AutoConnect, void());
  MOCK_METHOD1(Connect, void(Error *error));
  MOCK_METHOD1(Disconnect, void(Error *error));
  MOCK_METHOD1(CalculateState, std::string(Error *error));
  MOCK_CONST_METHOD1(TechnologyIs,
                     bool(const Technology::Identifier technology));
  MOCK_CONST_METHOD0(state, ConnectState());
  MOCK_METHOD1(SetState, void(ConnectState state));
  MOCK_CONST_METHOD0(IsConnected, bool());
  MOCK_CONST_METHOD0(IsConnecting, bool());
  MOCK_CONST_METHOD0(IsFailed, bool());
  MOCK_METHOD1(SetFailure, void(ConnectFailure failure));
  MOCK_CONST_METHOD0(failure, ConnectFailure());
  MOCK_METHOD1(GetDeviceRpcId, std::string(Error *error));
  MOCK_CONST_METHOD0(GetRpcIdentifier, std::string());
  MOCK_CONST_METHOD0(GetStorageIdentifier, std::string());
  MOCK_METHOD1(Load, bool(StoreInterface *store_interface));
  MOCK_METHOD0(Unload, void());
  MOCK_METHOD1(Save, bool(StoreInterface *store_interface));
  MOCK_METHOD1(SetConnection, void(ConnectionRefPtr connection));
  MOCK_CONST_METHOD0(technology, Technology::Identifier());
  // Set a string for this Service via |store|.  Can be wired to Save() for
  // test purposes.
  bool FauxSave(StoreInterface *store);

 private:
  DISALLOW_COPY_AND_ASSIGN(MockService);
};

}  // namespace shill

#endif  // SHILL_MOCK_SERVICE_