OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_PROFILE_CLIENT_STUB_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
6 #define CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ | 6 #define CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chromeos/dbus/shill_profile_client.h" | 11 #include "chromeos/dbus/shill_profile_client.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 // A stub implementation of ShillProfileClient. | 15 // A stub implementation of ShillProfileClient. |
16 class ShillProfileClientStub : public ShillProfileClient { | 16 class ShillProfileClientStub : public ShillProfileClient, |
| 17 public ShillProfileClient::TestInterface { |
17 public: | 18 public: |
18 ShillProfileClientStub(); | 19 ShillProfileClientStub(); |
19 virtual ~ShillProfileClientStub(); | 20 virtual ~ShillProfileClientStub(); |
20 | 21 |
21 // ShillProfileClient overrides. | 22 // ShillProfileClient overrides. |
22 virtual void AddPropertyChangedObserver( | 23 virtual void AddPropertyChangedObserver( |
23 const dbus::ObjectPath& profile_path, | 24 const dbus::ObjectPath& profile_path, |
24 ShillPropertyChangedObserver* observer) OVERRIDE; | 25 ShillPropertyChangedObserver* observer) OVERRIDE; |
25 virtual void RemovePropertyChangedObserver( | 26 virtual void RemovePropertyChangedObserver( |
26 const dbus::ObjectPath& profile_path, | 27 const dbus::ObjectPath& profile_path, |
27 ShillPropertyChangedObserver* observer) OVERRIDE; | 28 ShillPropertyChangedObserver* observer) OVERRIDE; |
28 virtual void GetProperties( | 29 virtual void GetProperties( |
29 const dbus::ObjectPath& profile_path, | 30 const dbus::ObjectPath& profile_path, |
30 const DictionaryValueCallbackWithoutStatus& callback, | 31 const DictionaryValueCallbackWithoutStatus& callback, |
31 const ErrorCallback& error_callback) OVERRIDE; | 32 const ErrorCallback& error_callback) OVERRIDE; |
32 virtual void GetEntry(const dbus::ObjectPath& profile_path, | 33 virtual void GetEntry(const dbus::ObjectPath& profile_path, |
33 const std::string& entry_path, | 34 const std::string& entry_path, |
34 const DictionaryValueCallbackWithoutStatus& callback, | 35 const DictionaryValueCallbackWithoutStatus& callback, |
35 const ErrorCallback& error_callback) OVERRIDE; | 36 const ErrorCallback& error_callback) OVERRIDE; |
36 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, | 37 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, |
37 const std::string& entry_path, | 38 const std::string& entry_path, |
38 const base::Closure& callback, | 39 const base::Closure& callback, |
39 const ErrorCallback& error_callback) OVERRIDE; | 40 const ErrorCallback& error_callback) OVERRIDE; |
| 41 virtual ShillProfileClient::TestInterface* GetTestInterface() OVERRIDE; |
| 42 |
| 43 // ShillProfileClient::TestInterface overrides. |
| 44 virtual void AddProfile(const std::string& profile_path) OVERRIDE; |
| 45 virtual void AddEntry(const std::string& profile_path, |
| 46 const std::string& entry_path, |
| 47 const base::DictionaryValue& properties) OVERRIDE; |
| 48 virtual bool AddService(const std::string& service_path) OVERRIDE; |
40 | 49 |
41 private: | 50 private: |
42 void PassEmptyDictionaryValue( | 51 base::DictionaryValue* GetProfile(const dbus::ObjectPath& profile_path, |
43 const DictionaryValueCallbackWithoutStatus& callback) const; | 52 const ErrorCallback& error_callback); |
44 | 53 |
45 // Note: This should remain the last member so it'll be destroyed and | 54 // Note: This should remain the last member so it'll be destroyed and |
46 // invalidate its weak pointers before any other members are destroyed. | 55 // invalidate its weak pointers before any other members are destroyed. |
47 base::WeakPtrFactory<ShillProfileClientStub> weak_ptr_factory_; | 56 base::WeakPtrFactory<ShillProfileClientStub> weak_ptr_factory_; |
48 | 57 |
| 58 // This maps profile path -> entry path -> Shill properties. |
| 59 base::DictionaryValue profile_entries_; |
| 60 |
49 DISALLOW_COPY_AND_ASSIGN(ShillProfileClientStub); | 61 DISALLOW_COPY_AND_ASSIGN(ShillProfileClientStub); |
50 }; | 62 }; |
51 | 63 |
52 } // namespace chromeos | 64 } // namespace chromeos |
53 | 65 |
54 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ | 66 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
OLD | NEW |