| 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/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} | 839 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} |
| 840 | 840 |
| 841 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 841 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 842 | 842 |
| 843 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 843 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 844 LayerImpl* root = impl->active_tree()->root_layer(); | 844 LayerImpl* root = impl->active_tree()->root_layer(); |
| 845 root->SetScrollable(true); | 845 root->SetScrollable(true); |
| 846 | 846 |
| 847 root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 847 root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 848 EXPECT_EQ(InputHandler::ScrollStarted, | 848 EXPECT_EQ(InputHandler::ScrollStarted, |
| 849 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); | 849 root->TryScroll(gfx::PointF(0.0f, 1.0f), |
| 850 InputHandler::Gesture, |
| 851 true)); |
| 850 | 852 |
| 851 root->SetMaxScrollOffset(gfx::Vector2d(0, 0)); | 853 root->SetMaxScrollOffset(gfx::Vector2d(0, 0)); |
| 852 EXPECT_EQ(InputHandler::ScrollIgnored, | 854 EXPECT_EQ(InputHandler::ScrollIgnored, |
| 853 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); | 855 root->TryScroll(gfx::PointF(0.0f, 1.0f), |
| 856 InputHandler::Gesture, |
| 857 true)); |
| 854 | 858 |
| 855 root->SetMaxScrollOffset(gfx::Vector2d(-100, -100)); | 859 root->SetMaxScrollOffset(gfx::Vector2d(-100, -100)); |
| 856 EXPECT_EQ(InputHandler::ScrollIgnored, | 860 EXPECT_EQ(InputHandler::ScrollIgnored, |
| 857 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); | 861 root->TryScroll(gfx::PointF(0.0f, 1.0f), |
| 862 InputHandler::Gesture, |
| 863 true)); |
| 858 | 864 |
| 859 EndTest(); | 865 EndTest(); |
| 860 } | 866 } |
| 861 | 867 |
| 862 virtual void AfterTest() OVERRIDE {} | 868 virtual void AfterTest() OVERRIDE {} |
| 863 }; | 869 }; |
| 864 | 870 |
| 865 SINGLE_AND_MULTI_THREAD_TEST_F( | 871 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 866 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); | 872 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); |
| 867 | 873 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 RunTest(true, false, false); | 1025 RunTest(true, false, false); |
| 1020 } | 1026 } |
| 1021 | 1027 |
| 1022 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1028 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| 1023 scroll_destroy_whole_tree_ = true; | 1029 scroll_destroy_whole_tree_ = true; |
| 1024 RunTest(true, false, false); | 1030 RunTest(true, false, false); |
| 1025 } | 1031 } |
| 1026 | 1032 |
| 1027 } // namespace | 1033 } // namespace |
| 1028 } // namespace cc | 1034 } // namespace cc |
| OLD | NEW |