Add some instrumentation for jank in URLRequest::Start.
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_le_advertising_manager_client.h
blobff340e8cffe5bfe2540afdc68cd80402a0371ddc
1 // Copyright 2015 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.
5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
8 #include <map>
9 #include <string>
11 #include "base/bind.h"
12 #include "base/callback.h"
13 #include "base/observer_list.h"
14 #include "bluetooth_le_advertising_manager_client.h"
15 #include "chromeos/chromeos_export.h"
16 #include "dbus/object_path.h"
17 #include "dbus/property.h"
19 namespace chromeos {
21 class FakeBluetoothLEAdvertisementServiceProvider;
23 // FakeBluetoothAdvertisementManagerClient simulates the behavior of the
24 // Bluetooth
25 // Daemon's profile manager object and is used both in test cases in place of a
26 // mock and on the Linux desktop.
27 class CHROMEOS_EXPORT FakeBluetoothLEAdvertisingManagerClient
28 : public BluetoothLEAdvertisingManagerClient {
29 public:
30 FakeBluetoothLEAdvertisingManagerClient();
31 ~FakeBluetoothLEAdvertisingManagerClient() override;
33 // DBusClient overrides:
34 void Init(dbus::Bus* bus) override;
36 // BluetoothAdvertisingManagerClient overrides:
37 void AddObserver(Observer* observer) override;
38 void RemoveObserver(Observer* observer) override;
39 void RegisterAdvertisement(const dbus::ObjectPath& manager_object_path,
40 const dbus::ObjectPath& advertisement_object_path,
41 const base::Closure& callback,
42 const ErrorCallback& error_callback) override;
43 void UnregisterAdvertisement(
44 const dbus::ObjectPath& manager_object_path,
45 const dbus::ObjectPath& advertisement_object_path,
46 const base::Closure& callback,
47 const ErrorCallback& error_callback) override;
49 // Register, unregister and retrieve pointers to profile server providers.
50 void RegisterAdvertisementServiceProvider(
51 FakeBluetoothLEAdvertisementServiceProvider* service_provider);
52 void UnregisterAdvertisementServiceProvider(
53 FakeBluetoothLEAdvertisementServiceProvider* service_provider);
54 FakeBluetoothLEAdvertisementServiceProvider* GetAdvertisementServiceProvider(
55 const std::string& uuid);
57 // Advertising manager path that we simulate.
58 static const char kAdvertisingManagerPath[];
60 private:
61 // Map of a D-Bus object path to the FakeBluetoothAdvertisementServiceProvider
62 // registered for it; maintained by RegisterAdvertisementServiceProvider() and
63 // UnregisterProfileServiceProvicer() called by the constructor and
64 // destructor of FakeBluetoothAdvertisementServiceProvider.
65 typedef std::map<dbus::ObjectPath,
66 FakeBluetoothLEAdvertisementServiceProvider*>
67 ServiceProviderMap;
68 ServiceProviderMap service_provider_map_;
70 // Holds the currently registered advertisement. If there is no advertisement
71 // registered, this path is empty.
72 dbus::ObjectPath currently_registered_;
74 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisingManagerClient);
77 } // namespace chromeos
79 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_