Chromium Code Reviews| Index: chromeos/dbus/fake_bluetooth_advertisement_manager_client.h |
| diff --git a/chromeos/dbus/fake_bluetooth_advertisement_manager_client.h b/chromeos/dbus/fake_bluetooth_advertisement_manager_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bab7c0971cdb297ef0e271f4e542805c960fc4df |
| --- /dev/null |
| +++ b/chromeos/dbus/fake_bluetooth_advertisement_manager_client.h |
| @@ -0,0 +1,80 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_MANAGER_CLIENT_H_ |
| +#define CHROMEOS_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_MANAGER_CLIENT_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/bind.h" |
| +#include "base/callback.h" |
| +#include "base/observer_list.h" |
| +#include "chromeos/chromeos_export.h" |
| +#include "chromeos/dbus/bluetooth_advertisement_manager_client.h" |
| +#include "dbus/object_path.h" |
| +#include "dbus/property.h" |
| + |
| +namespace chromeos { |
| + |
| +class FakeBluetoothAdvertisementServiceProvider; |
| + |
| +// FakeBluetoothAdvertisementManagerClient simulates the behavior of the |
| +// Bluetooth |
| +// Daemon's profile manager object and is used both in test cases in place of a |
| +// mock and on the Linux desktop. |
| +class CHROMEOS_EXPORT FakeBluetoothAdvertisementManagerClient |
| + : public BluetoothAdvertisementManagerClient { |
| + public: |
| + FakeBluetoothAdvertisementManagerClient(); |
| + ~FakeBluetoothAdvertisementManagerClient() override; |
| + |
| + // DBusClient overrides: |
| + void Init(dbus::Bus* bus) override {} |
| + |
| + // BluetoothAdvertisingManagerClient overrides: |
| + void RegisterAdvertisement(const dbus::ObjectPath& obj_path, |
| + const base::Closure& callback, |
| + const ErrorCallback& error_callback) override; |
| + |
| + // Unregisters an advertisement with the DBus object path |obj_path| with |
| + // BlueZ's advertisement manager. |
| + void UnregisterAdvertisement(const dbus::ObjectPath& profile_path, |
| + const base::Closure& callback, |
| + const ErrorCallback& error_callback) override; |
| + |
| + // Register, unregister and retrieve pointers to profile server providers. |
| + void RegisterAdvertisementServiceProvider( |
| + FakeBluetoothAdvertisementServiceProvider* service_provider); |
| + void UnregisterAdvertisementServiceProvider( |
| + FakeBluetoothAdvertisementServiceProvider* service_provider); |
| + FakeBluetoothAdvertisementServiceProvider* GetAdvertisementServiceProvider( |
| + const std::string& uuid); |
| + |
| + // UUIDs recognised for testing. |
| + static const char kL2capUuid[]; |
| + static const char kRfcommUuid[]; |
|
armansito
2015/04/09 22:08:33
There's no L2CAP/RFCOMM UUID in LE. Put proper ser
rkc
2015/04/13 19:47:46
Unused, removed.
|
| + static const char kUnregisterableUuid[]; |
| + |
| + private: |
| + // Map of a D-Bus object path to the FakeBluetoothAdvertisementServiceProvider |
| + // registered for it; maintained by RegisterAdvertisementServiceProvider() and |
| + // UnregisterProfileServiceProvicer() called by the constructor and |
| + // destructor of FakeBluetoothAdvertisementServiceProvider. |
| + typedef std::map<dbus::ObjectPath, FakeBluetoothAdvertisementServiceProvider*> |
| + ServiceProviderMap; |
| + ServiceProviderMap service_provider_map_; |
| + |
| + std::string currently_registered_; |
| + |
| + // Map of Profile UUID to the D-Bus object path of the service provider |
| + // in |service_provider_map_|. Maintained by RegisterProfile() and |
| + // UnregisterProfile() in response to BluetoothProfile methods. |
| + typedef std::map<std::string, dbus::ObjectPath> ProfileMap; |
| + ProfileMap profile_map_; |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_MANAGER_CLIENT_H_ |