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

Side by Side Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 2042713002: CC Animation: Activate/deactivate ElementAnimations on Layer addition/removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "cc/animation/animation_curve.h" 9 #include "cc/animation/animation_curve.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 EXPECT_FALSE( 1243 EXPECT_FALSE(
1244 player_->element_animations()->has_element_in_pending_list()); 1244 player_->element_animations()->has_element_in_pending_list());
1245 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); 1245 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers());
1246 break; 1246 break;
1247 case 1: 1247 case 1:
1248 layer_->RemoveFromParent(); 1248 layer_->RemoveFromParent();
1249 EXPECT_FALSE( 1249 EXPECT_FALSE(
1250 player_->element_animations()->has_element_in_active_list()); 1250 player_->element_animations()->has_element_in_active_list());
1251 EXPECT_FALSE( 1251 EXPECT_FALSE(
1252 player_->element_animations()->has_element_in_pending_list()); 1252 player_->element_animations()->has_element_in_pending_list());
1253 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); 1253 EXPECT_FALSE(layer_tree_host()->animation_host()->NeedsAnimateLayers());
1254 break; 1254 break;
1255 case 2: 1255 case 2:
1256 layer_tree_host()->root_layer()->AddChild(layer_); 1256 layer_tree_host()->root_layer()->AddChild(layer_);
1257 EXPECT_TRUE( 1257 EXPECT_TRUE(
1258 player_->element_animations()->has_element_in_active_list()); 1258 player_->element_animations()->has_element_in_active_list());
1259 EXPECT_FALSE( 1259 EXPECT_FALSE(
1260 player_->element_animations()->has_element_in_pending_list()); 1260 player_->element_animations()->has_element_in_pending_list());
1261 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); 1261 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers());
1262 break; 1262 break;
1263 } 1263 }
1264 } 1264 }
1265 1265
1266 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 1266 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
1267 scoped_refptr<AnimationTimeline> timeline_impl = 1267 scoped_refptr<AnimationTimeline> timeline_impl =
1268 host_impl->animation_host()->GetTimelineById(timeline_id_); 1268 host_impl->animation_host()->GetTimelineById(timeline_id_);
1269 scoped_refptr<AnimationPlayer> player_impl = 1269 scoped_refptr<AnimationPlayer> player_impl =
1270 timeline_impl->GetPlayerById(player_id_); 1270 timeline_impl->GetPlayerById(player_id_);
1271 1271
1272 switch (host_impl->active_tree()->source_frame_number()) { 1272 switch (host_impl->active_tree()->source_frame_number()) {
1273 case 0: 1273 case 0:
1274 EXPECT_TRUE( 1274 EXPECT_TRUE(
1275 player_impl->element_animations()->has_element_in_active_list()); 1275 player_impl->element_animations()->has_element_in_active_list());
1276 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); 1276 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers());
1277 break; 1277 break;
1278 case 1: 1278 case 1:
1279 EXPECT_FALSE( 1279 EXPECT_FALSE(
1280 player_impl->element_animations()->has_element_in_active_list()); 1280 player_impl->element_animations()->has_element_in_active_list());
1281 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); 1281 EXPECT_FALSE(host_impl->animation_host()->NeedsAnimateLayers());
1282 break; 1282 break;
1283 case 2: 1283 case 2:
1284 EXPECT_TRUE( 1284 EXPECT_TRUE(
1285 player_impl->element_animations()->has_element_in_active_list()); 1285 player_impl->element_animations()->has_element_in_active_list());
1286 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); 1286 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers());
1287 EndTest(); 1287 EndTest();
1288 break; 1288 break;
1289 } 1289 }
1290 } 1290 }
1291 1291
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 private: 1771 private:
1772 scoped_refptr<Layer> layer_; 1772 scoped_refptr<Layer> layer_;
1773 FakeContentLayerClient client_; 1773 FakeContentLayerClient client_;
1774 }; 1774 };
1775 1775
1776 MULTI_THREAD_TEST_F( 1776 MULTI_THREAD_TEST_F(
1777 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); 1777 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit);
1778 1778
1779 } // namespace 1779 } // namespace
1780 } // namespace cc 1780 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl_unittest.cc ('K') | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698