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..392c000d96fd0a88b62b1f1fa0835548f72d3fdd 100644 |
| --- a/chromeos/dbus/fake_bluetooth_media_client.cc |
| +++ b/chromeos/dbus/fake_bluetooth_media_client.cc |
| @@ -4,6 +4,22 @@ |
| #include "chromeos/dbus/fake_bluetooth_media_client.h" |
| +#include <string> |
| + |
| +#include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
| + |
| +namespace { |
| + |
| +// The default codec is SBC(0x00). |
| +const uint8_t kDefaultCodec = 0x00; |
|
armansito
2015/01/29 04:22:55
I'd move this to the header as a static const clas
Miao
2015/01/29 23:58:38
Done.
|
| + |
| +// Except for |kError|, the other two erros are defined in BlueZ D-Bus Media |
| +// API. |
| +const char kFailedError[] = "org.chromium.Error.Failed"; |
| +const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments"; |
| + |
| +} // namespace |
| + |
| namespace chromeos { |
| FakeBluetoothMediaClient::FakeBluetoothMediaClient() { |
| @@ -27,23 +43,31 @@ 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) || |
| + properties.uuid != BluetoothMediaClient::kBluetoothAudioSinkUUID || |
| + properties.codec != kDefaultCodec || |
| + properties.capabilities.empty()) { |
| + error_callback.Run(kInvalidArgumentsError, ""); |
| + 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", ""); |
|
armansito
2015/01/29 04:22:55
Add a TODO here for making this do something meani
Miao
2015/01/29 23:58:38
Done.
|
| + error_callback.Run(kFailedError, ""); |
| } |
| } // namespace chromeos |