Index: ui/base/animation/animation_container.cc |
diff --git a/ui/base/animation/animation_container.cc b/ui/base/animation/animation_container.cc |
index c82d26b9aa5048ea9cdd69b7b7a389dfdb08eebe..f404b7bfbf25e221a27c774d961350787feb5dbc 100644 |
--- a/ui/base/animation/animation_container.cc |
+++ b/ui/base/animation/animation_container.cc |
@@ -14,7 +14,8 @@ namespace ui { |
AnimationContainer::AnimationContainer() |
: last_tick_time_(TimeTicks::Now()), |
- observer_(NULL) { |
+ observer_(NULL), |
+ test_timing_enabled_(false) { |
} |
AnimationContainer::~AnimationContainer() { |
@@ -28,7 +29,7 @@ void AnimationContainer::Start(AnimationContainerElement* element) { |
// element isn't running. |
if (elements_.empty()) { |
- last_tick_time_ = TimeTicks::Now(); |
+ last_tick_time_ = GetCurrentTime(); |
SetMinTimerInterval(element->GetTimerInterval()); |
} else if (element->GetTimerInterval() < min_timer_interval_) { |
SetMinTimerInterval(element->GetTimerInterval()); |
@@ -61,7 +62,7 @@ void AnimationContainer::Run() { |
// ourself here to make sure we're still valid after running all the elements. |
scoped_refptr<AnimationContainer> this_ref(this); |
- TimeTicks current_time = TimeTicks::Now(); |
+ TimeTicks current_time = GetCurrentTime(); |
last_tick_time_ = current_time; |
@@ -101,4 +102,10 @@ TimeDelta AnimationContainer::GetMinInterval() { |
return min; |
} |
+TimeTicks AnimationContainer::GetCurrentTime() { |
+ if (test_timing_enabled_) |
+ return test_time_; |
+ return TimeTicks::Now(); |
+} |
+ |
} // namespace ui |