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

Side by Side Diff: chromeos/dbus/shill_manager_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_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 14 matching lines...) Expand all
25 25
26 // ShillManagerClient is used to communicate with the Shill Manager 26 // ShillManagerClient is used to communicate with the Shill Manager
27 // service. All methods should be called from the origin thread which 27 // service. All methods should be called from the origin thread which
28 // initializes the DBusThreadManager instance. 28 // initializes the DBusThreadManager instance.
29 class CHROMEOS_EXPORT ShillManagerClient { 29 class CHROMEOS_EXPORT ShillManagerClient {
30 public: 30 public:
31 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler; 31 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler;
32 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback; 32 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback;
33 typedef ShillClientHelper::ErrorCallback ErrorCallback; 33 typedef ShillClientHelper::ErrorCallback ErrorCallback;
34 34
35 // Interface for setting up devices, services, and technologies for testing.
36 // Accessed through GetTestInterface(), only implemented in the Stub Impl.
37 class TestInterface {
38 public:
39 virtual void AddDevice(const std::string& device_path) = 0;
40 virtual void RemoveDevice(const std::string& device_path) = 0;
41 virtual void AddService(const std::string& service_path,
42 bool add_to_watch_list) = 0;
43 virtual void RemoveService(const std::string& service_path) = 0;
44 virtual void AddTechnology(const std::string& type, bool enabled) = 0;
45 virtual void RemoveTechnology(const std::string& type) = 0;
46 virtual void ClearProperties() = 0;
47
48 protected:
49 ~TestInterface() {}
50 };
51
35 virtual ~ShillManagerClient(); 52 virtual ~ShillManagerClient();
36 53
37 // Factory function, creates a new instance which is owned by the caller. 54 // Factory function, creates a new instance which is owned by the caller.
38 // For normal usage, access the singleton via DBusThreadManager::Get(). 55 // For normal usage, access the singleton via DBusThreadManager::Get().
39 static ShillManagerClient* Create(DBusClientImplementationType type, 56 static ShillManagerClient* Create(DBusClientImplementationType type,
40 dbus::Bus* bus); 57 dbus::Bus* bus);
41 58
42 // Adds a property changed |observer|. 59 // Adds a property changed |observer|.
43 virtual void AddPropertyChangedObserver( 60 virtual void AddPropertyChangedObserver(
44 ShillPropertyChangedObserver* observer) = 0; 61 ShillPropertyChangedObserver* observer) = 0;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual void ConfigureService(const base::DictionaryValue& properties, 106 virtual void ConfigureService(const base::DictionaryValue& properties,
90 const base::Closure& callback, 107 const base::Closure& callback,
91 const ErrorCallback& error_callback) = 0; 108 const ErrorCallback& error_callback) = 0;
92 109
93 // Calls GetService method. 110 // Calls GetService method.
94 // |callback| is called after the method call succeeds. 111 // |callback| is called after the method call succeeds.
95 virtual void GetService(const base::DictionaryValue& properties, 112 virtual void GetService(const base::DictionaryValue& properties,
96 const ObjectPathCallback& callback, 113 const ObjectPathCallback& callback,
97 const ErrorCallback& error_callback) = 0; 114 const ErrorCallback& error_callback) = 0;
98 115
116 // Returns an interface for testing (stub only), or returns NULL.
117 virtual TestInterface* GetTestInterface() = 0;
118
99 protected: 119 protected:
100 // Create() should be used instead. 120 // Create() should be used instead.
101 ShillManagerClient(); 121 ShillManagerClient();
102 122
103 private: 123 private:
104 DISALLOW_COPY_AND_ASSIGN(ShillManagerClient); 124 DISALLOW_COPY_AND_ASSIGN(ShillManagerClient);
105 }; 125 };
106 126
107 } // namespace chromeos 127 } // namespace chromeos
108 128
109 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_ 129 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698