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

Side by Side Diff: chromeos/dbus/fake_bluetooth_profile_manager_client.h

Issue 14487002: Bluetooth: Profile support for Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit tests, and class comments Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_PROFILE_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
7 7
8 #include <map>
9 #include <string>
10
8 #include "base/bind.h" 11 #include "base/bind.h"
9 #include "base/callback.h" 12 #include "base/callback.h"
10 #include "base/observer_list.h" 13 #include "base/observer_list.h"
11 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_client_implementation_type.h" 15 #include "chromeos/dbus/dbus_client_implementation_type.h"
13 #include "chromeos/dbus/experimental_bluetooth_profile_manager_client.h" 16 #include "chromeos/dbus/experimental_bluetooth_profile_manager_client.h"
14 #include "dbus/object_path.h" 17 #include "dbus/object_path.h"
15 #include "dbus/property.h" 18 #include "dbus/property.h"
16 19
17 namespace chromeos { 20 namespace chromeos {
18 21
22 class FakeBluetoothProfileServiceProvider;
23
19 // FakeBluetoothProfileManagerClient simulates the behavior of the Bluetooth 24 // FakeBluetoothProfileManagerClient simulates the behavior of the Bluetooth
20 // Daemon's profile manager object and is used both in test cases in place of a 25 // Daemon's profile manager object and is used both in test cases in place of a
21 // mock and on the Linux desktop. 26 // mock and on the Linux desktop.
22 class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient 27 class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient
23 : public ExperimentalBluetoothProfileManagerClient { 28 : public ExperimentalBluetoothProfileManagerClient {
24 public: 29 public:
25 FakeBluetoothProfileManagerClient(); 30 FakeBluetoothProfileManagerClient();
26 virtual ~FakeBluetoothProfileManagerClient(); 31 virtual ~FakeBluetoothProfileManagerClient();
27 32
28 // ExperimentalBluetoothProfileManagerClient override 33 // ExperimentalBluetoothProfileManagerClient override
29 virtual void RegisterProfile(const dbus::ObjectPath& profile_path, 34 virtual void RegisterProfile(const dbus::ObjectPath& profile_path,
30 const std::string& uuid, 35 const std::string& uuid,
31 const Options& options, 36 const Options& options,
32 const base::Closure& callback, 37 const base::Closure& callback,
33 const ErrorCallback& error_callback) OVERRIDE; 38 const ErrorCallback& error_callback) OVERRIDE;
34 virtual void UnregisterProfile(const dbus::ObjectPath& profile_path, 39 virtual void UnregisterProfile(const dbus::ObjectPath& profile_path,
35 const base::Closure& callback, 40 const base::Closure& callback,
36 const ErrorCallback& error_callback) OVERRIDE; 41 const ErrorCallback& error_callback) OVERRIDE;
42
43 // Register, unregister and retrieve pointers to profile server providers.
44 void RegisterProfileServiceProvider(
45 FakeBluetoothProfileServiceProvider* service_provider);
46 void UnregisterProfileServiceProvider(
47 FakeBluetoothProfileServiceProvider* service_provider);
48 FakeBluetoothProfileServiceProvider* GetProfileServiceProvider(
49 const std::string& uuid);
50
51 // UUIDs recognised for testing.
52 static const char kL2capUuid[];
53 static const char kRfcommUuid[];
54
55 private:
56 // Map of a D-Bus object path to the FakeBluetoothProfileServiceProvider
57 // registered for it; maintained by RegisterProfileServiceProvider() and
58 // UnregisterProfileServiceProvicer() called by the constructor and
59 // destructor of FakeBluetoothProfileServiceProvider.
60 typedef std::map<dbus::ObjectPath, FakeBluetoothProfileServiceProvider*>
61 ServiceProviderMap;
62 ServiceProviderMap service_provider_map_;
63
64 // Map of Profile UUID to the D-Bus object path of the service provider
65 // in |service_provider_map_|. Maintained by RegisterProfile() and
66 // UnregisterProfile() in response to BluetoothProfile methods.
67 typedef std::map<std::string, dbus::ObjectPath> ProfileMap;
68 ProfileMap profile_map_;
37 }; 69 };
38 70
39 } // namespace chromeos 71 } // namespace chromeos
40 72
41 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_ 73 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_bluetooth_device_client.cc ('k') | chromeos/dbus/fake_bluetooth_profile_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698