Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: ui/compositor/test/layer_animator_test_controller.cc

Issue 11896017: Thread ui opacity animations (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix ash_unittests Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/compositor/test/layer_animator_test_controller.cc
diff --git a/ui/compositor/test/layer_animator_test_controller.cc b/ui/compositor/test/layer_animator_test_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5721cceae8cbe8884c9cc47f6c1691c6d1b06042
--- /dev/null
+++ b/ui/compositor/test/layer_animator_test_controller.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 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/compositor/test/layer_animator_test_controller.h"
+#include "ui/compositor/layer_animation_sequence.h"
+
+namespace ui {
+
+LayerAnimatorTestController::LayerAnimatorTestController(
+ scoped_refptr<LayerAnimator> animator)
+ : animator_(animator) {
+}
+
+LayerAnimatorTestController::~LayerAnimatorTestController() {
+}
+
+LayerAnimationSequence* LayerAnimatorTestController::GetRunningSequence(
+ LayerAnimationElement::AnimatableProperty property) {
+ LayerAnimator::RunningAnimation* running_animation =
+ animator_->GetRunningAnimation(property);
+ if (running_animation)
+ return running_animation->sequence();
+ else
+ return NULL;
+}
+
+void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() {
+ LayerAnimationSequence* sequence =
+ GetRunningSequence(LayerAnimationElement::OPACITY);
+
+ if (!sequence)
+ return;
+
+ LayerAnimationElement* element = sequence->CurrentElement();
+ if (element->properties().find(LayerAnimationElement::OPACITY) ==
+ element->properties().end())
+ return;
+
+ if (!element->Started() ||
+ element->effective_start_time() != base::TimeTicks())
+ return;
+
+ animator_->OnThreadedAnimationStarted(cc::AnimationEvent(
+ cc::AnimationEvent::Started,
+ 0,
+ element->animation_group_id(),
+ cc::Animation::Opacity,
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()));
+}
+
+} // namespace ui
« no previous file with comments | « ui/compositor/test/layer_animator_test_controller.h ('k') | ui/compositor/test/test_layer_animation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698