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

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

Issue 1472723002: CC Animations: Fix LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction flakiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/animation_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 // An animation finishing during commit can only happen when we have a separate 997 // An animation finishing during commit can only happen when we have a separate
998 // compositor thread. 998 // compositor thread.
999 MULTI_THREAD_TEST_F(LayerTreeHostTimelinesTestAnimationFinishesDuringCommit); 999 MULTI_THREAD_TEST_F(LayerTreeHostTimelinesTestAnimationFinishesDuringCommit);
1000 1000
1001 // Check that SetTransformIsPotentiallyAnimatingChanged is called 1001 // Check that SetTransformIsPotentiallyAnimatingChanged is called
1002 // if we destroy LayerAnimationController and ElementAnimations. 1002 // if we destroy LayerAnimationController and ElementAnimations.
1003 class LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction 1003 class LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction
1004 : public LayerTreeHostTimelinesTest { 1004 : public LayerTreeHostTimelinesTest {
1005 public: 1005 public:
1006 void SetupTree() override { 1006 void SetupTree() override {
1007 prev_screen_space_transform_is_animating_ = true;
1008 screen_space_transform_animation_stopped_ = false;
1009
1007 LayerTreeHostTimelinesTest::SetupTree(); 1010 LayerTreeHostTimelinesTest::SetupTree();
1008 AttachPlayersToTimeline(); 1011 AttachPlayersToTimeline();
1009 player_->AttachLayer(layer_tree_host()->root_layer()->id()); 1012 player_->AttachLayer(layer_tree_host()->root_layer()->id());
1010 AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5); 1013 AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5);
1011 } 1014 }
1012 1015
1013 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1016 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1014 1017
1015 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1018 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1016 if (host_impl->active_tree()->source_frame_number() == 1) { 1019 if (host_impl->pending_tree()->source_frame_number() <= 1) {
1017 EXPECT_TRUE(host_impl->active_tree()); 1020 EXPECT_TRUE(host_impl->pending_tree()
1018 EXPECT_TRUE(host_impl->active_tree()->root_layer());
1019 EXPECT_TRUE(host_impl->pending_tree());
1020 EXPECT_TRUE(host_impl->pending_tree()->root_layer());
1021
1022 EXPECT_EQ(2, host_impl->pending_tree()->source_frame_number());
1023
1024 EXPECT_TRUE(host_impl->active_tree()
1025 ->root_layer() 1021 ->root_layer()
1026 ->screen_space_transform_is_animating()); 1022 ->screen_space_transform_is_animating());
1023 } else {
1027 EXPECT_FALSE(host_impl->pending_tree() 1024 EXPECT_FALSE(host_impl->pending_tree()
1028 ->root_layer() 1025 ->root_layer()
1029 ->screen_space_transform_is_animating()); 1026 ->screen_space_transform_is_animating());
1030 } else if (host_impl->active_tree()->source_frame_number() == 2) {
1031 EXPECT_FALSE(host_impl->active_tree()
1032 ->root_layer()
1033 ->screen_space_transform_is_animating());
1034 EXPECT_FALSE(host_impl->pending_tree()
1035 ->root_layer()
1036 ->screen_space_transform_is_animating());
1037 } 1027 }
1038 } 1028 }
1039 1029
1040 void DidCommit() override { PostSetNeedsCommitToMainThread(); } 1030 void DidCommit() override { PostSetNeedsCommitToMainThread(); }
1041 1031
1042 void UpdateLayerTreeHost() override { 1032 void UpdateLayerTreeHost() override {
1043 if (layer_tree_host()->source_frame_number() == 2) { 1033 if (layer_tree_host()->source_frame_number() == 2) {
1044 // Destroy player. 1034 // Destroy player.
1045 timeline_->DetachPlayer(player_.get()); 1035 timeline_->DetachPlayer(player_.get());
1046 player_ = nullptr; 1036 player_ = nullptr;
1047 } 1037 }
1048 } 1038 }
1049 1039
1040 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1041 LayerTreeHostImpl::FrameData* frame_data,
1042 DrawResult draw_result) override {
1043 if (!host_impl->active_tree())
ajuma 2015/11/23 14:25:28 Is this needed? (That is, does PrepareToDrawOnThre
loyso (OOO) 2015/11/24 00:04:25 Done.
1044 return draw_result;
1045
1046 const bool screen_space_transform_is_animating =
1047 host_impl->active_tree()
1048 ->root_layer()
1049 ->screen_space_transform_is_animating();
1050
1051 // Check that screen_space_transform_is_animating changes only once.
1052 if (screen_space_transform_is_animating &&
1053 prev_screen_space_transform_is_animating_)
1054 EXPECT_FALSE(screen_space_transform_animation_stopped_);
1055 if (!screen_space_transform_is_animating &&
1056 prev_screen_space_transform_is_animating_) {
1057 EXPECT_FALSE(screen_space_transform_animation_stopped_);
1058 screen_space_transform_animation_stopped_ = true;
1059 }
1060 if (!screen_space_transform_is_animating &&
1061 !prev_screen_space_transform_is_animating_)
1062 EXPECT_TRUE(screen_space_transform_animation_stopped_);
1063
1064 prev_screen_space_transform_is_animating_ =
1065 screen_space_transform_is_animating;
1066
1067 return draw_result;
1068 }
1069
1050 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 1070 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
1051 if (host_impl->active_tree()->source_frame_number() >= 2) 1071 if (host_impl->active_tree()->source_frame_number() >= 2)
1052 EndTest(); 1072 EndTest();
1053 } 1073 }
1054 1074
1055 void AfterTest() override {} 1075 void AfterTest() override {
1076 EXPECT_TRUE(screen_space_transform_animation_stopped_);
1077 }
1078
1079 bool prev_screen_space_transform_is_animating_;
1080 bool screen_space_transform_animation_stopped_;
1056 }; 1081 };
1057 1082
1058 MULTI_THREAD_TEST_F( 1083 MULTI_THREAD_TEST_F(
1059 LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction); 1084 LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction);
1060 1085
1061 // Check that we invalidate property trees on AnimationPlayer::SetNeedsCommit. 1086 // Check that we invalidate property trees on AnimationPlayer::SetNeedsCommit.
1062 class LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit 1087 class LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit
1063 : public LayerTreeHostTimelinesTest { 1088 : public LayerTreeHostTimelinesTest {
1064 public: 1089 public:
1065 void SetupTree() override { 1090 void SetupTree() override {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 private: 1126 private:
1102 scoped_refptr<Layer> layer_; 1127 scoped_refptr<Layer> layer_;
1103 FakeContentLayerClient client_; 1128 FakeContentLayerClient client_;
1104 }; 1129 };
1105 1130
1106 MULTI_THREAD_TEST_F( 1131 MULTI_THREAD_TEST_F(
1107 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); 1132 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit);
1108 1133
1109 } // namespace 1134 } // namespace
1110 } // namespace cc 1135 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698