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