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

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

Issue 73343002: De-activate LayerAnimationControllers when all animations are WaitingForDeletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TickAnimationWhileBackgrounded flake Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | 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 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 "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/layer_animation_controller.h" 8 #include "cc/animation/layer_animation_controller.h"
9 #include "cc/animation/timing_function.h" 9 #include "cc/animation/timing_function.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 virtual void AfterTest() OVERRIDE {} 248 virtual void AfterTest() OVERRIDE {}
249 249
250 private: 250 private:
251 bool started_animating_; 251 bool started_animating_;
252 }; 252 };
253 253
254 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted); 254 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted);
255 255
256 // Ensures that animations continue to be ticked when we are backgrounded. 256 // Ensures that animations continue to be ticked when we are backgrounded.
257 class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded 257 class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
ajuma 2013/11/15 18:32:50 This test was flaking on the Windows trybots. Sinc
258 : public LayerTreeHostAnimationTest { 258 : public LayerTreeHostAnimationTest {
259 public: 259 public:
260 LayerTreeHostAnimationTestTickAnimationWhileBackgrounded() 260 LayerTreeHostAnimationTestTickAnimationWhileBackgrounded()
261 : num_animates_(0) {} 261 : num_animates_(0) {}
262 262
263 virtual void BeginTest() OVERRIDE { 263 virtual void BeginTest() OVERRIDE {
264 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); 264 PostAddLongAnimationToMainThread(layer_tree_host()->root_layer());
265 } 265 }
266 266
267 // Use WillAnimateLayers to set visible false before the animation runs and 267 // Use WillAnimateLayers to set visible false before the animation runs and
268 // causes a commit, so we block the second visible animate in single-thread 268 // causes a commit, so we block the second visible animate in single-thread
269 // mode. 269 // mode.
270 virtual void WillAnimateLayers( 270 virtual void WillAnimateLayers(
271 LayerTreeHostImpl* host_impl, 271 LayerTreeHostImpl* host_impl,
272 base::TimeTicks monotonic_time) OVERRIDE { 272 base::TimeTicks monotonic_time) OVERRIDE {
273 // Verify that the host can draw, it's just not visible. 273 // Verify that the host can draw, it's just not visible.
274 EXPECT_TRUE(host_impl->CanDraw()); 274 EXPECT_TRUE(host_impl->CanDraw());
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 859
860 virtual void BeginTest() OVERRIDE { 860 virtual void BeginTest() OVERRIDE {
861 prevented_draw_ = 0; 861 prevented_draw_ = 0;
862 added_animations_ = 0; 862 added_animations_ = 0;
863 started_times_ = 0; 863 started_times_ = 0;
864 finished_times_ = 0; 864 finished_times_ = 0;
865 865
866 PostSetNeedsCommitToMainThread(); 866 PostSetNeedsCommitToMainThread();
867 } 867 }
868 868
869 virtual void DispatchAddInstantAnimation(Layer* layer_to_receive_animation)
870 OVERRIDE {
ajuma 2013/11/15 18:32:50 This needed to be changed, since this CL removes D
871 LayerTreeHostAnimationTest::DispatchAddInstantAnimation(
872 layer_to_receive_animation);
873 added_animations_++;
874 }
875
876 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 869 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
877 LayerTreeHostImpl::FrameData* frame_data, 870 LayerTreeHostImpl::FrameData* frame_data,
878 bool result) OVERRIDE { 871 bool result) OVERRIDE {
879 if (added_animations_ < 2) 872 if (added_animations_ < 2)
880 return result; 873 return result;
881 if (TestEnded()) 874 if (TestEnded())
882 return result; 875 return result;
883 // Act like there is checkerboard when the second animation wants to draw. 876 // Act like there is checkerboard when the second animation wants to draw.
884 ++prevented_draw_; 877 ++prevented_draw_;
885 return false; 878 return false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 int finished_times_; 923 int finished_times_;
931 FakeContentLayerClient client_; 924 FakeContentLayerClient client_;
932 scoped_refptr<FakeContentLayer> content_; 925 scoped_refptr<FakeContentLayer> content_;
933 }; 926 };
934 927
935 MULTI_THREAD_TEST_F( 928 MULTI_THREAD_TEST_F(
936 LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations); 929 LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations);
937 930
938 } // namespace 931 } // namespace
939 } // namespace cc 932 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698