host_frame_sink_manager_test_api.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2018 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 COMPONENTS_VIZ_TEST_HOST_FRAME_SINK_MANAGER_TEST_API_H_
  5. #define COMPONENTS_VIZ_TEST_HOST_FRAME_SINK_MANAGER_TEST_API_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "components/viz/host/host_frame_sink_manager.h"
  8. namespace viz {
  9. // A test wrapper for HostFrameSinkManager. For use in unit testing, where the
  10. // Viz Host never instanciates Viz. Without Viz, HostFrameSinkManager can never
  11. // actually establish connections to compositor frame sinks.
  12. //
  13. // This allows for the explicit overriding of the hit test data with the
  14. // HostFrameSinkManager. So that unit tests can test event routing without Viz
  15. // providing the hit test data.
  16. class HostFrameSinkManagerTestApi {
  17. public:
  18. explicit HostFrameSinkManagerTestApi(
  19. HostFrameSinkManager* host_frame_sink_manager);
  20. HostFrameSinkManagerTestApi(const HostFrameSinkManagerTestApi&) = delete;
  21. HostFrameSinkManagerTestApi& operator=(const HostFrameSinkManagerTestApi&) =
  22. delete;
  23. ~HostFrameSinkManagerTestApi() = default;
  24. // Clears out the currently set hit test queries, and overrides it with |map|.
  25. // The HostFrameSinkManager will take ownership of |map|. There should only be
  26. // one HitTestQuery per root FrameSinkId.
  27. void SetDisplayHitTestQuery(HostFrameSinkManager::DisplayHitTestQueryMap map);
  28. private:
  29. // Not owned.
  30. raw_ptr<HostFrameSinkManager, DanglingUntriaged> host_frame_sink_manager_;
  31. };
  32. } // namespace viz
  33. #endif // COMPONENTS_VIZ_TEST_HOST_FRAME_SINK_MANAGER_TEST_API_H_