OLD | NEW |
1 // Copyright (c) 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_SHILL_SERVICE_CLIENT_STUB_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_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 stub implementation of ShillServiceClient. This works in close coordination | 19 // A fake implementation of ShillServiceClient. This works in close coordination |
20 // with ShillManagerClientStub and is not intended to be used independently. | 20 // with FakeShillManagerClient and is not intended to be used independently. |
21 class ShillServiceClientStub : public ShillServiceClient, | 21 class CHROMEOS_EXPORT FakeShillServiceClient : |
22 public ShillServiceClient::TestInterface { | 22 public ShillServiceClient, |
| 23 public ShillServiceClient::TestInterface { |
23 public: | 24 public: |
24 ShillServiceClientStub(); | 25 FakeShillServiceClient(); |
25 virtual ~ShillServiceClientStub(); | 26 virtual ~FakeShillServiceClient(); |
26 | 27 |
27 // ShillServiceClient overrides | 28 // ShillServiceClient overrides |
28 virtual void Init(dbus::Bus* bus) OVERRIDE; | 29 virtual void Init(dbus::Bus* bus) OVERRIDE; |
29 virtual void AddPropertyChangedObserver( | 30 virtual void AddPropertyChangedObserver( |
30 const dbus::ObjectPath& service_path, | 31 const dbus::ObjectPath& service_path, |
31 ShillPropertyChangedObserver* observer) OVERRIDE; | 32 ShillPropertyChangedObserver* observer) OVERRIDE; |
32 virtual void RemovePropertyChangedObserver( | 33 virtual void RemovePropertyChangedObserver( |
33 const dbus::ObjectPath& service_path, | 34 const dbus::ObjectPath& service_path, |
34 ShillPropertyChangedObserver* observer) OVERRIDE; | 35 ShillPropertyChangedObserver* observer) OVERRIDE; |
35 virtual void GetProperties(const dbus::ObjectPath& service_path, | 36 virtual void GetProperties(const dbus::ObjectPath& service_path, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Per network service, stores a closure that is executed on each connection | 118 // Per network service, stores a closure that is executed on each connection |
118 // attempt. The callback can for example modify the services properties in | 119 // attempt. The callback can for example modify the services properties in |
119 // order to simulate a connection failure. | 120 // order to simulate a connection failure. |
120 std::map<std::string, base::Closure> connect_behavior_; | 121 std::map<std::string, base::Closure> connect_behavior_; |
121 | 122 |
122 // Observer list for each service. | 123 // Observer list for each service. |
123 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_; | 124 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_; |
124 | 125 |
125 // Note: This should remain the last member so it'll be destroyed and | 126 // Note: This should remain the last member so it'll be destroyed and |
126 // invalidate its weak pointers before any other members are destroyed. | 127 // invalidate its weak pointers before any other members are destroyed. |
127 base::WeakPtrFactory<ShillServiceClientStub> weak_ptr_factory_; | 128 base::WeakPtrFactory<FakeShillServiceClient> weak_ptr_factory_; |
128 | 129 |
129 DISALLOW_COPY_AND_ASSIGN(ShillServiceClientStub); | 130 DISALLOW_COPY_AND_ASSIGN(FakeShillServiceClient); |
130 }; | 131 }; |
131 | 132 |
132 } // namespace chromeos | 133 } // namespace chromeos |
133 | 134 |
134 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_STUB_H_ | 135 #endif // CHROMEOS_DBUS_FAKE_SHILL_SERVICE_CLIENT_H_ |
OLD | NEW |