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_SERVICE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
15 #include "chromeos/dbus/shill_service_client.h" | 15 #include "chromeos/dbus/shill_service_client.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // A fake implementation of ShillServiceClient. This works in close coordination | 19 // A fake implementation of ShillServiceClient. This works in close coordination |
20 // with FakeShillManagerClient and is not intended to be used independently. | 20 // with FakeShillManagerClient and is not intended to be used independently. |
21 class CHROMEOS_EXPORT FakeShillServiceClient | 21 class CHROMEOS_EXPORT FakeShillServiceClient |
22 : public ShillServiceClient, | 22 : public ShillServiceClient, |
23 public ShillServiceClient::TestInterface { | 23 public ShillServiceClient::TestInterface { |
24 public: | 24 public: |
25 FakeShillServiceClient(); | 25 FakeShillServiceClient(); |
26 virtual ~FakeShillServiceClient(); | 26 virtual ~FakeShillServiceClient(); |
27 | 27 |
28 // ShillServiceClient overrides | 28 // ShillServiceClient overrides |
29 virtual void Init(dbus::Bus* bus) OVERRIDE; | 29 virtual void Init(dbus::Bus* bus) override; |
30 virtual void AddPropertyChangedObserver( | 30 virtual void AddPropertyChangedObserver( |
31 const dbus::ObjectPath& service_path, | 31 const dbus::ObjectPath& service_path, |
32 ShillPropertyChangedObserver* observer) OVERRIDE; | 32 ShillPropertyChangedObserver* observer) override; |
33 virtual void RemovePropertyChangedObserver( | 33 virtual void RemovePropertyChangedObserver( |
34 const dbus::ObjectPath& service_path, | 34 const dbus::ObjectPath& service_path, |
35 ShillPropertyChangedObserver* observer) OVERRIDE; | 35 ShillPropertyChangedObserver* observer) override; |
36 virtual void GetProperties(const dbus::ObjectPath& service_path, | 36 virtual void GetProperties(const dbus::ObjectPath& service_path, |
37 const DictionaryValueCallback& callback) OVERRIDE; | 37 const DictionaryValueCallback& callback) override; |
38 virtual void SetProperty(const dbus::ObjectPath& service_path, | 38 virtual void SetProperty(const dbus::ObjectPath& service_path, |
39 const std::string& name, | 39 const std::string& name, |
40 const base::Value& value, | 40 const base::Value& value, |
41 const base::Closure& callback, | 41 const base::Closure& callback, |
42 const ErrorCallback& error_callback) OVERRIDE; | 42 const ErrorCallback& error_callback) override; |
43 virtual void SetProperties(const dbus::ObjectPath& service_path, | 43 virtual void SetProperties(const dbus::ObjectPath& service_path, |
44 const base::DictionaryValue& properties, | 44 const base::DictionaryValue& properties, |
45 const base::Closure& callback, | 45 const base::Closure& callback, |
46 const ErrorCallback& error_callback) OVERRIDE; | 46 const ErrorCallback& error_callback) override; |
47 virtual void ClearProperty(const dbus::ObjectPath& service_path, | 47 virtual void ClearProperty(const dbus::ObjectPath& service_path, |
48 const std::string& name, | 48 const std::string& name, |
49 const base::Closure& callback, | 49 const base::Closure& callback, |
50 const ErrorCallback& error_callback) OVERRIDE; | 50 const ErrorCallback& error_callback) override; |
51 virtual void ClearProperties(const dbus::ObjectPath& service_path, | 51 virtual void ClearProperties(const dbus::ObjectPath& service_path, |
52 const std::vector<std::string>& names, | 52 const std::vector<std::string>& names, |
53 const ListValueCallback& callback, | 53 const ListValueCallback& callback, |
54 const ErrorCallback& error_callback) OVERRIDE; | 54 const ErrorCallback& error_callback) override; |
55 virtual void Connect(const dbus::ObjectPath& service_path, | 55 virtual void Connect(const dbus::ObjectPath& service_path, |
56 const base::Closure& callback, | 56 const base::Closure& callback, |
57 const ErrorCallback& error_callback) OVERRIDE; | 57 const ErrorCallback& error_callback) override; |
58 virtual void Disconnect(const dbus::ObjectPath& service_path, | 58 virtual void Disconnect(const dbus::ObjectPath& service_path, |
59 const base::Closure& callback, | 59 const base::Closure& callback, |
60 const ErrorCallback& error_callback) OVERRIDE; | 60 const ErrorCallback& error_callback) override; |
61 virtual void Remove(const dbus::ObjectPath& service_path, | 61 virtual void Remove(const dbus::ObjectPath& service_path, |
62 const base::Closure& callback, | 62 const base::Closure& callback, |
63 const ErrorCallback& error_callback) OVERRIDE; | 63 const ErrorCallback& error_callback) override; |
64 virtual void ActivateCellularModem( | 64 virtual void ActivateCellularModem( |
65 const dbus::ObjectPath& service_path, | 65 const dbus::ObjectPath& service_path, |
66 const std::string& carrier, | 66 const std::string& carrier, |
67 const base::Closure& callback, | 67 const base::Closure& callback, |
68 const ErrorCallback& error_callback) OVERRIDE; | 68 const ErrorCallback& error_callback) override; |
69 virtual void CompleteCellularActivation( | 69 virtual void CompleteCellularActivation( |
70 const dbus::ObjectPath& service_path, | 70 const dbus::ObjectPath& service_path, |
71 const base::Closure& callback, | 71 const base::Closure& callback, |
72 const ErrorCallback& error_callback) OVERRIDE; | 72 const ErrorCallback& error_callback) override; |
73 virtual void GetLoadableProfileEntries( | 73 virtual void GetLoadableProfileEntries( |
74 const dbus::ObjectPath& service_path, | 74 const dbus::ObjectPath& service_path, |
75 const DictionaryValueCallback& callback) OVERRIDE; | 75 const DictionaryValueCallback& callback) override; |
76 virtual ShillServiceClient::TestInterface* GetTestInterface() OVERRIDE; | 76 virtual ShillServiceClient::TestInterface* GetTestInterface() override; |
77 | 77 |
78 // ShillServiceClient::TestInterface overrides. | 78 // ShillServiceClient::TestInterface overrides. |
79 virtual void AddService(const std::string& service_path, | 79 virtual void AddService(const std::string& service_path, |
80 const std::string& guid, | 80 const std::string& guid, |
81 const std::string& name, | 81 const std::string& name, |
82 const std::string& type, | 82 const std::string& type, |
83 const std::string& state, | 83 const std::string& state, |
84 bool visible) OVERRIDE; | 84 bool visible) override; |
85 virtual void AddServiceWithIPConfig(const std::string& service_path, | 85 virtual void AddServiceWithIPConfig(const std::string& service_path, |
86 const std::string& guid, | 86 const std::string& guid, |
87 const std::string& name, | 87 const std::string& name, |
88 const std::string& type, | 88 const std::string& type, |
89 const std::string& state, | 89 const std::string& state, |
90 const std::string& ipconfig_path, | 90 const std::string& ipconfig_path, |
91 bool visible) OVERRIDE; | 91 bool visible) override; |
92 virtual base::DictionaryValue* SetServiceProperties( | 92 virtual base::DictionaryValue* SetServiceProperties( |
93 const std::string& service_path, | 93 const std::string& service_path, |
94 const std::string& guid, | 94 const std::string& guid, |
95 const std::string& name, | 95 const std::string& name, |
96 const std::string& type, | 96 const std::string& type, |
97 const std::string& state, | 97 const std::string& state, |
98 bool visible) OVERRIDE; | 98 bool visible) override; |
99 virtual void RemoveService(const std::string& service_path) OVERRIDE; | 99 virtual void RemoveService(const std::string& service_path) override; |
100 virtual bool SetServiceProperty(const std::string& service_path, | 100 virtual bool SetServiceProperty(const std::string& service_path, |
101 const std::string& property, | 101 const std::string& property, |
102 const base::Value& value) OVERRIDE; | 102 const base::Value& value) override; |
103 virtual const base::DictionaryValue* GetServiceProperties( | 103 virtual const base::DictionaryValue* GetServiceProperties( |
104 const std::string& service_path) const OVERRIDE; | 104 const std::string& service_path) const override; |
105 virtual void ClearServices() OVERRIDE; | 105 virtual void ClearServices() override; |
106 virtual void SetConnectBehavior(const std::string& service_path, | 106 virtual void SetConnectBehavior(const std::string& service_path, |
107 const base::Closure& behavior) OVERRIDE; | 107 const base::Closure& behavior) override; |
108 | 108 |
109 private: | 109 private: |
110 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList; | 110 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList; |
111 | 111 |
112 void NotifyObserversPropertyChanged(const dbus::ObjectPath& service_path, | 112 void NotifyObserversPropertyChanged(const dbus::ObjectPath& service_path, |
113 const std::string& property); | 113 const std::string& property); |
114 base::DictionaryValue* GetModifiableServiceProperties( | 114 base::DictionaryValue* GetModifiableServiceProperties( |
115 const std::string& service_path, | 115 const std::string& service_path, |
116 bool create_if_missing); | 116 bool create_if_missing); |
117 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path); | 117 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path); |
(...skipping 15 matching lines...) Expand all Loading... |
133 // Note: This should remain the last member so it'll be destroyed and | 133 // Note: This should remain the last member so it'll be destroyed and |
134 // invalidate its weak pointers before any other members are destroyed. | 134 // invalidate its weak pointers before any other members are destroyed. |
135 base::WeakPtrFactory<FakeShillServiceClient> weak_ptr_factory_; | 135 base::WeakPtrFactory<FakeShillServiceClient> weak_ptr_factory_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(FakeShillServiceClient); | 137 DISALLOW_COPY_AND_ASSIGN(FakeShillServiceClient); |
138 }; | 138 }; |
139 | 139 |
140 } // namespace chromeos | 140 } // namespace chromeos |
141 | 141 |
142 #endif // CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ | 142 #endif // CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ |
OLD | NEW |