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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_
6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ 6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 21 matching lines...) Expand all
32 // ShillServiceClient is used to communicate with the Shill Service 32 // ShillServiceClient is used to communicate with the Shill Service
33 // service. 33 // service.
34 // All methods should be called from the origin thread which initializes the 34 // All methods should be called from the origin thread which initializes the
35 // DBusThreadManager instance. 35 // DBusThreadManager instance.
36 class CHROMEOS_EXPORT ShillServiceClient { 36 class CHROMEOS_EXPORT ShillServiceClient {
37 public: 37 public:
38 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; 38 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler;
39 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; 39 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback;
40 typedef ShillClientHelper::ErrorCallback ErrorCallback; 40 typedef ShillClientHelper::ErrorCallback ErrorCallback;
41 41
42 // Interface for setting up services for testing.
43 // Accessed through GetTestInterface(), only implemented in the Stub Impl.
44 class TestInterface {
45 public:
46 virtual void AddService(const std::string& service_path,
47 const std::string& name,
48 const std::string& type,
49 const std::string& state,
50 const std::string& security) = 0;
51 virtual void RemoveService(const std::string& service_path) = 0;
52 virtual void SetServiceProperty(const std::string& service_path,
53 const std::string& property,
54 const base::Value& value) = 0;
55 virtual void ClearServices() = 0;
56
57 protected:
58 ~TestInterface() {}
59 };
42 virtual ~ShillServiceClient(); 60 virtual ~ShillServiceClient();
43 61
44 // Factory function, creates a new instance which is owned by the caller. 62 // Factory function, creates a new instance which is owned by the caller.
45 // For normal usage, access the singleton via DBusThreadManager::Get(). 63 // For normal usage, access the singleton via DBusThreadManager::Get().
46 static ShillServiceClient* Create(DBusClientImplementationType type, 64 static ShillServiceClient* Create(DBusClientImplementationType type,
47 dbus::Bus* bus); 65 dbus::Bus* bus);
48 66
49 // Adds a property changed |observer| to the service at |service_path|. 67 // Adds a property changed |observer| to the service at |service_path|.
50 virtual void AddPropertyChangedObserver( 68 virtual void AddPropertyChangedObserver(
51 const dbus::ObjectPath& service_path, 69 const dbus::ObjectPath& service_path,
52 ShillPropertyChangedObserver* observer) = 0; 70 ShillPropertyChangedObserver* observer) = 0;
53 71
54 // Removes a property changed |observer| to the service at |service_path|. 72 // Removes a property changed |observer| to the service at |service_path|.
55 virtual void RemovePropertyChangedObserver( 73 virtual void RemovePropertyChangedObserver(
56 const dbus::ObjectPath& service_path, 74 const dbus::ObjectPath& service_path,
57 ShillPropertyChangedObserver* observer) = 0; 75 ShillPropertyChangedObserver* observer) = 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 122
105 // DEPRECATED DO NOT USE: Calls ActivateCellularModem method and blocks until 123 // DEPRECATED DO NOT USE: Calls ActivateCellularModem method and blocks until
106 // the method call finishes. 124 // the method call finishes.
107 // 125 //
108 // TODO(hashimoto): Refactor CrosActivateCellularModem and remove this method. 126 // TODO(hashimoto): Refactor CrosActivateCellularModem and remove this method.
109 // crosbug.com/29902 127 // crosbug.com/29902
110 virtual bool CallActivateCellularModemAndBlock( 128 virtual bool CallActivateCellularModemAndBlock(
111 const dbus::ObjectPath& service_path, 129 const dbus::ObjectPath& service_path,
112 const std::string& carrier) = 0; 130 const std::string& carrier) = 0;
113 131
132 // Returns an interface for testing (stub only), or returns NULL.
133 virtual TestInterface* GetTestInterface() = 0;
134
114 protected: 135 protected:
115 // Create() should be used instead. 136 // Create() should be used instead.
116 ShillServiceClient(); 137 ShillServiceClient();
117 138
118 private: 139 private:
119 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient); 140 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient);
120 }; 141 };
121 142
122 } // namespace chromeos 143 } // namespace chromeos
123 144
124 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_ 145 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698