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

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

Issue 462803002: Fix failing (flaky) LayerTreeHostTestLCDNotification test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: flakylcd: fixnewcontexttest Created 6 years, 4 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 | Annotate | Revision Log
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/scroll_offset_animation_curve.h" 9 #include "cc/animation/scroll_offset_animation_curve.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 base::TimeTicks monotonic_time) OVERRIDE { 715 base::TimeTicks monotonic_time) OVERRIDE {
716 EndTest(); 716 EndTest();
717 } 717 }
718 718
719 virtual void AfterTest() OVERRIDE {} 719 virtual void AfterTest() OVERRIDE {}
720 }; 720 };
721 721
722 SINGLE_AND_MULTI_THREAD_TEST_F( 722 SINGLE_AND_MULTI_THREAD_TEST_F(
723 LayerTreeHostAnimationTestLayerAddedWithAnimation); 723 LayerTreeHostAnimationTestLayerAddedWithAnimation);
724 724
725 class LayerTreeHostAnimationTestContinuousAnimate
726 : public LayerTreeHostAnimationTest {
727 public:
728 LayerTreeHostAnimationTestContinuousAnimate()
729 : num_commit_complete_(0), num_draw_layers_(0), have_animated_(false) {}
730
731 virtual void SetupTree() OVERRIDE {
732 LayerTreeHostAnimationTest::SetupTree();
733 // Create a fake content layer so we actually produce new content for every
734 // animation frame.
735 content_ = FakeContentLayer::Create(&client_);
736 content_->set_always_update_resources(true);
737 layer_tree_host()->root_layer()->AddChild(content_);
738 }
739
740 virtual void BeginTest() OVERRIDE {
741 PostSetNeedsCommitToMainThread();
742 }
743
744 virtual void Animate(base::TimeTicks) OVERRIDE {
745 if (num_draw_layers_ == 2)
746 return;
747 layer_tree_host()->SetNeedsAnimate();
748 have_animated_ = true;
749 }
750
751 virtual void Layout() OVERRIDE {
752 layer_tree_host()->root_layer()->SetNeedsDisplay();
753 }
754
755 virtual void CommitCompleteOnThread(LayerTreeHostImpl* tree_impl) OVERRIDE {
756 if (num_draw_layers_ == 1)
757 num_commit_complete_++;
758 }
759
760 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
761 num_draw_layers_++;
762 if (num_draw_layers_ == 2)
763 EndTest();
764 }
765
766 virtual void AfterTest() OVERRIDE {
767 // Check that we didn't commit twice between first and second draw.
768 EXPECT_EQ(1, num_commit_complete_);
769 EXPECT_TRUE(have_animated_);
770 }
771
772 private:
773 int num_commit_complete_;
774 int num_draw_layers_;
775 bool have_animated_;
776 FakeContentLayerClient client_;
777 scoped_refptr<FakeContentLayer> content_;
778 };
779
780 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate);
781
782 class LayerTreeHostAnimationTestCancelAnimateCommit 725 class LayerTreeHostAnimationTestCancelAnimateCommit
783 : public LayerTreeHostAnimationTest { 726 : public LayerTreeHostAnimationTest {
784 public: 727 public:
785 LayerTreeHostAnimationTestCancelAnimateCommit() 728 LayerTreeHostAnimationTestCancelAnimateCommit()
786 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {} 729 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {}
787 730
788 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 731 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
789 732
790 virtual void Animate(base::TimeTicks) OVERRIDE { 733 virtual void Animate(base::TimeTicks) OVERRIDE {
791 num_animate_calls_++; 734 num_animate_calls_++;
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 private: 1286 private:
1344 scoped_refptr<Layer> content_; 1287 scoped_refptr<Layer> content_;
1345 int num_swap_buffers_; 1288 int num_swap_buffers_;
1346 }; 1289 };
1347 1290
1348 SINGLE_AND_MULTI_THREAD_TEST_F( 1291 SINGLE_AND_MULTI_THREAD_TEST_F(
1349 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1292 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1350 1293
1351 } // namespace 1294 } // namespace
1352 } // namespace cc 1295 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698