test_utils.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright (c) 2012 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 UI_COMPOSITOR_TEST_TEST_UTILS_H_
  5. #define UI_COMPOSITOR_TEST_TEST_UTILS_H_
  6. #include "base/time/time.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace gfx {
  9. class Rect;
  10. class RoundedCornersF;
  11. class Transform;
  12. }
  13. namespace ui {
  14. class Compositor;
  15. void CheckApproximatelyEqual(const gfx::Transform& lhs,
  16. const gfx::Transform& rhs);
  17. void CheckApproximatelyEqual(const gfx::Rect& lhs, const gfx::Rect& rhs);
  18. void CheckApproximatelyEqual(const gfx::RoundedCornersF& lhs,
  19. const gfx::RoundedCornersF& rhs);
  20. // Runs a RunLoop until the next frame is presented with an optional timeout.
  21. // Returns true if a frame is presented. Otherwise, returns false.
  22. [[nodiscard]] bool WaitForNextFrameToBePresented(
  23. ui::Compositor* compositor,
  24. absl::optional<base::TimeDelta> timeout = absl::nullopt);
  25. } // namespace ui
  26. #endif // UI_COMPOSITOR_TEST_TEST_UTILS_H_