blob: c1426064d56d926e2b38ec467f241ca54814c462 [file] [log] [blame]
[email protected]896619e2013-04-18 04:41:421// 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
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
6#define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
7
[email protected]e882d2c2013-05-09 03:49:188#include <map>
9#include <string>
10
[email protected]896619e2013-04-18 04:41:4211#include "base/bind.h"
12#include "base/callback.h"
13#include "base/observer_list.h"
14#include "chromeos/chromeos_export.h"
[email protected]627f4f42013-06-12 14:47:3215#include "chromeos/dbus/bluetooth_profile_manager_client.h"
[email protected]896619e2013-04-18 04:41:4216#include "dbus/object_path.h"
17#include "dbus/property.h"
18
19namespace chromeos {
20
[email protected]e882d2c2013-05-09 03:49:1821class FakeBluetoothProfileServiceProvider;
22
[email protected]896619e2013-04-18 04:41:4223// FakeBluetoothProfileManagerClient simulates the behavior of the Bluetooth
24// Daemon's profile manager object and is used both in test cases in place of a
25// mock and on the Linux desktop.
26class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient
[email protected]627f4f42013-06-12 14:47:3227 : public BluetoothProfileManagerClient {
[email protected]896619e2013-04-18 04:41:4228 public:
29 FakeBluetoothProfileManagerClient();
dcheng0280cb62015-01-16 07:37:5030 ~FakeBluetoothProfileManagerClient() override;
[email protected]896619e2013-04-18 04:41:4231
[email protected]c5fd5362013-08-27 12:23:0432 // BluetoothProfileManagerClient overrides
dcheng0280cb62015-01-16 07:37:5033 void Init(dbus::Bus* bus) override;
34 void RegisterProfile(const dbus::ObjectPath& profile_path,
35 const std::string& uuid,
36 const Options& options,
37 const base::Closure& callback,
38 const ErrorCallback& error_callback) override;
39 void UnregisterProfile(const dbus::ObjectPath& profile_path,
40 const base::Closure& callback,
41 const ErrorCallback& error_callback) override;
[email protected]e882d2c2013-05-09 03:49:1842
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[];
jamuraa202fef42015-03-09 20:20:2254 static const char kUnregisterableUuid[];
[email protected]e882d2c2013-05-09 03:49:1855
56 private:
57 // Map of a D-Bus object path to the FakeBluetoothProfileServiceProvider
58 // registered for it; maintained by RegisterProfileServiceProvider() and
59 // UnregisterProfileServiceProvicer() called by the constructor and
60 // destructor of FakeBluetoothProfileServiceProvider.
61 typedef std::map<dbus::ObjectPath, FakeBluetoothProfileServiceProvider*>
62 ServiceProviderMap;
63 ServiceProviderMap service_provider_map_;
64
65 // Map of Profile UUID to the D-Bus object path of the service provider
66 // in |service_provider_map_|. Maintained by RegisterProfile() and
67 // UnregisterProfile() in response to BluetoothProfile methods.
68 typedef std::map<std::string, dbus::ObjectPath> ProfileMap;
69 ProfileMap profile_map_;
[email protected]896619e2013-04-18 04:41:4270};
71
72} // namespace chromeos
73
[email protected]435605a2013-04-23 16:45:4274#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_