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

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

Issue 359103003: Revert of Make SingleThreadProxy a SchedulerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | 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/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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 725 class LayerTreeHostAnimationTestContinuousAnimate
726 : public LayerTreeHostAnimationTest { 726 : public LayerTreeHostAnimationTest {
727 public: 727 public:
728 LayerTreeHostAnimationTestContinuousAnimate() 728 LayerTreeHostAnimationTestContinuousAnimate()
729 : num_commit_complete_(0), num_draw_layers_(0), have_animated_(false) {} 729 : num_commit_complete_(0),
730 num_draw_layers_(0) {
731 }
730 732
731 virtual void SetupTree() OVERRIDE { 733 virtual void SetupTree() OVERRIDE {
732 LayerTreeHostAnimationTest::SetupTree(); 734 LayerTreeHostAnimationTest::SetupTree();
733 // Create a fake content layer so we actually produce new content for every 735 // Create a fake content layer so we actually produce new content for every
734 // animation frame. 736 // animation frame.
735 content_ = FakeContentLayer::Create(&client_); 737 content_ = FakeContentLayer::Create(&client_);
736 content_->set_always_update_resources(true); 738 content_->set_always_update_resources(true);
737 layer_tree_host()->root_layer()->AddChild(content_); 739 layer_tree_host()->root_layer()->AddChild(content_);
738 } 740 }
739 741
740 virtual void BeginTest() OVERRIDE { 742 virtual void BeginTest() OVERRIDE {
741 PostSetNeedsCommitToMainThread(); 743 PostSetNeedsCommitToMainThread();
742 } 744 }
743 745
744 virtual void Animate(base::TimeTicks) OVERRIDE { 746 virtual void Animate(base::TimeTicks) OVERRIDE {
745 if (num_draw_layers_ == 2) 747 if (num_draw_layers_ == 2)
746 return; 748 return;
747 layer_tree_host()->SetNeedsAnimate(); 749 layer_tree_host()->SetNeedsAnimate();
748 have_animated_ = true;
749 } 750 }
750 751
751 virtual void Layout() OVERRIDE { 752 virtual void Layout() OVERRIDE {
752 layer_tree_host()->root_layer()->SetNeedsDisplay(); 753 layer_tree_host()->root_layer()->SetNeedsDisplay();
753 } 754 }
754 755
755 virtual void CommitCompleteOnThread(LayerTreeHostImpl* tree_impl) OVERRIDE { 756 virtual void CommitCompleteOnThread(LayerTreeHostImpl* tree_impl) OVERRIDE {
756 if (num_draw_layers_ == 1) 757 if (num_draw_layers_ == 1)
757 num_commit_complete_++; 758 num_commit_complete_++;
758 } 759 }
759 760
760 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 761 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
761 num_draw_layers_++; 762 num_draw_layers_++;
762 if (num_draw_layers_ == 2) 763 if (num_draw_layers_ == 2)
763 EndTest(); 764 EndTest();
764 } 765 }
765 766
766 virtual void AfterTest() OVERRIDE { 767 virtual void AfterTest() OVERRIDE {
767 // Check that we didn't commit twice between first and second draw. 768 // Check that we didn't commit twice between first and second draw.
768 EXPECT_EQ(1, num_commit_complete_); 769 EXPECT_EQ(1, num_commit_complete_);
769 EXPECT_TRUE(have_animated_);
770 } 770 }
771 771
772 private: 772 private:
773 int num_commit_complete_; 773 int num_commit_complete_;
774 int num_draw_layers_; 774 int num_draw_layers_;
775 bool have_animated_;
776 FakeContentLayerClient client_; 775 FakeContentLayerClient client_;
777 scoped_refptr<FakeContentLayer> content_; 776 scoped_refptr<FakeContentLayer> content_;
778 }; 777 };
779 778
780 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate); 779 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate);
781 780
782 class LayerTreeHostAnimationTestCancelAnimateCommit 781 class LayerTreeHostAnimationTestCancelAnimateCommit
783 : public LayerTreeHostAnimationTest { 782 : public LayerTreeHostAnimationTest {
784 public: 783 public:
785 LayerTreeHostAnimationTestCancelAnimateCommit() 784 LayerTreeHostAnimationTestCancelAnimateCommit()
786 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {} 785 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {}
787 786
788 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 787 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
789 788
790 virtual void Animate(base::TimeTicks) OVERRIDE { 789 virtual void Animate(base::TimeTicks) OVERRIDE {
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 private: 1334 private:
1336 scoped_refptr<Layer> content_; 1335 scoped_refptr<Layer> content_;
1337 int num_swap_buffers_; 1336 int num_swap_buffers_;
1338 }; 1337 };
1339 1338
1340 SINGLE_AND_MULTI_THREAD_TEST_F( 1339 SINGLE_AND_MULTI_THREAD_TEST_F(
1341 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1340 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1342 1341
1343 } // namespace 1342 } // namespace
1344 } // namespace cc 1343 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698