Index: ui/base/animation/animation_container_test_helper.cc |
diff --git a/ui/base/animation/animation_container_test_helper.cc b/ui/base/animation/animation_container_test_helper.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b695bd1e955d0220ec3d1a30893ea4e0df6a3088 |
--- /dev/null |
+++ b/ui/base/animation/animation_container_test_helper.cc |
@@ -0,0 +1,37 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/base/animation/animation_container_test_helper.h" |
+ |
+using base::TimeDelta; |
+using base::TimeTicks; |
+ |
+namespace ui { |
+namespace test { |
+ |
+AnimationContainerTestHelper::AnimationContainerTestHelper( |
+ AnimationContainer* container) |
+ : container_(container) { |
+} |
+ |
+AnimationContainerTestHelper::~AnimationContainerTestHelper() { |
+} |
+ |
+void AnimationContainerTestHelper::Advance(TimeDelta delta) { |
+ time_controller_.Advance(delta); |
+ if (IsAnimating()) |
+ container_->Run(); |
+} |
+ |
+void AnimationContainerTestHelper::AdvanceUntilDone() { |
+ while (IsAnimating()) |
+ Advance(TimeDelta::FromSeconds(1)); |
+} |
+ |
+bool AnimationContainerTestHelper::IsAnimating() { |
+ return container_->timer_.IsRunning(); |
+} |
+ |
+} // namespace test |
+} // namespace ui |