fake_bluetooth_advertisement_monitor_application_service_provider.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2021 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. #ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_MONITOR_APPLICATION_SERVICE_PROVIDER_H_
  5. #define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_MONITOR_APPLICATION_SERVICE_PROVIDER_H_
  6. #include <string>
  7. #include "base/containers/flat_set.h"
  8. #include "dbus/object_path.h"
  9. #include "device/bluetooth/bluetooth_export.h"
  10. #include "device/bluetooth/dbus/bluetooth_advertisement_monitor_application_service_provider.h"
  11. #include "device/bluetooth/dbus/fake_bluetooth_advertisement_monitor_service_provider.h"
  12. namespace bluez {
  13. // FakeBluetoothAdvertisementMonitorApplicationServiceProvider simulates
  14. // behavior of an Advertisement Monitor Application Service Provider object and
  15. // is used in test cases.
  16. class DEVICE_BLUETOOTH_EXPORT
  17. FakeBluetoothAdvertisementMonitorApplicationServiceProvider
  18. : public BluetoothAdvertisementMonitorApplicationServiceProvider {
  19. public:
  20. explicit FakeBluetoothAdvertisementMonitorApplicationServiceProvider(
  21. const dbus::ObjectPath& object_path);
  22. FakeBluetoothAdvertisementMonitorApplicationServiceProvider(
  23. const FakeBluetoothAdvertisementMonitorApplicationServiceProvider&) =
  24. delete;
  25. FakeBluetoothAdvertisementMonitorApplicationServiceProvider& operator=(
  26. const FakeBluetoothAdvertisementMonitorApplicationServiceProvider&) =
  27. delete;
  28. ~FakeBluetoothAdvertisementMonitorApplicationServiceProvider() override;
  29. // BluetoothAdvertisementMonitorApplicationServiceProvider overrides:
  30. void AddMonitor(std::unique_ptr<BluetoothAdvertisementMonitorServiceProvider>
  31. advertisement_monitor_service_provider) override;
  32. void RemoveMonitor(const dbus::ObjectPath& monitor_path) override;
  33. size_t AdvertisementMonitorsCount() const;
  34. FakeBluetoothAdvertisementMonitorServiceProvider*
  35. GetLastAddedAdvertisementMonitorServiceProvider();
  36. private:
  37. // Key is the object path of the AdvertisementMonitorServiceProvider
  38. std::map<std::string,
  39. std::unique_ptr<BluetoothAdvertisementMonitorServiceProvider>>
  40. advertisement_monitor_providers_;
  41. std::string last_added_advertisement_monitor_provider_path_;
  42. };
  43. } // namespace bluez
  44. #endif // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_MONITOR_APPLICATION_SERVICE_PROVIDER_H_