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

Unified Diff: chromeos/dbus/fake_bluetooth_media_transport_client.h

Issue 939753004: device/bluetooth: Implement Unregister() of BlueotoothAudioSinkChromeOS and disconnection-related c… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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/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 f88908f6111db8919c39632a6bac9022d075118a..319b2ae3c4e0518d527936f0c323e82f87d71856 100644
--- a/chromeos/dbus/fake_bluetooth_media_transport_client.h
+++ b/chromeos/dbus/fake_bluetooth_media_transport_client.h
@@ -17,6 +17,8 @@
namespace chromeos {
+class FakeBluetoothMediaEndpointServiceProvider;
+
class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
: public BluetoothMediaTransportClient {
public:
@@ -62,23 +64,56 @@ class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
const base::Closure& callback,
const ErrorCallback& error_callback) override;
- // Makes the transport valid/invalid for a given media endpoint path. The
- // transport object is assigned to the given endpoint if valid is true, false
+ // Makes the transport valid/invalid for a given media endpoint. The transport
+ // object is assigned to the given endpoint if valid is true, false
// otherwise.
- void SetValid(const dbus::ObjectPath& endpoint_path, bool valid);
+ void SetValid(FakeBluetoothMediaEndpointServiceProvider* endpoint,
+ bool valid);
+
+ // Set state/volume property to a certain value.
+ void SetState(const dbus::ObjectPath& endpoint_path,
+ const std::string& state);
+ 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);
+
+ // Gets the endpoint path associated with the given transport_path.
+ dbus::ObjectPath GetEndpointPath(const dbus::ObjectPath& transport_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:
+ Transport(const dbus::ObjectPath& transport_path,
+ Properties* transport_properties);
+ ~Transport();
+
+ // An unique transport path.
+ dbus::ObjectPath path;
+
+ // The property set bound with |path|.
+ scoped_ptr<Properties> properties;
+ };
+
// Property callback passed while a Properties structure is created.
void OnPropertyChanged(const std::string& property_name);
- // The path of the media transport object.
- dbus::ObjectPath object_path_;
+ // 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.
+ std::map<dbus::ObjectPath, Transport*> endpoint_to_transport_map_;
- // Indicates whether endpoints are assigned with the transport object.
- std::map<dbus::ObjectPath, bool> endpoints_;
+ // Map of valid transports. Each pair is composed of a transport path as the
+ // key and an endpoint path as the value. This map is used to get the
+ // corresponding endpoint path when GetProperties() is called.
+ std::map<dbus::ObjectPath, dbus::ObjectPath> transport_to_endpoint_map_;
- // The fake property set of the media transport object.
- scoped_ptr<Properties> properties_;
+ // The path of the media transport object.
+ dbus::ObjectPath object_path_;
ObserverList<BluetoothMediaTransportClient::Observer> observers_;

Powered by Google App Engine
This is Rietveld 408576698