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

Side by Side 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: Revised helper functions in FakeBluetoothMediaClient and FakeBluetoothMediaTransportClient and modi… Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/bluetooth_media_transport_client.h" 15 #include "chromeos/dbus/bluetooth_media_transport_client.h"
16 #include "dbus/object_path.h" 16 #include "dbus/object_path.h"
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 class FakeBluetoothMediaEndpointServiceProvider;
21
20 class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient 22 class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
21 : public BluetoothMediaTransportClient { 23 : public BluetoothMediaTransportClient {
22 public: 24 public:
23 struct Properties : public BluetoothMediaTransportClient::Properties { 25 struct Properties : public BluetoothMediaTransportClient::Properties {
24 explicit Properties(const PropertyChangedCallback& callback); 26 explicit Properties(const PropertyChangedCallback& callback);
25 ~Properties() override; 27 ~Properties() override;
26 28
27 void Get(dbus::PropertyBase* property, 29 void Get(dbus::PropertyBase* property,
28 dbus::PropertySet::GetCallback callback) override; 30 dbus::PropertySet::GetCallback callback) override;
29 void GetAll() override; 31 void GetAll() override;
(...skipping 25 matching lines...) Expand all
55 void Acquire(const dbus::ObjectPath& object_path, 57 void Acquire(const dbus::ObjectPath& object_path,
56 const AcquireCallback& callback, 58 const AcquireCallback& callback,
57 const ErrorCallback& error_callback) override; 59 const ErrorCallback& error_callback) override;
58 void TryAcquire(const dbus::ObjectPath& object_path, 60 void TryAcquire(const dbus::ObjectPath& object_path,
59 const AcquireCallback& callback, 61 const AcquireCallback& callback,
60 const ErrorCallback& error_callback) override; 62 const ErrorCallback& error_callback) override;
61 void Release(const dbus::ObjectPath& object_path, 63 void Release(const dbus::ObjectPath& object_path,
62 const base::Closure& callback, 64 const base::Closure& callback,
63 const ErrorCallback& error_callback) override; 65 const ErrorCallback& error_callback) override;
64 66
65 // Makes the transport valid/invalid for a given media endpoint path. The 67 // Makes the transport valid/invalid for a given media endpoint. The transport
66 // transport object is assigned to the given endpoint if valid is true, false 68 // object is assigned to the given endpoint if valid is true, false
67 // otherwise. 69 // otherwise.
68 void SetValid(const dbus::ObjectPath& endpoint_path, bool valid); 70 void SetValid(FakeBluetoothMediaEndpointServiceProvider* endpoint,
71 bool valid);
72
73 // Gets the transport path associated with the given endpoint path.
74 dbus::ObjectPath GetTransportPath(dbus::ObjectPath endpoint_path);
armansito 2015/02/23 22:07:06 nit: Change argument type to "const dbus::ObjectPa
Miao 2015/02/24 01:12:12 Done.
69 75
70 private: 76 private:
71 // Property callback passed while a Properties structure is created. 77 // Property callback passed while a Properties structure is created.
72 void OnPropertyChanged(const std::string& property_name); 78 void OnPropertyChanged(const std::string& property_name);
73 79
80 // Map of endpoints with valid transport. Each pair is composed of an endpoint
81 // path and a transport path bound to that endpoint path.
82 std::map<dbus::ObjectPath, dbus::ObjectPath> endpoints_;
83
84 // The endpoint path associated with the transport object.
85 dbus::ObjectPath endpoint_path_;
86
74 // The path of the media transport object. 87 // The path of the media transport object.
75 dbus::ObjectPath object_path_; 88 dbus::ObjectPath object_path_;
76 89
77 // Indicates whether endpoints are assigned with the transport object.
78 std::map<dbus::ObjectPath, bool> endpoints_;
79
80 // The fake property set of the media transport object. 90 // The fake property set of the media transport object.
81 scoped_ptr<Properties> properties_; 91 scoped_ptr<Properties> properties_;
82 92
83 ObserverList<BluetoothMediaTransportClient::Observer> observers_; 93 ObserverList<BluetoothMediaTransportClient::Observer> observers_;
84 94
85 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient); 95 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient);
86 }; 96 };
87 97
88 } // namespace chromeos 98 } // namespace chromeos
89 99
90 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_ 100 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698