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

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

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
(Empty)
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.
4
5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/bind.h"
12 #include "base/callback.h"
13 #include "base/observer_list.h"
14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
16 #include "dbus/object_path.h"
17 #include "dbus/property.h"
18
19 namespace chromeos {
20
21 class FakeBluetoothLEAdvertisementServiceProvider;
22
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;
32
33 // DBusClient overrides:
34 void Init(dbus::Bus* bus) override;
35
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;
48
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);
56
57 // Advertising manager path that we simulate.
58 static const char kAdvertisingManagerPath[];
59
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_;
69
70 // Holds the currently registered advertisement. If there is no advertisement
71 // registered, this path is empty.
72 dbus::ObjectPath currently_registered_;
73
74 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisingManagerClient);
75 };
76
77 } // namespace chromeos
78
79 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698