| 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_PROFILE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_SHILL_PROFILE_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 "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
| 13 #include "chromeos/dbus/shill_manager_client.h" | 13 #include "chromeos/dbus/shill_manager_client.h" |
| 14 #include "chromeos/dbus/shill_profile_client.h" | 14 #include "chromeos/dbus/shill_profile_client.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 // A stub implementation of ShillProfileClient. | 18 // A stub implementation of ShillProfileClient. |
| 19 class CHROMEOS_EXPORT FakeShillProfileClient : | 19 class CHROMEOS_EXPORT FakeShillProfileClient : |
| 20 public ShillProfileClient, | 20 public ShillProfileClient, |
| 21 public ShillProfileClient::TestInterface { | 21 public ShillProfileClient::TestInterface { |
| 22 public: | 22 public: |
| 23 FakeShillProfileClient(); | 23 FakeShillProfileClient(); |
| 24 virtual ~FakeShillProfileClient(); | 24 virtual ~FakeShillProfileClient(); |
| 25 | 25 |
| 26 // ShillProfileClient overrides | 26 // ShillProfileClient overrides |
| 27 virtual void Init(dbus::Bus* bus) OVERRIDE; | 27 virtual void Init(dbus::Bus* bus) override; |
| 28 virtual void AddPropertyChangedObserver( | 28 virtual void AddPropertyChangedObserver( |
| 29 const dbus::ObjectPath& profile_path, | 29 const dbus::ObjectPath& profile_path, |
| 30 ShillPropertyChangedObserver* observer) OVERRIDE; | 30 ShillPropertyChangedObserver* observer) override; |
| 31 virtual void RemovePropertyChangedObserver( | 31 virtual void RemovePropertyChangedObserver( |
| 32 const dbus::ObjectPath& profile_path, | 32 const dbus::ObjectPath& profile_path, |
| 33 ShillPropertyChangedObserver* observer) OVERRIDE; | 33 ShillPropertyChangedObserver* observer) override; |
| 34 virtual void GetProperties( | 34 virtual void GetProperties( |
| 35 const dbus::ObjectPath& profile_path, | 35 const dbus::ObjectPath& profile_path, |
| 36 const DictionaryValueCallbackWithoutStatus& callback, | 36 const DictionaryValueCallbackWithoutStatus& callback, |
| 37 const ErrorCallback& error_callback) OVERRIDE; | 37 const ErrorCallback& error_callback) override; |
| 38 virtual void GetEntry(const dbus::ObjectPath& profile_path, | 38 virtual void GetEntry(const dbus::ObjectPath& profile_path, |
| 39 const std::string& entry_path, | 39 const std::string& entry_path, |
| 40 const DictionaryValueCallbackWithoutStatus& callback, | 40 const DictionaryValueCallbackWithoutStatus& callback, |
| 41 const ErrorCallback& error_callback) OVERRIDE; | 41 const ErrorCallback& error_callback) override; |
| 42 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, | 42 virtual void DeleteEntry(const dbus::ObjectPath& profile_path, |
| 43 const std::string& entry_path, | 43 const std::string& entry_path, |
| 44 const base::Closure& callback, | 44 const base::Closure& callback, |
| 45 const ErrorCallback& error_callback) OVERRIDE; | 45 const ErrorCallback& error_callback) override; |
| 46 virtual ShillProfileClient::TestInterface* GetTestInterface() OVERRIDE; | 46 virtual ShillProfileClient::TestInterface* GetTestInterface() override; |
| 47 | 47 |
| 48 // ShillProfileClient::TestInterface overrides. | 48 // ShillProfileClient::TestInterface overrides. |
| 49 virtual void AddProfile(const std::string& profile_path, | 49 virtual void AddProfile(const std::string& profile_path, |
| 50 const std::string& userhash) OVERRIDE; | 50 const std::string& userhash) override; |
| 51 virtual void AddEntry(const std::string& profile_path, | 51 virtual void AddEntry(const std::string& profile_path, |
| 52 const std::string& entry_path, | 52 const std::string& entry_path, |
| 53 const base::DictionaryValue& properties) OVERRIDE; | 53 const base::DictionaryValue& properties) override; |
| 54 virtual bool AddService(const std::string& profile_path, | 54 virtual bool AddService(const std::string& profile_path, |
| 55 const std::string& service_path) OVERRIDE; | 55 const std::string& service_path) override; |
| 56 virtual bool UpdateService(const std::string& profile_path, | 56 virtual bool UpdateService(const std::string& profile_path, |
| 57 const std::string& service_path) OVERRIDE; | 57 const std::string& service_path) override; |
| 58 virtual void GetProfilePaths(std::vector<std::string>* profiles) OVERRIDE; | 58 virtual void GetProfilePaths(std::vector<std::string>* profiles) override; |
| 59 virtual bool GetService(const std::string& service_path, | 59 virtual bool GetService(const std::string& service_path, |
| 60 std::string* profile_path, | 60 std::string* profile_path, |
| 61 base::DictionaryValue* properties) OVERRIDE; | 61 base::DictionaryValue* properties) override; |
| 62 virtual void ClearProfiles() OVERRIDE; | 62 virtual void ClearProfiles() override; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 struct ProfileProperties; | 65 struct ProfileProperties; |
| 66 typedef std::map<std::string, ProfileProperties*> ProfileMap; | 66 typedef std::map<std::string, ProfileProperties*> ProfileMap; |
| 67 | 67 |
| 68 bool AddOrUpdateServiceImpl(const std::string& profile_path, | 68 bool AddOrUpdateServiceImpl(const std::string& profile_path, |
| 69 const std::string& service_path, | 69 const std::string& service_path, |
| 70 ProfileProperties* profile); | 70 ProfileProperties* profile); |
| 71 | 71 |
| 72 ProfileProperties* GetProfile(const dbus::ObjectPath& profile_path, | 72 ProfileProperties* GetProfile(const dbus::ObjectPath& profile_path, |
| 73 const ErrorCallback& error_callback); | 73 const ErrorCallback& error_callback); |
| 74 | 74 |
| 75 // The values are owned by this class and are explicitly destroyed where | 75 // The values are owned by this class and are explicitly destroyed where |
| 76 // necessary. | 76 // necessary. |
| 77 ProfileMap profiles_; | 77 ProfileMap profiles_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(FakeShillProfileClient); | 79 DISALLOW_COPY_AND_ASSIGN(FakeShillProfileClient); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace chromeos | 82 } // namespace chromeos |
| 83 | 83 |
| 84 #endif // CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ | 84 #endif // CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ |
| OLD | NEW |