diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 06:27:38 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 06:27:38 +0000 |
commit | dc2029f0fc2e26e5cb11fe783fd06e380247f4aa (patch) | |
tree | 96d84f15d4b8a42be54b80a84ea85ddf0f9fa0ca /chromeos/dbus/shill_service_client.h | |
parent | a3d2445a0edc5958c0c2927b7dcf486fa333531d (diff) | |
download | chromium_src-dc2029f0fc2e26e5cb11fe783fd06e380247f4aa.zip chromium_src-dc2029f0fc2e26e5cb11fe783fd06e380247f4aa.tar.gz chromium_src-dc2029f0fc2e26e5cb11fe783fd06e380247f4aa.tar.bz2 |
Add TestInterface methods for adding shill stub devices and services
This will help write functional tests for network handlers written on top of the Shill client code.
BUG=154072
TEST=NetworkSmsHandlerTest.SmsHandlerDbusStub passes
Review URL: https://chromiumcodereview.appspot.com/11365022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/shill_service_client.h')
-rw-r--r-- | chromeos/dbus/shill_service_client.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/chromeos/dbus/shill_service_client.h b/chromeos/dbus/shill_service_client.h index 0e30243..0563aa4 100644 --- a/chromeos/dbus/shill_service_client.h +++ b/chromeos/dbus/shill_service_client.h @@ -39,12 +39,30 @@ class CHROMEOS_EXPORT ShillServiceClient { typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; typedef ShillClientHelper::ErrorCallback ErrorCallback; + // Interface for setting up services for testing. + // Accessed through GetTestInterface(), only implemented in the Stub Impl. + class TestInterface { + public: + virtual void AddService(const std::string& service_path, + const std::string& name, + const std::string& type, + const std::string& state, + const std::string& security) = 0; + virtual void RemoveService(const std::string& service_path) = 0; + virtual void SetServiceProperty(const std::string& service_path, + const std::string& property, + const base::Value& value) = 0; + virtual void ClearServices() = 0; + + protected: + ~TestInterface() {} + }; virtual ~ShillServiceClient(); // Factory function, creates a new instance which is owned by the caller. // For normal usage, access the singleton via DBusThreadManager::Get(). static ShillServiceClient* Create(DBusClientImplementationType type, - dbus::Bus* bus); + dbus::Bus* bus); // Adds a property changed |observer| to the service at |service_path|. virtual void AddPropertyChangedObserver( @@ -111,6 +129,9 @@ class CHROMEOS_EXPORT ShillServiceClient { const dbus::ObjectPath& service_path, const std::string& carrier) = 0; + // Returns an interface for testing (stub only), or returns NULL. + virtual TestInterface* GetTestInterface() = 0; + protected: // Create() should be used instead. ShillServiceClient(); |