Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: chromeos/dbus/shill_service_client.h

Issue 11365022: Add TestInterface methods for adding shill stub devices and services (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another clang fix Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/shill_service_client.h
diff --git a/chromeos/dbus/shill_service_client.h b/chromeos/dbus/shill_service_client.h
index 0e30243f3471454efc15d9d69149a91453b8677b..0563aa4b37ce0f607ca6306a5bfeb7adc6306c0a 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();

Powered by Google App Engine
This is Rietveld 408576698