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 | |
777 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | |
778 settings->use_pinch_zoom_scrollbars = true; | |
779 } | |
780 | |
781 virtual void BeginTest() OVERRIDE { | |
782 root_layer_->SetIsDrawable(true); | |
783 root_layer_->SetBounds(gfx::Size(100, 100)); | |
784 layer_tree_host()->SetRootLayer(root_layer_); | |
danakj
2013/04/17 20:54:09
Can you set up the layer tree in SetupTree() inste
ajuma
2013/04/18 18:42:51
Done.
| |
785 layer_tree_host()->SetPageScaleFactorAndLimits(0.5, 0.5, 0.9); | |
danakj
2013/04/17 20:54:09
These are floats. 0.5f etc
wjmaclean
2013/04/17 20:56:54
Minor nit: we generally would only have pinch zoom
danakj
2013/04/17 21:01:03
Oh, is this test actually triggering the scrollbar
ajuma
2013/04/18 18:42:51
Done.
| |
786 PostSetNeedsCommitToMainThread(); | |
787 } | |
788 | |
789 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, | |
790 base::TimeTicks monotonic_time) OVERRIDE { | |
791 if (host_impl->active_tree()->page_scale_factor() == 1.0) | |
danakj
2013/04/17 20:54:09
1.f
ajuma
2013/04/18 18:42:51
Done.
| |
792 return; | |
793 | |
794 if (started_times_ == 0) { | |
danakj
2013/04/17 20:54:09
seems like a good spot for a switch?
ajuma
2013/04/18 18:42:51
Done.
| |
795 host_impl->active_tree()->DidBeginScroll(); | |
796 started_times_++; | |
797 return; | |
798 } | |
799 | |
800 if (started_times_ == 1) { | |
801 host_impl->active_tree()->DidEndScroll(); | |
802 started_times_++; | |
803 return; | |
804 } | |
805 | |
806 if (started_times_ == 2) | |
807 EndTest(); | |
808 } | |
809 | |
810 virtual void AfterTest() OVERRIDE {} | |
811 | |
812 private: | |
813 FakeContentLayerClient client_; | |
814 scoped_refptr<ContentLayer> root_layer_; | |
815 int started_times_; | |
816 }; | |
817 | |
818 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestPinchZoomScrollbars); | |
819 | |
768 } // namespace | 820 } // namespace |
769 } // namespace cc | 821 } // namespace cc |
OLD | NEW |