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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 scoped_refptr<Layer> root_scroll_layer_; | 664 scoped_refptr<Layer> root_scroll_layer_; |
665 scoped_refptr<Layer> child_layer_; | 665 scoped_refptr<Layer> child_layer_; |
666 scoped_refptr<Layer> expected_scroll_layer_; | 666 scoped_refptr<Layer> expected_scroll_layer_; |
667 scoped_refptr<Layer> expected_no_scroll_layer_; | 667 scoped_refptr<Layer> expected_no_scroll_layer_; |
668 }; | 668 }; |
669 | 669 |
670 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 670 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
671 DeviceScaleFactor1_ScrollChild_DirectRenderer) { | 671 DeviceScaleFactor1_ScrollChild_DirectRenderer) { |
672 device_scale_factor_ = 1.f; | 672 device_scale_factor_ = 1.f; |
673 scroll_child_layer_ = true; | 673 scroll_child_layer_ = true; |
674 RunTest(CompositorMode::Threaded, false); | 674 RunTest(CompositorMode::THREADED, false); |
675 } | 675 } |
676 | 676 |
677 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 677 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
678 DeviceScaleFactor1_ScrollChild_DelegatingRenderer) { | 678 DeviceScaleFactor1_ScrollChild_DelegatingRenderer) { |
679 device_scale_factor_ = 1.f; | 679 device_scale_factor_ = 1.f; |
680 scroll_child_layer_ = true; | 680 scroll_child_layer_ = true; |
681 RunTest(CompositorMode::Threaded, true); | 681 RunTest(CompositorMode::THREADED, true); |
682 } | 682 } |
683 | 683 |
684 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 684 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
685 DeviceScaleFactor15_ScrollChild_DirectRenderer) { | 685 DeviceScaleFactor15_ScrollChild_DirectRenderer) { |
686 device_scale_factor_ = 1.5f; | 686 device_scale_factor_ = 1.5f; |
687 scroll_child_layer_ = true; | 687 scroll_child_layer_ = true; |
688 RunTest(CompositorMode::Threaded, false); | 688 RunTest(CompositorMode::THREADED, false); |
689 } | 689 } |
690 | 690 |
691 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 691 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
692 DeviceScaleFactor15_ScrollChild_DelegatingRenderer) { | 692 DeviceScaleFactor15_ScrollChild_DelegatingRenderer) { |
693 device_scale_factor_ = 1.5f; | 693 device_scale_factor_ = 1.5f; |
694 scroll_child_layer_ = true; | 694 scroll_child_layer_ = true; |
695 RunTest(CompositorMode::Threaded, true); | 695 RunTest(CompositorMode::THREADED, true); |
696 } | 696 } |
697 | 697 |
698 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 698 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
699 DeviceScaleFactor2_ScrollChild_DirectRenderer) { | 699 DeviceScaleFactor2_ScrollChild_DirectRenderer) { |
700 device_scale_factor_ = 2.f; | 700 device_scale_factor_ = 2.f; |
701 scroll_child_layer_ = true; | 701 scroll_child_layer_ = true; |
702 RunTest(CompositorMode::Threaded, false); | 702 RunTest(CompositorMode::THREADED, false); |
703 } | 703 } |
704 | 704 |
705 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 705 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
706 DeviceScaleFactor2_ScrollChild_DelegatingRenderer) { | 706 DeviceScaleFactor2_ScrollChild_DelegatingRenderer) { |
707 device_scale_factor_ = 2.f; | 707 device_scale_factor_ = 2.f; |
708 scroll_child_layer_ = true; | 708 scroll_child_layer_ = true; |
709 RunTest(CompositorMode::Threaded, true); | 709 RunTest(CompositorMode::THREADED, true); |
710 } | 710 } |
711 | 711 |
712 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 712 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
713 DeviceScaleFactor1_ScrollRootScrollLayer_DirectRenderer) { | 713 DeviceScaleFactor1_ScrollRootScrollLayer_DirectRenderer) { |
714 device_scale_factor_ = 1.f; | 714 device_scale_factor_ = 1.f; |
715 scroll_child_layer_ = false; | 715 scroll_child_layer_ = false; |
716 RunTest(CompositorMode::Threaded, false); | 716 RunTest(CompositorMode::THREADED, false); |
717 } | 717 } |
718 | 718 |
719 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 719 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
720 DeviceScaleFactor1_ScrollRootScrollLayer_DelegatingRenderer) { | 720 DeviceScaleFactor1_ScrollRootScrollLayer_DelegatingRenderer) { |
721 device_scale_factor_ = 1.f; | 721 device_scale_factor_ = 1.f; |
722 scroll_child_layer_ = false; | 722 scroll_child_layer_ = false; |
723 RunTest(CompositorMode::Threaded, true); | 723 RunTest(CompositorMode::THREADED, true); |
724 } | 724 } |
725 | 725 |
726 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 726 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
727 DeviceScaleFactor15_ScrollRootScrollLayer_DirectRenderer) { | 727 DeviceScaleFactor15_ScrollRootScrollLayer_DirectRenderer) { |
728 device_scale_factor_ = 1.5f; | 728 device_scale_factor_ = 1.5f; |
729 scroll_child_layer_ = false; | 729 scroll_child_layer_ = false; |
730 RunTest(CompositorMode::Threaded, false); | 730 RunTest(CompositorMode::THREADED, false); |
731 } | 731 } |
732 | 732 |
733 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 733 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
734 DeviceScaleFactor15_ScrollRootScrollLayer_DelegatingRenderer) { | 734 DeviceScaleFactor15_ScrollRootScrollLayer_DelegatingRenderer) { |
735 device_scale_factor_ = 1.5f; | 735 device_scale_factor_ = 1.5f; |
736 scroll_child_layer_ = false; | 736 scroll_child_layer_ = false; |
737 RunTest(CompositorMode::Threaded, true); | 737 RunTest(CompositorMode::THREADED, true); |
738 } | 738 } |
739 | 739 |
740 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 740 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
741 DeviceScaleFactor2_ScrollRootScrollLayer_DirectRenderer) { | 741 DeviceScaleFactor2_ScrollRootScrollLayer_DirectRenderer) { |
742 device_scale_factor_ = 2.f; | 742 device_scale_factor_ = 2.f; |
743 scroll_child_layer_ = false; | 743 scroll_child_layer_ = false; |
744 RunTest(CompositorMode::Threaded, false); | 744 RunTest(CompositorMode::THREADED, false); |
745 } | 745 } |
746 | 746 |
747 TEST_F(LayerTreeHostScrollTestCaseWithChild, | 747 TEST_F(LayerTreeHostScrollTestCaseWithChild, |
748 DeviceScaleFactor2_ScrollRootScrollLayer_DelegatingRenderer) { | 748 DeviceScaleFactor2_ScrollRootScrollLayer_DelegatingRenderer) { |
749 device_scale_factor_ = 2.f; | 749 device_scale_factor_ = 2.f; |
750 scroll_child_layer_ = false; | 750 scroll_child_layer_ = false; |
751 RunTest(CompositorMode::Threaded, true); | 751 RunTest(CompositorMode::THREADED, true); |
752 } | 752 } |
753 | 753 |
754 class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { | 754 class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { |
755 public: | 755 public: |
756 LayerTreeHostScrollTestSimple() | 756 LayerTreeHostScrollTestSimple() |
757 : initial_scroll_(10, 20), | 757 : initial_scroll_(10, 20), |
758 main_thread_scroll_(40, 5), | 758 main_thread_scroll_(40, 5), |
759 impl_thread_scroll1_(2, -1), | 759 impl_thread_scroll1_(2, -1), |
760 impl_thread_scroll2_(-3, 10), | 760 impl_thread_scroll2_(-3, 10), |
761 num_scrolls_(0) {} | 761 num_scrolls_(0) {} |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 FakeLayerScrollClient root_scroll_layer_client_; | 1259 FakeLayerScrollClient root_scroll_layer_client_; |
1260 FakeLayerScrollClient sibling_scroll_layer_client_; | 1260 FakeLayerScrollClient sibling_scroll_layer_client_; |
1261 FakeLayerScrollClient child_scroll_layer_client_; | 1261 FakeLayerScrollClient child_scroll_layer_client_; |
1262 | 1262 |
1263 FakeContentLayerClient fake_content_layer_client_; | 1263 FakeContentLayerClient fake_content_layer_client_; |
1264 | 1264 |
1265 bool scroll_destroy_whole_tree_; | 1265 bool scroll_destroy_whole_tree_; |
1266 }; | 1266 }; |
1267 | 1267 |
1268 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { | 1268 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { |
1269 RunTest(CompositorMode::Threaded, false); | 1269 RunTest(CompositorMode::THREADED, false); |
1270 } | 1270 } |
1271 | 1271 |
1272 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1272 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
1273 scroll_destroy_whole_tree_ = true; | 1273 scroll_destroy_whole_tree_ = true; |
1274 RunTest(CompositorMode::Threaded, false); | 1274 RunTest(CompositorMode::THREADED, false); |
1275 } | 1275 } |
1276 | 1276 |
1277 } // namespace | 1277 } // namespace |
1278 } // namespace cc | 1278 } // namespace cc |
OLD | NEW |