Chromium Code Reviews| Index: chromeos/dbus/fake_bluetooth_media_client.cc |
| diff --git a/chromeos/dbus/fake_bluetooth_media_client.cc b/chromeos/dbus/fake_bluetooth_media_client.cc |
| index 3e57b91f439b858851fe17f5532d4b8d8440f12e..b6b9f27b7a5e6dd301efceab0c02fcbee22d4260 100644 |
| --- a/chromeos/dbus/fake_bluetooth_media_client.cc |
| +++ b/chromeos/dbus/fake_bluetooth_media_client.cc |
| @@ -4,6 +4,21 @@ |
| #include "chromeos/dbus/fake_bluetooth_media_client.h" |
| +#include <string> |
| + |
| +#include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
| + |
| +namespace { |
| + |
| +// The UUID for Bluetooth audio sink service. |
| +const char kBluetoothAudioSinkUUID[] = "0000110b-0000-1000-8000-00805f9b34fb"; |
|
Ben Chan
2015/01/28 15:54:27
do you expect to have a TODO to move these constan
Miao
2015/01/28 22:34:20
kBluetoothAudioSinkUUID will be placed in Bluetoot
|
| + |
| +const char kAdapterNotFoundError[] = "org.chromium.Error.AdapterNotFound"; |
| +const char kNotImplementedError[] = "org.chromium.Error.NotImplemented"; |
| +const char kInvalidArgumentError[] = "org.chromium.Error.InvalidArgument"; |
| + |
| +} // namespace |
| + |
| namespace chromeos { |
| FakeBluetoothMediaClient::FakeBluetoothMediaClient() { |
| @@ -27,23 +42,35 @@ void FakeBluetoothMediaClient::RemoveObserver( |
| observers_.RemoveObserver(observer); |
| } |
| -// TODO(mcchou): Add method definition for |RegisterEndpoint|, |
| -// |UnregisterEndpoint|, |RegisterPlayer| and |UnregisterPlayer|. |
| void FakeBluetoothMediaClient::RegisterEndpoint( |
| - const dbus::ObjectPath& object_path, |
| - const dbus::ObjectPath& endpoint_path, |
| + const ObjectPath& object_path, |
| + const ObjectPath& endpoint_path, |
| const EndpointProperties& properties, |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| - error_callback.Run("org.bluez.NotImplemented", ""); |
| + VLOG(1) << "RegisterEndpoint: " << endpoint_path.value(); |
| + |
| + // The object paths of the media client and adapter client should be the same. |
| + if (object_path != ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)) { |
| + error_callback.Run(kAdapterNotFoundError, ""); |
| + return; |
| + } |
| + |
| + if (properties.uuid != std::string(kBluetoothAudioSinkUUID) || |
|
Ben Chan
2015/01/28 15:54:27
EndpointProperties.uuid is a std::string, so std::
Miao
2015/01/28 22:34:20
Done.
|
| + properties.codec != 0x00 || |
|
Ben Chan
2015/01/28 15:54:27
perhaps define 0x00 as something like kDefaultCode
Miao
2015/01/28 22:34:20
kDefaultCodec added.
|
| + properties.capabilities.empty()) { |
| + error_callback.Run(kInvalidArgumentError, ""); |
| + return; |
| + } |
| + callback.Run(); |
| } |
| void FakeBluetoothMediaClient::UnregisterEndpoint( |
| - const dbus::ObjectPath& object_path, |
| - const dbus::ObjectPath& endpoint_path, |
| + const ObjectPath& object_path, |
| + const ObjectPath& endpoint_path, |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| - error_callback.Run("org.bluez.NotImplemented", ""); |
| + error_callback.Run(kNotImplementedError, ""); |
| } |
| } // namespace chromeos |