Chromium Code Reviews| 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 <map> | |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chromeos/dbus/shill_manager_client.h" | |
| 11 #include "chromeos/dbus/shill_profile_client.h" | 13 #include "chromeos/dbus/shill_profile_client.h" |
| 12 | 14 |
| 13 namespace chromeos { | 15 namespace chromeos { |
| 14 | 16 |
| 15 // A stub implementation of ShillProfileClient. | 17 // A stub implementation of ShillProfileClient. |
| 16 class ShillProfileClientStub : public ShillProfileClient, | 18 class ShillProfileClientStub : public ShillProfileClient, |
| 17 public ShillProfileClient::TestInterface { | 19 public ShillProfileClient::TestInterface { |
| 18 public: | 20 public: |
| 19 ShillProfileClientStub(); | 21 explicit ShillProfileClientStub(); |
|
stevenjb
2013/05/03 18:34:53
nit: no need for explicit now
pneubeck (no reviews)
2013/05/06 07:24:43
Done.
pneubeck (no reviews)
2013/05/06 07:24:43
Done.
| |
| 20 virtual ~ShillProfileClientStub(); | 22 virtual ~ShillProfileClientStub(); |
| 21 | 23 |
| 22 // ShillProfileClient overrides. | 24 // ShillProfileClient overrides. |
| 23 virtual void AddPropertyChangedObserver( | 25 virtual void AddPropertyChangedObserver( |
| 24 const dbus::ObjectPath& profile_path, | 26 const dbus::ObjectPath& profile_path, |
| 25 ShillPropertyChangedObserver* observer) OVERRIDE; | 27 ShillPropertyChangedObserver* observer) OVERRIDE; |
| 26 virtual void RemovePropertyChangedObserver( | 28 virtual void RemovePropertyChangedObserver( |
| 27 const dbus::ObjectPath& profile_path, | 29 const dbus::ObjectPath& profile_path, |
| 28 ShillPropertyChangedObserver* observer) OVERRIDE; | 30 ShillPropertyChangedObserver* observer) OVERRIDE; |
| 29 virtual void GetProperties( | 31 virtual void GetProperties( |
| 30 const dbus::ObjectPath& profile_path, | 32 const dbus::ObjectPath& profile_path, |
| 31 const DictionaryValueCallbackWithoutStatus& callback, | 33 const DictionaryValueCallbackWithoutStatus& callback, |
| 32 const ErrorCallback& error_callback) OVERRIDE; | 34 const ErrorCallback& error_callback) OVERRIDE; |
| 33 virtual void GetEntry(const dbus::ObjectPath& profile_path, | 35 virtual void GetEntry(const dbus::ObjectPath& profile_path, |
| 34 const std::string& entry_path, | 36 const std::string& entry_path, |
| 35 const DictionaryValueCallbackWithoutStatus& callback, | 37 const DictionaryValueCallbackWithoutStatus& callback, |
| 36 const ErrorCallback& error_callback) OVERRIDE; | 38 const ErrorCallback& error_callback) OVERRIDE; |
| 37 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, | 39 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, |
| 38 const std::string& entry_path, | 40 const std::string& entry_path, |
| 39 const base::Closure& callback, | 41 const base::Closure& callback, |
| 40 const ErrorCallback& error_callback) OVERRIDE; | 42 const ErrorCallback& error_callback) OVERRIDE; |
| 41 virtual ShillProfileClient::TestInterface* GetTestInterface() OVERRIDE; | 43 virtual ShillProfileClient::TestInterface* GetTestInterface() OVERRIDE; |
| 42 | 44 |
| 43 // ShillProfileClient::TestInterface overrides. | 45 // ShillProfileClient::TestInterface overrides. |
| 44 virtual void AddProfile(const std::string& profile_path) OVERRIDE; | 46 virtual void AddProfile(const std::string& profile_path, |
| 47 const std::string& userhash) OVERRIDE; | |
| 45 virtual void AddEntry(const std::string& profile_path, | 48 virtual void AddEntry(const std::string& profile_path, |
| 46 const std::string& entry_path, | 49 const std::string& entry_path, |
| 47 const base::DictionaryValue& properties) OVERRIDE; | 50 const base::DictionaryValue& properties) OVERRIDE; |
| 48 virtual bool AddService(const std::string& service_path) OVERRIDE; | 51 virtual bool AddService(const std::string& service_path) OVERRIDE; |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 base::DictionaryValue* GetProfile(const dbus::ObjectPath& profile_path, | 54 struct ProfileProperties; |
| 52 const ErrorCallback& error_callback); | 55 typedef std::map<std::string, ProfileProperties*> ProfileMap; |
| 53 | 56 |
| 54 // This maps profile path -> entry path -> Shill properties. | 57 ProfileProperties* GetProfile(const dbus::ObjectPath& profile_path, |
| 55 base::DictionaryValue profile_entries_; | 58 const ErrorCallback& error_callback); |
| 59 | |
| 60 // The values are owned by this class and are explicitly destroyed where | |
| 61 // necessary. | |
| 62 ProfileMap profiles_; | |
| 56 | 63 |
| 57 DISALLOW_COPY_AND_ASSIGN(ShillProfileClientStub); | 64 DISALLOW_COPY_AND_ASSIGN(ShillProfileClientStub); |
| 58 }; | 65 }; |
| 59 | 66 |
| 60 } // namespace chromeos | 67 } // namespace chromeos |
| 61 | 68 |
| 62 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ | 69 #endif // CHROMEOS_DBUS_SHILL_PROFILE_CLIENT_STUB_H_ |
| OLD | NEW |