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

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

Issue 23907006: cc: Allow sending BeginMainFrame before draw or activation (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedDeadline3
Patch Set: rebase Created 6 years, 9 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
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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 int num_draw_layers_; 822 int num_draw_layers_;
823 FakeContentLayerClient client_; 823 FakeContentLayerClient client_;
824 scoped_refptr<FakeContentLayer> content_; 824 scoped_refptr<FakeContentLayer> content_;
825 }; 825 };
826 826
827 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate); 827 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate);
828 828
829 class LayerTreeHostAnimationTestCancelAnimateCommit 829 class LayerTreeHostAnimationTestCancelAnimateCommit
830 : public LayerTreeHostAnimationTest { 830 : public LayerTreeHostAnimationTest {
831 public: 831 public:
832 LayerTreeHostAnimationTestCancelAnimateCommit() : num_animate_calls_(0) {} 832 LayerTreeHostAnimationTestCancelAnimateCommit()
833 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {}
833 834
834 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 835 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
835 836
836 virtual void Animate(base::TimeTicks) OVERRIDE { 837 virtual void Animate(base::TimeTicks) OVERRIDE {
838 num_animate_calls_++;
837 // No-op animate will cancel the commit. 839 // No-op animate will cancel the commit.
838 if (++num_animate_calls_ == 2) { 840 if (layer_tree_host()->source_frame_number() == 1) {
839 EndTest(); 841 EndTest();
840 return; 842 return;
841 } 843 }
842 layer_tree_host()->SetNeedsAnimate(); 844 layer_tree_host()->SetNeedsAnimate();
843 } 845 }
844 846
845 virtual void CommitCompleteOnThread(LayerTreeHostImpl* tree_impl) OVERRIDE { 847 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
846 if (num_animate_calls_ > 1) 848 num_commit_calls_++;
849 if (impl->active_tree()->source_frame_number() > 1)
847 FAIL() << "Commit should have been canceled."; 850 FAIL() << "Commit should have been canceled.";
848 } 851 }
849 852
850 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 853 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
851 if (num_animate_calls_ > 1) 854 num_draw_calls_++;
855 if (impl->active_tree()->source_frame_number() > 1)
852 FAIL() << "Draw should have been canceled."; 856 FAIL() << "Draw should have been canceled.";
853 } 857 }
854 858
855 virtual void AfterTest() OVERRIDE { EXPECT_EQ(2, num_animate_calls_); } 859 virtual void AfterTest() OVERRIDE {
860 EXPECT_EQ(2, num_animate_calls_);
861 EXPECT_EQ(1, num_commit_calls_);
862 EXPECT_EQ(1, num_draw_calls_);
863 }
856 864
857 private: 865 private:
858 int num_animate_calls_; 866 int num_animate_calls_;
867 int num_commit_calls_;
868 int num_draw_calls_;
859 FakeContentLayerClient client_; 869 FakeContentLayerClient client_;
860 scoped_refptr<FakeContentLayer> content_; 870 scoped_refptr<FakeContentLayer> content_;
861 }; 871 };
862 872
863 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit); 873 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit);
864 874
865 class LayerTreeHostAnimationTestForceRedraw 875 class LayerTreeHostAnimationTestForceRedraw
866 : public LayerTreeHostAnimationTest { 876 : public LayerTreeHostAnimationTest {
867 public: 877 public:
868 LayerTreeHostAnimationTestForceRedraw() 878 LayerTreeHostAnimationTestForceRedraw()
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 int num_draw_attempts_; 1239 int num_draw_attempts_;
1230 base::TimeTicks last_main_thread_tick_time_; 1240 base::TimeTicks last_main_thread_tick_time_;
1231 base::TimeTicks expected_impl_tick_time_; 1241 base::TimeTicks expected_impl_tick_time_;
1232 }; 1242 };
1233 1243
1234 // Only the non-impl-paint multi-threaded compositor freezes animations. 1244 // Only the non-impl-paint multi-threaded compositor freezes animations.
1235 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime); 1245 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime);
1236 1246
1237 } // namespace 1247 } // namespace
1238 } // namespace cc 1248 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine_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