OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
12 #include "chromeos/dbus/shill_ipconfig_client.h" | 12 #include "chromeos/dbus/shill_ipconfig_client.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 // A fake implementation of ShillIPConfigClient. | 16 // A fake implementation of ShillIPConfigClient. |
17 class CHROMEOS_EXPORT FakeShillIPConfigClient | 17 class CHROMEOS_EXPORT FakeShillIPConfigClient |
18 : public ShillIPConfigClient, | 18 : public ShillIPConfigClient, |
19 public ShillIPConfigClient::TestInterface { | 19 public ShillIPConfigClient::TestInterface { |
20 public: | 20 public: |
21 FakeShillIPConfigClient(); | 21 FakeShillIPConfigClient(); |
22 virtual ~FakeShillIPConfigClient(); | 22 virtual ~FakeShillIPConfigClient(); |
23 | 23 |
24 // ShillIPConfigClient overrides | 24 // ShillIPConfigClient overrides |
25 virtual void Init(dbus::Bus* bus) OVERRIDE; | 25 virtual void Init(dbus::Bus* bus) override; |
26 virtual void AddPropertyChangedObserver( | 26 virtual void AddPropertyChangedObserver( |
27 const dbus::ObjectPath& ipconfig_path, | 27 const dbus::ObjectPath& ipconfig_path, |
28 ShillPropertyChangedObserver* observer) OVERRIDE; | 28 ShillPropertyChangedObserver* observer) override; |
29 virtual void RemovePropertyChangedObserver( | 29 virtual void RemovePropertyChangedObserver( |
30 const dbus::ObjectPath& ipconfig_path, | 30 const dbus::ObjectPath& ipconfig_path, |
31 ShillPropertyChangedObserver* observer) OVERRIDE; | 31 ShillPropertyChangedObserver* observer) override; |
32 virtual void Refresh(const dbus::ObjectPath& ipconfig_path, | 32 virtual void Refresh(const dbus::ObjectPath& ipconfig_path, |
33 const VoidDBusMethodCallback& callback) OVERRIDE; | 33 const VoidDBusMethodCallback& callback) override; |
34 virtual void GetProperties(const dbus::ObjectPath& ipconfig_path, | 34 virtual void GetProperties(const dbus::ObjectPath& ipconfig_path, |
35 const DictionaryValueCallback& callback) OVERRIDE; | 35 const DictionaryValueCallback& callback) override; |
36 virtual void SetProperty(const dbus::ObjectPath& ipconfig_path, | 36 virtual void SetProperty(const dbus::ObjectPath& ipconfig_path, |
37 const std::string& name, | 37 const std::string& name, |
38 const base::Value& value, | 38 const base::Value& value, |
39 const VoidDBusMethodCallback& callback) OVERRIDE; | 39 const VoidDBusMethodCallback& callback) override; |
40 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path, | 40 virtual void ClearProperty(const dbus::ObjectPath& ipconfig_path, |
41 const std::string& name, | 41 const std::string& name, |
42 const VoidDBusMethodCallback& callback) OVERRIDE; | 42 const VoidDBusMethodCallback& callback) override; |
43 virtual void Remove(const dbus::ObjectPath& ipconfig_path, | 43 virtual void Remove(const dbus::ObjectPath& ipconfig_path, |
44 const VoidDBusMethodCallback& callback) OVERRIDE; | 44 const VoidDBusMethodCallback& callback) override; |
45 virtual ShillIPConfigClient::TestInterface* GetTestInterface() OVERRIDE; | 45 virtual ShillIPConfigClient::TestInterface* GetTestInterface() override; |
46 | 46 |
47 // ShillIPConfigClient::TestInterface overrides. | 47 // ShillIPConfigClient::TestInterface overrides. |
48 virtual void AddIPConfig(const std::string& ip_config_path, | 48 virtual void AddIPConfig(const std::string& ip_config_path, |
49 const base::DictionaryValue& properties) OVERRIDE; | 49 const base::DictionaryValue& properties) override; |
50 | 50 |
51 private: | 51 private: |
52 // Runs callback with |values|. | 52 // Runs callback with |values|. |
53 void PassProperties(const base::DictionaryValue* values, | 53 void PassProperties(const base::DictionaryValue* values, |
54 const DictionaryValueCallback& callback) const; | 54 const DictionaryValueCallback& callback) const; |
55 | 55 |
56 // Dictionary of <ipconfig_path, property dictionaries> | 56 // Dictionary of <ipconfig_path, property dictionaries> |
57 base::DictionaryValue ipconfigs_; | 57 base::DictionaryValue ipconfigs_; |
58 | 58 |
59 // Note: This should remain the last member so it'll be destroyed and | 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. | 60 // invalidate its weak pointers before any other members are destroyed. |
61 base::WeakPtrFactory<FakeShillIPConfigClient> weak_ptr_factory_; | 61 base::WeakPtrFactory<FakeShillIPConfigClient> weak_ptr_factory_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(FakeShillIPConfigClient); | 63 DISALLOW_COPY_AND_ASSIGN(FakeShillIPConfigClient); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace chromeos | 66 } // namespace chromeos |
67 | 67 |
68 #endif // CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_ | 68 #endif // CHROMEOS_DBUS_FAKE_SHILL_IPCONFIG_CLIENT_H_ |
OLD | NEW |