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