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