Chromium Code Reviews| 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..75646010c059d67aaada8769951efe51d357167b 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 AcquireDelegate(bool try_flag, |
|
armansito
2015/03/13 01:31:42
I'd rename this to AcquireInternal to be more cons
Miao
2015/03/13 19:20:59
Done.
|
| + 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); |