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/time.h" |
| 9 #include "ui/base/animation/animation_container.h" |
| 10 #include "ui/base/ui_export.h" |
| 11 |
| 12 namespace ui { |
| 13 namespace test { |
| 14 |
| 15 // This class can be used in tests for fine control over animations. |
| 16 |
| 17 class UI_EXPORT AnimationContainerTestHelper { |
| 18 public: |
| 19 // Creates helper for given container. Container is now driven by this |
| 20 // helper rather than by internal timer. |
| 21 explicit AnimationContainerTestHelper(AnimationContainer* container); |
| 22 virtual ~AnimationContainerTestHelper(); |
| 23 |
| 24 // Advances AnimationContainer for |delta|. |
| 25 void Forward(base::TimeDelta delta); |
| 26 |
| 27 // Returns if AnimationContainer is animating. |
| 28 bool IsAnimating(); |
| 29 |
| 30 // Forwards in large steps (1 second) while there are any animations running. |
| 31 // Use it before deleting Helper to avoid negative time delta in animations |
| 32 // once timer gets cleaned up. |
| 33 void ForwardWhileRunning(); |
| 34 |
| 35 // Calls Run method of Container without advancing time. Call this method once |
| 36 // some animations were added to container so that any immediate animations |
| 37 // get processed. |
| 38 void Ping(); |
| 39 |
| 40 private: |
| 41 AnimationContainer* container_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(AnimationContainerTestHelper); |
| 44 }; |
| 45 |
| 46 } // namespace test |
| 47 } // namespace ui |
| 48 |
| 49 #endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_TEST_HELPER_H_ |
OLD | NEW |