fake_hid_detection_manager.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_HID_DETECTION_MANAGER_H_
  5. #define ASH_COMPONENTS_HID_DETECTION_FAKE_HID_DETECTION_MANAGER_H_
  6. #include "ash/components/hid_detection/hid_detection_manager.h"
  7. #include "base/callback.h"
  8. namespace ash::hid_detection {
  9. class FakeHidDetectionManager : public HidDetectionManager {
  10. public:
  11. FakeHidDetectionManager();
  12. ~FakeHidDetectionManager() override;
  13. // Mocks the HID detection status being updated.
  14. void SetHidStatusTouchscreenDetected(bool touchscreen_detected);
  15. void SetHidStatusPointerMetadata(InputMetadata metadata);
  16. void SetHidStatusKeyboardMetadata(InputMetadata metadata);
  17. void SetPairingState(absl::optional<BluetoothHidPairingState> pairing_state);
  18. bool is_hid_detection_active() const { return is_hid_detection_active_; }
  19. private:
  20. // HidDetectionManager:
  21. void GetIsHidDetectionRequired(
  22. base::OnceCallback<void(bool)> callback) override;
  23. void PerformStartHidDetection() override;
  24. void PerformStopHidDetection() override;
  25. HidDetectionManager::HidDetectionStatus ComputeHidDetectionStatus()
  26. const override;
  27. bool is_hid_detection_active_ = false;
  28. InputMetadata pointer_metadata_;
  29. InputMetadata keyboard_metadata_;
  30. bool touchscreen_detected_ = false;
  31. absl::optional<BluetoothHidPairingState> pairing_state_;
  32. };
  33. } // namespace ash::hid_detection
  34. #endif // ASH_COMPONENTS_HID_DETECTION_FAKE_HID_DETECTION_MANAGER_H_