Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 int added_animations_; | 758 int added_animations_; |
| 759 int started_times_; | 759 int started_times_; |
| 760 int finished_times_; | 760 int finished_times_; |
| 761 FakeContentLayerClient client_; | 761 FakeContentLayerClient client_; |
| 762 scoped_refptr<FakeContentLayer> content_; | 762 scoped_refptr<FakeContentLayer> content_; |
| 763 }; | 763 }; |
| 764 | 764 |
| 765 MULTI_THREAD_TEST_F( | 765 MULTI_THREAD_TEST_F( |
| 766 LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations); | 766 LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations); |
| 767 | 767 |
| 768 // Test that creating a pinch-zoom scrollbar animation leads to AnimateLayers | |
| 769 // being called. | |
| 770 class LayerTreeHostAnimationTestPinchZoomScrollbars | |
| 771 : public LayerTreeHostAnimationTest { | |
| 772 public: | |
| 773 LayerTreeHostAnimationTestPinchZoomScrollbars() | |
| 774 : root_layer_(ContentLayer::Create(&client_)), | |
| 775 started_times_(0), | |
| 776 num_commit_complete_(0) {} | |
| 777 | |
| 778 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | |
| 779 settings->use_pinch_zoom_scrollbars = true; | |
| 780 } | |
| 781 | |
| 782 virtual void SetupTree() OVERRIDE { | |
| 783 root_layer_->SetIsDrawable(true); | |
| 784 root_layer_->SetBounds(gfx::Size(100, 100)); | |
| 785 layer_tree_host()->SetRootLayer(root_layer_); | |
| 786 LayerTreeHostAnimationTest::SetupTree(); | |
| 787 } | |
| 788 | |
| 789 virtual void BeginTest() OVERRIDE { | |
| 790 layer_tree_host()->SetPageScaleFactorAndLimits(1.55f, 1.f, 4.f); | |
| 791 PostSetNeedsCommitToMainThread(); | |
| 792 } | |
| 793 | |
| 794 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | |
| 795 num_commit_complete_++; | |
| 796 } | |
| 797 | |
| 798 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, | |
| 799 base::TimeTicks monotonic_time) OVERRIDE { | |
| 800 // Two commits are required for the creation of pinch-zoom scrollbars. | |
| 801 // Wait for these to finish. | |
| 802 if (num_commit_complete_ < 2) | |
| 803 return; | |
| 804 | |
| 805 EXPECT_NE(host_impl->active_tree()->page_scale_factor(), 1.f); | |
| 806 | |
| 807 switch (started_times_) { | |
| 808 case 0: | |
| 809 host_impl->active_tree()->DidBeginScroll(); | |
| 810 started_times_++; | |
| 811 break; | |
| 812 case 1: | |
| 813 host_impl->active_tree()->DidEndScroll(); | |
| 814 started_times_++; | |
| 815 break; | |
| 816 case 2: | |
| 817 EndTest(); | |
| 818 } | |
| 819 } | |
| 820 | |
| 821 virtual void AfterTest() OVERRIDE {} | |
| 822 | |
| 823 private: | |
| 824 FakeContentLayerClient client_; | |
| 825 scoped_refptr<ContentLayer> root_layer_; | |
|
danakj
2013/04/18 18:53:32
Can you use FakeContentLayer here as well? Then yo
ajuma
2013/04/18 19:21:25
Done.
| |
| 826 int started_times_; | |
| 827 int num_commit_complete_; | |
| 828 }; | |
| 829 | |
| 830 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestPinchZoomScrollbars); | |
| 831 | |
| 768 } // namespace | 832 } // namespace |
| 769 } // namespace cc | 833 } // namespace cc |
| OLD | NEW |