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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 206793003: cc: Split animating and drawing into separate actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix input handler proxy test build. Created 6 years, 8 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_animation.cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index aeeb4f5a54b5efc975e0d43f6d61f783f66660e0..d546e1ba40930cecb0da32294ddda9c243abefe4 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -1244,5 +1244,69 @@ class LayerTreeHostAnimationTestFrozenAnimationTickTime
// Only the non-impl-paint multi-threaded compositor freezes animations.
MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime);
+class LayerTreeHostAnimationTestAddAnimationAfterAnimating
+ : public LayerTreeHostAnimationTest {
+ public:
+ LayerTreeHostAnimationTestAddAnimationAfterAnimating()
+ : num_swap_buffers_(0) {}
+
+ virtual void SetupTree() OVERRIDE {
+ LayerTreeHostAnimationTest::SetupTree();
+ content_ = Layer::Create();
+ content_->SetBounds(gfx::Size(4, 4));
+ layer_tree_host()->root_layer()->AddChild(content_);
+ }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+
+ virtual void DidCommit() OVERRIDE {
+ switch (layer_tree_host()->source_frame_number()) {
+ case 1:
+ // First frame: add an animation to the root layer.
+ AddAnimatedTransformToLayer(layer_tree_host()->root_layer(), 0.1, 5, 5);
+ break;
+ case 2:
+ // Second frame: add an animation to the content layer. The root layer
+ // animation has caused us to animate already during this frame.
+ AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false);
+ break;
+ }
+ }
+
+ virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
+ bool result) OVERRIDE {
+ // The third frame is when both animations have started. Check that both
+ // have a valid start time.
+ if (++num_swap_buffers_ == 3) {
+ EndTest();
+ AnimationRegistrar::AnimationControllerMap copy =
+ host_impl->animation_registrar()->active_animation_controllers();
+ EXPECT_EQ(2u, copy.size());
+ for (AnimationRegistrar::AnimationControllerMap::iterator iter =
+ copy.begin();
+ iter != copy.end();
+ ++iter) {
+ int id = ((*iter).second->id());
+ if (id == host_impl->RootLayer()->id()) {
+ Animation* anim = (*iter).second->GetAnimation(Animation::Transform);
+ EXPECT_GT(anim->start_time(), 0);
+ } else if (id == host_impl->RootLayer()->children()[0]->id()) {
+ Animation* anim = (*iter).second->GetAnimation(Animation::Opacity);
+ EXPECT_GT(anim->start_time(), 0);
+ }
+ }
+ }
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ private:
+ scoped_refptr<Layer> content_;
+ int num_swap_buffers_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostAnimationTestAddAnimationAfterAnimating);
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698