| OLD | NEW |
| 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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1061 |
| 1062 AddOpacityTransitionToPlayer(player_.get(), 10000.0, 0.1f, 0.9f, true); | 1062 AddOpacityTransitionToPlayer(player_.get(), 10000.0, 0.1f, 0.9f, true); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1065 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1066 | 1066 |
| 1067 void DidCommit() override { | 1067 void DidCommit() override { |
| 1068 switch (layer_tree_host()->source_frame_number()) { | 1068 switch (layer_tree_host()->source_frame_number()) { |
| 1069 case 0: | 1069 case 0: |
| 1070 EXPECT_TRUE( | 1070 EXPECT_TRUE( |
| 1071 player_->element_animations()->needs_active_value_observations()); | 1071 player_->element_animations()->has_element_in_active_list()); |
| 1072 EXPECT_FALSE( | 1072 EXPECT_FALSE( |
| 1073 player_->element_animations()->needs_pending_value_observations()); | 1073 player_->element_animations()->has_element_in_pending_list()); |
| 1074 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); | 1074 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); |
| 1075 break; | 1075 break; |
| 1076 case 1: | 1076 case 1: |
| 1077 layer_->RemoveFromParent(); | 1077 layer_->RemoveFromParent(); |
| 1078 EXPECT_FALSE( | 1078 EXPECT_FALSE( |
| 1079 player_->element_animations()->needs_active_value_observations()); | 1079 player_->element_animations()->has_element_in_active_list()); |
| 1080 EXPECT_FALSE( | 1080 EXPECT_FALSE( |
| 1081 player_->element_animations()->needs_pending_value_observations()); | 1081 player_->element_animations()->has_element_in_pending_list()); |
| 1082 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); | 1082 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); |
| 1083 break; | 1083 break; |
| 1084 case 2: | 1084 case 2: |
| 1085 layer_tree_host()->root_layer()->AddChild(layer_); | 1085 layer_tree_host()->root_layer()->AddChild(layer_); |
| 1086 EXPECT_TRUE( | 1086 EXPECT_TRUE( |
| 1087 player_->element_animations()->needs_active_value_observations()); | 1087 player_->element_animations()->has_element_in_active_list()); |
| 1088 EXPECT_FALSE( | 1088 EXPECT_FALSE( |
| 1089 player_->element_animations()->needs_pending_value_observations()); | 1089 player_->element_animations()->has_element_in_pending_list()); |
| 1090 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); | 1090 EXPECT_TRUE(layer_tree_host()->animation_host()->NeedsAnimateLayers()); |
| 1091 break; | 1091 break; |
| 1092 } | 1092 } |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1095 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 1096 scoped_refptr<AnimationTimeline> timeline_impl = | 1096 scoped_refptr<AnimationTimeline> timeline_impl = |
| 1097 host_impl->animation_host()->GetTimelineById(timeline_id_); | 1097 host_impl->animation_host()->GetTimelineById(timeline_id_); |
| 1098 scoped_refptr<AnimationPlayer> player_impl = | 1098 scoped_refptr<AnimationPlayer> player_impl = |
| 1099 timeline_impl->GetPlayerById(player_id_); | 1099 timeline_impl->GetPlayerById(player_id_); |
| 1100 | 1100 |
| 1101 switch (host_impl->active_tree()->source_frame_number()) { | 1101 switch (host_impl->active_tree()->source_frame_number()) { |
| 1102 case 0: | 1102 case 0: |
| 1103 EXPECT_TRUE(player_impl->element_animations() | 1103 EXPECT_TRUE( |
| 1104 ->needs_active_value_observations()); | 1104 player_impl->element_animations()->has_element_in_active_list()); |
| 1105 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); | 1105 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); |
| 1106 break; | 1106 break; |
| 1107 case 1: | 1107 case 1: |
| 1108 EXPECT_FALSE(player_impl->element_animations() | 1108 EXPECT_FALSE( |
| 1109 ->needs_active_value_observations()); | 1109 player_impl->element_animations()->has_element_in_active_list()); |
| 1110 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); | 1110 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); |
| 1111 break; | 1111 break; |
| 1112 case 2: | 1112 case 2: |
| 1113 EXPECT_TRUE(player_impl->element_animations() | 1113 EXPECT_TRUE( |
| 1114 ->needs_active_value_observations()); | 1114 player_impl->element_animations()->has_element_in_active_list()); |
| 1115 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); | 1115 EXPECT_TRUE(host_impl->animation_host()->NeedsAnimateLayers()); |
| 1116 EndTest(); | 1116 EndTest(); |
| 1117 break; | 1117 break; |
| 1118 } | 1118 } |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 void AfterTest() override {} | 1121 void AfterTest() override {} |
| 1122 | 1122 |
| 1123 private: | 1123 private: |
| 1124 scoped_refptr<Layer> layer_; | 1124 scoped_refptr<Layer> layer_; |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 private: | 1600 private: |
| 1601 scoped_refptr<Layer> layer_; | 1601 scoped_refptr<Layer> layer_; |
| 1602 FakeContentLayerClient client_; | 1602 FakeContentLayerClient client_; |
| 1603 }; | 1603 }; |
| 1604 | 1604 |
| 1605 MULTI_THREAD_TEST_F( | 1605 MULTI_THREAD_TEST_F( |
| 1606 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1606 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
| 1607 | 1607 |
| 1608 } // namespace | 1608 } // namespace |
| 1609 } // namespace cc | 1609 } // namespace cc |
| OLD | NEW |