blob: a60e996364189a3ccf9c9fd6bbfb2213d1539fb1 [file] [log] [blame]
Alex Deymo30534502015-07-20 15:06:33 -07001// Copyright 2015 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 UPDATE_ENGINE_FAKE_SHILL_PROXY_H_
6#define UPDATE_ENGINE_FAKE_SHILL_PROXY_H_
7
8#include <map>
9#include <memory>
10#include <string>
11
12#include <base/macros.h>
13
14#include "update_engine/dbus_mocks.h"
15#include "update_engine/dbus_proxies.h"
16#include "update_engine/shill_proxy_interface.h"
17
18namespace chromeos_update_engine {
19
20// This class implements the connection to shill using real DBus calls.
21class FakeShillProxy : public ShillProxyInterface {
22 public:
23 FakeShillProxy();
24 ~FakeShillProxy() override = default;
25
26 // ShillProxyInterface overrides.
27
28 // GetManagerProxy returns the subclass ManagerProxyMock so tests can easily
29 // use it. Mocks for the return value of GetServiceForPath() can be provided
30 // with SetServiceForPath().
31 org::chromium::flimflam::ManagerProxyMock* GetManagerProxy() override;
32 std::unique_ptr<org::chromium::flimflam::ServiceProxyInterface>
33 GetServiceForPath(const std::string& path) override;
34
35 // Sets the service_proxy that will be returned by GetServiceForPath().
36 void SetServiceForPath(
37 const std::string& path,
38 std::unique_ptr<org::chromium::flimflam::ServiceProxyInterface>
39 service_proxy);
40
41 private:
42 std::unique_ptr<org::chromium::flimflam::ManagerProxyMock>
43 manager_proxy_mock_;
44
45 std::map<std::string,
46 std::unique_ptr<org::chromium::flimflam::ServiceProxyInterface>>
47 service_proxy_mocks_;
48
49 DISALLOW_COPY_AND_ASSIGN(FakeShillProxy);
50};
51
52} // namespace chromeos_update_engine
53
54#endif // UPDATE_ENGINE_FAKE_SHILL_PROXY_H_