fake_bluetooth_hid_detector.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2022 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 ASH_COMPONENTS_HID_DETECTION_FAKE_BLUETOOTH_HID_DETECTOR_H_
  5. #define ASH_COMPONENTS_HID_DETECTION_FAKE_BLUETOOTH_HID_DETECTOR_H_
  6. #include "ash/components/hid_detection/bluetooth_hid_detector.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace ash::hid_detection {
  9. class FakeBluetoothHidDetector : public BluetoothHidDetector {
  10. public:
  11. FakeBluetoothHidDetector();
  12. ~FakeBluetoothHidDetector() override;
  13. // BluetoothHidDetector:
  14. void SetInputDevicesStatus(InputDevicesStatus input_devices_status) override;
  15. const BluetoothHidDetectionStatus GetBluetoothHidDetectionStatus() override;
  16. void SimulatePairingStarted(
  17. BluetoothHidDetector::BluetoothHidMetadata pairing_device);
  18. void SetPairingState(absl::optional<BluetoothHidPairingState> pairing_state);
  19. void SimulatePairingSessionEnded();
  20. const InputDevicesStatus& input_devices_status() {
  21. return input_devices_status_;
  22. }
  23. size_t num_set_input_devices_status_calls() {
  24. return num_set_input_devices_status_calls_;
  25. }
  26. bool is_bluetooth_hid_detection_active() {
  27. return is_bluetooth_hid_detection_active_;
  28. }
  29. bool is_using_bluetooth() { return is_using_bluetooth_; }
  30. private:
  31. // BluetoothHidDetector:
  32. void PerformStartBluetoothHidDetection(
  33. InputDevicesStatus input_devices_status) override;
  34. void PerformStopBluetoothHidDetection(bool is_using_bluetooth) override;
  35. InputDevicesStatus input_devices_status_;
  36. size_t num_set_input_devices_status_calls_ = 0;
  37. absl::optional<BluetoothHidMetadata> current_pairing_device_;
  38. absl::optional<BluetoothHidPairingState> current_pairing_state_;
  39. bool is_bluetooth_hid_detection_active_ = false;
  40. bool is_using_bluetooth_ = false;
  41. };
  42. } // namespace ash::hid_detection
  43. #endif // ASH_COMPONENTS_HID_DETECTION_FAKE_BLUETOOTH_HID_DETECTOR_H_