widget_animation_smoothness_inspector.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2020 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_SHELF_TEST_WIDGET_ANIMATION_SMOOTHNESS_INSPECTOR_H_
  5. #define ASH_SHELF_TEST_WIDGET_ANIMATION_SMOOTHNESS_INSPECTOR_H_
  6. #include "ui/compositor/layer_animation_observer.h"
  7. namespace views {
  8. class Widget;
  9. }
  10. namespace ash {
  11. // TOOD(manucornet): This class will perform its intended purpose only after
  12. // the new API for layer aimation sequence observers lands.
  13. class WidgetAnimationSmoothnessInspector : ui::LayerAnimationObserver {
  14. public:
  15. explicit WidgetAnimationSmoothnessInspector(views::Widget* widget);
  16. ~WidgetAnimationSmoothnessInspector() override;
  17. // Returns whether the animation had at least |min_steps| steps (including
  18. // the initial and final steps), going smoothly from the initial state
  19. // to the final state.
  20. bool CheckAnimation(unsigned int min_steps) const;
  21. // ui::LayerAnimationObserver:
  22. void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override;
  23. void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override;
  24. void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override;
  25. // TOOD(manucornet): Make this an override once the new API for layer
  26. // aimation sequence observers is in.
  27. void OnLayerAnimationProgressed(const ui::LayerAnimationSequence* sequence);
  28. private:
  29. // Unowned
  30. views::Widget* widget_;
  31. std::vector<gfx::Rect> bound_history_;
  32. };
  33. } // namespace ash
  34. #endif // ASH_SHELF_TEST_WIDGET_ANIMATION_SMOOTHNESS_INSPECTOR_H_