diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-21 05:41:00 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-21 05:41:00 +0000 |
commit | a84a69d4fcafc42f4a23fbc97b60dd80dc59c749 (patch) | |
tree | 9f872b497c1d1eff8901901c9a1cfc0ee8ec59f3 /chromeos/dbus/fake_shill_device_client.h | |
parent | 09f0c3ba70b30e465d9ba3ffefdd03667a56a4b4 (diff) | |
download | chromium_src-a84a69d4fcafc42f4a23fbc97b60dd80dc59c749.zip chromium_src-a84a69d4fcafc42f4a23fbc97b60dd80dc59c749.tar.gz chromium_src-a84a69d4fcafc42f4a23fbc97b60dd80dc59c749.tar.bz2 |
dbus: Remove MockShillDeviceClient and MockShillIPConfigClient
These are not in use.
Along the way rename ShillDeviceClientStub to FakeShillDeviceClient
and ShillIPConfigClient to FakeShillIPConfigClient respectively.
BUG=234463,309506
TEST=none
R=hashimoto@chromium.org
Review URL: https://codereview.chromium.org/31513002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_shill_device_client.h')
-rw-r--r-- | chromeos/dbus/fake_shill_device_client.h | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/chromeos/dbus/fake_shill_device_client.h b/chromeos/dbus/fake_shill_device_client.h index c97bae1..cb5b859 100644 --- a/chromeos/dbus/fake_shill_device_client.h +++ b/chromeos/dbus/fake_shill_device_client.h @@ -5,15 +5,19 @@ #ifndef CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ #define CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ -#include "base/callback_forward.h" -#include "base/values.h" +#include <string> + +#include "base/basictypes.h" +#include "chromeos/chromeos_export.h" #include "chromeos/dbus/shill_device_client.h" -#include "chromeos/dbus/shill_property_changed_observer.h" namespace chromeos { -// A fake implementation of ShillDeviceClient. This class does nothing. -class FakeShillDeviceClient : public ShillDeviceClient { +// A fake implementation of ShillDeviceClient. +// Implemented: Stub cellular device for SMS testing. +class CHROMEOS_EXPORT FakeShillDeviceClient + : public ShillDeviceClient, + public ShillDeviceClient::TestInterface { public: FakeShillDeviceClient(); virtual ~FakeShillDeviceClient(); @@ -72,9 +76,44 @@ class FakeShillDeviceClient : public ShillDeviceClient { virtual void Reset(const dbus::ObjectPath& device_path, const base::Closure& callback, const ErrorCallback& error_callback) OVERRIDE; - virtual TestInterface* GetTestInterface() OVERRIDE; + virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE; + + // ShillDeviceClient::TestInterface overrides. + virtual void AddDevice(const std::string& device_path, + const std::string& type, + const std::string& object_path) OVERRIDE; + virtual void RemoveDevice(const std::string& device_path) OVERRIDE; + virtual void ClearDevices() OVERRIDE; + virtual void SetDeviceProperty(const std::string& device_path, + const std::string& name, + const base::Value& value) OVERRIDE; + virtual std::string GetDevicePathForType(const std::string& type) OVERRIDE; private: + typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList; + + void SetDefaultProperties(); + void PassStubDeviceProperties(const dbus::ObjectPath& device_path, + const DictionaryValueCallback& callback) const; + + // Posts a task to run a void callback with status code |status|. + void PostVoidCallback(const VoidDBusMethodCallback& callback, + DBusMethodCallStatus status); + + void NotifyObserversPropertyChanged(const dbus::ObjectPath& device_path, + const std::string& property); + base::DictionaryValue* GetDeviceProperties(const std::string& device_path); + PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path); + + // Dictionary of <device_name, Dictionary>. + base::DictionaryValue stub_devices_; + // Observer list for each device. + std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_; + + // Note: This should remain the last member so it'll be destroyed and + // invalidate its weak pointers before any other members are destroyed. + base::WeakPtrFactory<FakeShillDeviceClient> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(FakeShillDeviceClient); }; |