blob: e38784f2f65de9aac8c65bceda9cc17798e06203 [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#include "update_engine/fake_shill_proxy.h"
6
7#include "update_engine/dbus_proxies.h"
8
9using org::chromium::flimflam::ManagerProxyMock;
10using org::chromium::flimflam::ServiceProxyInterface;
11
12namespace chromeos_update_engine {
13
14FakeShillProxy::FakeShillProxy()
15 : manager_proxy_mock_(new ManagerProxyMock()) {}
16
17ManagerProxyMock* FakeShillProxy::GetManagerProxy() {
18 return manager_proxy_mock_.get();
19}
20
21std::unique_ptr<ServiceProxyInterface> FakeShillProxy::GetServiceForPath(
22 const std::string& path) {
23 auto it = service_proxy_mocks_.find(path);
24 CHECK(it != service_proxy_mocks_.end()) << "No ServiceProxyMock set for "
25 << path;
26 std::unique_ptr<ServiceProxyInterface> result = std::move(it->second);
27 service_proxy_mocks_.erase(it);
28 return result;
29}
30
31void FakeShillProxy::SetServiceForPath(
32 const std::string& path,
33 std::unique_ptr<ServiceProxyInterface> service_proxy) {
34 service_proxy_mocks_[path] = std::move(service_proxy);
35}
36
37} // namespace chromeos_update_engine