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 58c4fdffca7216a319e3292fc49e4f457677123e..ac9df3d469fb042686b0c83b479160ee168625f7 100644 |
| --- a/chromeos/dbus/fake_bluetooth_media_client.cc |
| +++ b/chromeos/dbus/fake_bluetooth_media_client.cc |
| @@ -80,7 +80,15 @@ void FakeBluetoothMediaClient::UnregisterEndpoint( |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) { |
| // TODO(mcchou): Come up with some corresponding actions. |
| - error_callback.Run(kFailedError, ""); |
| + VLOG(1) << "UnregisterEndpoint: " << endpoint_path.value(); |
| + |
| + if (endpoints_.find(endpoint_path) == endpoints_.end()) { |
|
Ben Chan
2015/02/19 00:21:45
see ContainsKey in src/base/stl_util.h
Miao
2015/02/23 21:04:24
Done.
|
| + error_callback.Run(kFailedError, "Unknown media endpoint"); |
| + return; |
| + } |
| + |
| + SetEndpointRegistered(endpoint_path, false); |
| + callback.Run(); |
| } |
| void FakeBluetoothMediaClient::SetVisible(bool visible) { |
| @@ -96,6 +104,7 @@ void FakeBluetoothMediaClient::SetVisible(bool visible) { |
| it != endpoints_.end(); ++it) { |
| SetEndpointRegistered(it->first, false); |
| } |
| + |
| endpoints_.clear(); |
| // Notifies observers about the change on |visible_|. |
| @@ -114,7 +123,7 @@ void FakeBluetoothMediaClient::SetEndpointRegistered( |
| FakeBluetoothMediaTransportClient* transport = |
| static_cast<FakeBluetoothMediaTransportClient*>( |
| DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); |
| - transport->SetValid(endpoint_path, true); |
| + transport->SetValid(endpoint_path, false); |
| } |
| } |