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 #include "ui/base/animation/animation_container_test_helper.h" |
| 6 |
| 7 using base::TimeDelta; |
| 8 using base::TimeTicks; |
| 9 |
| 10 namespace ui { |
| 11 namespace test { |
| 12 |
| 13 AnimationContainerTestHelper::AnimationContainerTestHelper( |
| 14 AnimationContainer* container) |
| 15 : container_(container) { |
| 16 } |
| 17 |
| 18 AnimationContainerTestHelper::~AnimationContainerTestHelper() { |
| 19 } |
| 20 |
| 21 void AnimationContainerTestHelper::Advance(TimeDelta delta) { |
| 22 time_controller_.Advance(delta); |
| 23 if (IsAnimating()) |
| 24 container_->Run(); |
| 25 } |
| 26 |
| 27 void AnimationContainerTestHelper::AdvanceUntilDone() { |
| 28 while (IsAnimating()) |
| 29 Advance(TimeDelta::FromSeconds(1)); |
| 30 } |
| 31 |
| 32 bool AnimationContainerTestHelper::IsAnimating() { |
| 33 return container_->timer_.IsRunning(); |
| 34 } |
| 35 |
| 36 } // namespace test |
| 37 } // namespace ui |
OLD | NEW |