1 // Copyright 2013 The Chromium 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.
5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_
10 #include "base/basictypes.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/shill_ipconfig_client.h"
16 // A fake implementation of ShillIPConfigClient.
17 class CHROMEOS_EXPORT FakeShillIPConfigClient
18 : public ShillIPConfigClient
,
19 public ShillIPConfigClient::TestInterface
{
21 FakeShillIPConfigClient();
22 ~FakeShillIPConfigClient() override
;
24 // ShillIPConfigClient overrides
25 void Init(dbus::Bus
* bus
) override
;
26 void AddPropertyChangedObserver(
27 const dbus::ObjectPath
& ipconfig_path
,
28 ShillPropertyChangedObserver
* observer
) override
;
29 void RemovePropertyChangedObserver(
30 const dbus::ObjectPath
& ipconfig_path
,
31 ShillPropertyChangedObserver
* observer
) override
;
32 void Refresh(const dbus::ObjectPath
& ipconfig_path
,
33 const VoidDBusMethodCallback
& callback
) override
;
34 void GetProperties(const dbus::ObjectPath
& ipconfig_path
,
35 const DictionaryValueCallback
& callback
) override
;
36 void SetProperty(const dbus::ObjectPath
& ipconfig_path
,
37 const std::string
& name
,
38 const base::Value
& value
,
39 const VoidDBusMethodCallback
& callback
) override
;
40 void ClearProperty(const dbus::ObjectPath
& ipconfig_path
,
41 const std::string
& name
,
42 const VoidDBusMethodCallback
& callback
) override
;
43 void Remove(const dbus::ObjectPath
& ipconfig_path
,
44 const VoidDBusMethodCallback
& callback
) override
;
45 ShillIPConfigClient::TestInterface
* GetTestInterface() override
;
47 // ShillIPConfigClient::TestInterface overrides.
48 void AddIPConfig(const std::string
& ip_config_path
,
49 const base::DictionaryValue
& properties
) override
;
52 // Runs callback with |values|.
53 void PassProperties(const base::DictionaryValue
* values
,
54 const DictionaryValueCallback
& callback
) const;
56 // Dictionary of <ipconfig_path, property dictionaries>
57 base::DictionaryValue ipconfigs_
;
59 // Note: This should remain the last member so it'll be destroyed and
60 // invalidate its weak pointers before any other members are destroyed.
61 base::WeakPtrFactory
<FakeShillIPConfigClient
> weak_ptr_factory_
;
63 DISALLOW_COPY_AND_ASSIGN(FakeShillIPConfigClient
);
66 } // namespace chromeos
68 #endif // CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_