OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 |
| 5 #ifndef UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_ |
| 6 #define UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_ |
| 7 |
| 8 #include "base/test/scoped_time_controller.h" |
| 9 #include "base/time.h" |
| 10 #include "ui/base/animation/animation_container.h" |
| 11 #include "ui/base/ui_export.h" |
| 12 |
| 13 namespace ui { |
| 14 namespace test { |
| 15 |
| 16 // This class can be used in tests for fine control over animations. |
| 17 |
| 18 class AnimationContainerTestHelper { |
| 19 public: |
| 20 // Creates helper for given container. Container is now driven by this |
| 21 // helper rather than by internal timer. |
| 22 explicit AnimationContainerTestHelper(AnimationContainer* container); |
| 23 |
| 24 ~AnimationContainerTestHelper(); |
| 25 |
| 26 // Advances AnimationContainer for |delta|. |
| 27 void Advance(base::TimeDelta delta); |
| 28 |
| 29 // Returns if AnimationContainer is animating. |
| 30 bool IsAnimating(); |
| 31 |
| 32 // Forwards in large steps (1 second) while there are any animations running. |
| 33 // Use it before deleting Helper to avoid negative time delta in animations |
| 34 // once timer gets cleaned up. |
| 35 void AdvanceUntilDone(); |
| 36 |
| 37 private: |
| 38 AnimationContainer* container_; |
| 39 |
| 40 base::test::ScopedTimeController time_controller_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(AnimationContainerTestHelper); |
| 43 }; |
| 44 |
| 45 } // namespace test |
| 46 } // namespace ui |
| 47 |
| 48 #endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_ |
OLD | NEW |