multi_layer_animator_test_controller.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2016 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_MULTI_LAYER_ANIMATOR_TEST_CONTROLLER_H_
  5. #define UI_COMPOSITOR_TEST_MULTI_LAYER_ANIMATOR_TEST_CONTROLLER_H_
  6. #include <vector>
  7. #include "base/memory/raw_ptr.h"
  8. #include "base/time/time.h"
  9. namespace ui {
  10. class LayerAnimator;
  11. namespace test {
  12. class MultiLayerAnimatorTestControllerDelegate;
  13. // Test API class to control multiple LayerAnimators.
  14. class MultiLayerAnimatorTestController {
  15. public:
  16. explicit MultiLayerAnimatorTestController(
  17. MultiLayerAnimatorTestControllerDelegate* delegate);
  18. MultiLayerAnimatorTestController(const MultiLayerAnimatorTestController&) =
  19. delete;
  20. MultiLayerAnimatorTestController& operator=(
  21. const MultiLayerAnimatorTestController&) = delete;
  22. virtual ~MultiLayerAnimatorTestController();
  23. // Disables the animation timers when |disable_timers| is true.
  24. void SetDisableAnimationTimers(bool disable_timers);
  25. // Returns true if any animations are active.
  26. bool HasActiveAnimations() const;
  27. // Completes all running animations.
  28. void CompleteAnimations();
  29. private:
  30. // Get a list of all the LayerAnimator's used. Delegates to |delegate_|.
  31. std::vector<LayerAnimator*> GetLayerAnimators();
  32. std::vector<LayerAnimator*> GetLayerAnimators() const;
  33. // Progresses all running LayerAnimationSequences by the given |duration|.
  34. //
  35. // NOTE: This function will NOT progress LayerAnimationSequences that are
  36. // queued, only the running ones will be progressed.
  37. void StepAnimations(const base::TimeDelta& duration);
  38. raw_ptr<MultiLayerAnimatorTestControllerDelegate> delegate_;
  39. };
  40. } // namespace test
  41. } // namespace ui
  42. #endif // UI_COMPOSITOR_TEST_MULTI_LAYER_ANIMATOR_TEST_CONTROLLER_H_