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 "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 scoped_refptr<Layer> root_scroll_layer_; | 683 scoped_refptr<Layer> root_scroll_layer_; |
684 scoped_refptr<Layer> child_layer_; | 684 scoped_refptr<Layer> child_layer_; |
685 scoped_refptr<Layer> expected_scroll_layer_; | 685 scoped_refptr<Layer> expected_scroll_layer_; |
686 scoped_refptr<Layer> expected_no_scroll_layer_; | 686 scoped_refptr<Layer> expected_no_scroll_layer_; |
687 }; | 687 }; |
688 | 688 |
689 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 689 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
690 DeviceScaleFactor1_ScrollChild_DirectRenderer) { | 690 DeviceScaleFactor1_ScrollChild_DirectRenderer) { |
691 device_scale_factor_ = 1.f; | 691 device_scale_factor_ = 1.f; |
692 scroll_child_layer_ = true; | 692 scroll_child_layer_ = true; |
693 RunTest(CompositorMode::Threaded, false); | 693 RunTest(CompositorMode::THREADED, false); |
694 } | 694 } |
695 | 695 |
696 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 696 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
697 DeviceScaleFactor1_ScrollChild_DelegatingRenderer) { | 697 DeviceScaleFactor1_ScrollChild_DelegatingRenderer) { |
698 device_scale_factor_ = 1.f; | 698 device_scale_factor_ = 1.f; |
699 scroll_child_layer_ = true; | 699 scroll_child_layer_ = true; |
700 RunTest(CompositorMode::Threaded, true); | 700 RunTest(CompositorMode::THREADED, true); |
701 } | 701 } |
702 | 702 |
703 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 703 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
704 DeviceScaleFactor15_ScrollChild_DirectRenderer) { | 704 DeviceScaleFactor15_ScrollChild_DirectRenderer) { |
705 device_scale_factor_ = 1.5f; | 705 device_scale_factor_ = 1.5f; |
706 scroll_child_layer_ = true; | 706 scroll_child_layer_ = true; |
707 RunTest(CompositorMode::Threaded, false); | 707 RunTest(CompositorMode::THREADED, false); |
708 } | 708 } |
709 | 709 |
710 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 710 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
711 DeviceScaleFactor15_ScrollChild_DelegatingRenderer) { | 711 DeviceScaleFactor15_ScrollChild_DelegatingRenderer) { |
712 device_scale_factor_ = 1.5f; | 712 device_scale_factor_ = 1.5f; |
713 scroll_child_layer_ = true; | 713 scroll_child_layer_ = true; |
714 RunTest(CompositorMode::Threaded, true); | 714 RunTest(CompositorMode::THREADED, true); |
715 } | 715 } |
716 | 716 |
717 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 717 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
718 DeviceScaleFactor2_ScrollChild_DirectRenderer) { | 718 DeviceScaleFactor2_ScrollChild_DirectRenderer) { |
719 device_scale_factor_ = 2.f; | 719 device_scale_factor_ = 2.f; |
720 scroll_child_layer_ = true; | 720 scroll_child_layer_ = true; |
721 RunTest(CompositorMode::Threaded, false); | 721 RunTest(CompositorMode::THREADED, false); |
722 } | 722 } |
723 | 723 |
724 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 724 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
725 DeviceScaleFactor2_ScrollChild_DelegatingRenderer) { | 725 DeviceScaleFactor2_ScrollChild_DelegatingRenderer) { |
726 device_scale_factor_ = 2.f; | 726 device_scale_factor_ = 2.f; |
727 scroll_child_layer_ = true; | 727 scroll_child_layer_ = true; |
728 RunTest(CompositorMode::Threaded, true); | 728 RunTest(CompositorMode::THREADED, true); |
729 } | 729 } |
730 | 730 |
731 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 731 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
732 DeviceScaleFactor1_ScrollRootScrollLayer_DirectRenderer) { | 732 DeviceScaleFactor1_ScrollRootScrollLayer_DirectRenderer) { |
733 device_scale_factor_ = 1.f; | 733 device_scale_factor_ = 1.f; |
734 scroll_child_layer_ = false; | 734 scroll_child_layer_ = false; |
735 RunTest(CompositorMode::Threaded, false); | 735 RunTest(CompositorMode::THREADED, false); |
736 } | 736 } |
737 | 737 |
738 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 738 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
739 DeviceScaleFactor1_ScrollRootScrollLayer_DelegatingRenderer) { | 739 DeviceScaleFactor1_ScrollRootScrollLayer_DelegatingRenderer) { |
740 device_scale_factor_ = 1.f; | 740 device_scale_factor_ = 1.f; |
741 scroll_child_layer_ = false; | 741 scroll_child_layer_ = false; |
742 RunTest(CompositorMode::Threaded, true); | 742 RunTest(CompositorMode::THREADED, true); |
743 } | 743 } |
744 | 744 |
745 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 745 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
746 DeviceScaleFactor15_ScrollRootScrollLayer_DirectRenderer) { | 746 DeviceScaleFactor15_ScrollRootScrollLayer_DirectRenderer) { |
747 device_scale_factor_ = 1.5f; | 747 device_scale_factor_ = 1.5f; |
748 scroll_child_layer_ = false; | 748 scroll_child_layer_ = false; |
749 RunTest(CompositorMode::Threaded, false); | 749 RunTest(CompositorMode::THREADED, false); |
750 } | 750 } |
751 | 751 |
752 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 752 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
753 DeviceScaleFactor15_ScrollRootScrollLayer_DelegatingRenderer) { | 753 DeviceScaleFactor15_ScrollRootScrollLayer_DelegatingRenderer) { |
754 device_scale_factor_ = 1.5f; | 754 device_scale_factor_ = 1.5f; |
755 scroll_child_layer_ = false; | 755 scroll_child_layer_ = false; |
756 RunTest(CompositorMode::Threaded, true); | 756 RunTest(CompositorMode::THREADED, true); |
757 } | 757 } |
758 | 758 |
759 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 759 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
760 DeviceScaleFactor2_ScrollRootScrollLayer_DirectRenderer) { | 760 DeviceScaleFactor2_ScrollRootScrollLayer_DirectRenderer) { |
761 device_scale_factor_ = 2.f; | 761 device_scale_factor_ = 2.f; |
762 scroll_child_layer_ = false; | 762 scroll_child_layer_ = false; |
763 RunTest(CompositorMode::Threaded, false); | 763 RunTest(CompositorMode::THREADED, false); |
764 } | 764 } |
765 | 765 |
766 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 766 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
767 DeviceScaleFactor2_ScrollRootScrollLayer_DelegatingRenderer) { | 767 DeviceScaleFactor2_ScrollRootScrollLayer_DelegatingRenderer) { |
768 device_scale_factor_ = 2.f; | 768 device_scale_factor_ = 2.f; |
769 scroll_child_layer_ = false; | 769 scroll_child_layer_ = false; |
770 RunTest(CompositorMode::Threaded, true); | 770 RunTest(CompositorMode::THREADED, true); |
771 } | 771 } |
772 | 772 |
773 class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { | 773 class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { |
774 public: | 774 public: |
775 LayerTreeHostScrollTestSimple() | 775 LayerTreeHostScrollTestSimple() |
776 : initial_scroll_(10, 20), | 776 : initial_scroll_(10, 20), |
777 main_thread_scroll_(40, 5), | 777 main_thread_scroll_(40, 5), |
778 impl_thread_scroll1_(2, -1), | 778 impl_thread_scroll1_(2, -1), |
779 impl_thread_scroll2_(-3, 10), | 779 impl_thread_scroll2_(-3, 10), |
780 num_scrolls_(0) {} | 780 num_scrolls_(0) {} |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 FakeLayerScrollClient root_scroll_layer_client_; | 1287 FakeLayerScrollClient root_scroll_layer_client_; |
1288 FakeLayerScrollClient sibling_scroll_layer_client_; | 1288 FakeLayerScrollClient sibling_scroll_layer_client_; |
1289 FakeLayerScrollClient child_scroll_layer_client_; | 1289 FakeLayerScrollClient child_scroll_layer_client_; |
1290 | 1290 |
1291 FakeContentLayerClient fake_content_layer_client_; | 1291 FakeContentLayerClient fake_content_layer_client_; |
1292 | 1292 |
1293 bool scroll_destroy_whole_tree_; | 1293 bool scroll_destroy_whole_tree_; |
1294 }; | 1294 }; |
1295 | 1295 |
1296 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { | 1296 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { |
1297 RunTest(CompositorMode::Threaded, false); | 1297 RunTest(CompositorMode::THREADED, false); |
1298 } | 1298 } |
1299 | 1299 |
1300 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1300 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
1301 scroll_destroy_whole_tree_ = true; | 1301 scroll_destroy_whole_tree_ = true; |
1302 RunTest(CompositorMode::Threaded, false); | 1302 RunTest(CompositorMode::THREADED, false); |
1303 } | 1303 } |
1304 | 1304 |
1305 } // namespace | 1305 } // namespace |
1306 } // namespace cc | 1306 } // namespace cc |
OLD | NEW |