Index: chromeos/dbus/fake_bluetooth_media_transport_client.h |
diff --git a/chromeos/dbus/fake_bluetooth_media_transport_client.h b/chromeos/dbus/fake_bluetooth_media_transport_client.h |
index 319b2ae3c4e0518d527936f0c323e82f87d71856..eebbea89baf98315a863735d8a05f95bd75b2c6c 100644 |
--- a/chromeos/dbus/fake_bluetooth_media_transport_client.h |
+++ b/chromeos/dbus/fake_bluetooth_media_transport_client.h |
@@ -9,6 +9,7 @@ |
#include <string> |
#include <vector> |
+#include "base/files/file.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
#include "chromeos/chromeos_export.h" |
@@ -76,18 +77,19 @@ class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient |
void SetVolume(const dbus::ObjectPath& endpoint_path, |
const uint16_t& volume); |
- // Gets the transport path associated with the given endpoint path. |
- dbus::ObjectPath GetTransportPath(const dbus::ObjectPath& endpoint_path); |
+ // Writes bytes to the input file descriptor, |input_fd|, associated with a |
+ // transport object which is bound to |endpoint_path|. |
+ void WriteData(const dbus::ObjectPath& endpoint_path, |
+ const std::vector<char>& bytes); |
- // Gets the endpoint path associated with the given transport_path. |
- dbus::ObjectPath GetEndpointPath(const dbus::ObjectPath& transport_path); |
+ // Retrieves the transport object path bound to |endpoint_path|. |
+ dbus::ObjectPath GetTransportPath(const dbus::ObjectPath& endpoint_path); |
private: |
// This class is used for simulating the scenario where each media endpoint |
// has a corresponding transport path and properties. Once an endpoint is |
// assigned with a transport path, an object of Transport is created. |
- class Transport { |
- public: |
+ struct Transport { |
Transport(const dbus::ObjectPath& transport_path, |
Properties* transport_properties); |
~Transport(); |
@@ -97,11 +99,31 @@ class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient |
// The property set bound with |path|. |
scoped_ptr<Properties> properties; |
+ |
+ // This is the internal end of socketpair created for simulation purposes. |
+ // |input_fd| will be initialized when Acquire/TryAcquire is called. |
+ scoped_ptr<base::File> input_fd; |
}; |
// Property callback passed while a Properties structure is created. |
void OnPropertyChanged(const std::string& property_name); |
+ // Gets the endpoint path associated with the given transport_path. |
+ dbus::ObjectPath GetEndpointPath(const dbus::ObjectPath& transport_path); |
+ |
+ // Retrieves the transport structure bound to |endpoint_path|. |
+ Transport* GetTransport(const dbus::ObjectPath& endpoint_path); |
+ |
+ // Retrieves the transport structure with |transport_path|. |
+ Transport* GetTransportByPath(const dbus::ObjectPath& transport_path); |
+ |
+ // Helper function used by Acquire and TryAcquire to set up the sockpair and |
+ // invoke callback/error_callback. |
+ void AcquireInternal(bool try_flag, |
+ const dbus::ObjectPath& object_path, |
+ const AcquireCallback& callback, |
+ const ErrorCallback& error_callback); |
+ |
// Map of endpoints with valid transport. Each pair is composed of an endpoint |
// path and a Transport structure containing a transport path and its |
// properties. |
@@ -112,9 +134,6 @@ class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient |
// corresponding endpoint path when GetProperties() is called. |
std::map<dbus::ObjectPath, dbus::ObjectPath> transport_to_endpoint_map_; |
- // The path of the media transport object. |
- dbus::ObjectPath object_path_; |
- |
ObserverList<BluetoothMediaTransportClient::Observer> observers_; |
DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient); |