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/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1037 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1038 | 1038 |
1039 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 1039 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
1040 LayerImpl* root = impl->active_tree()->root_layer(); | 1040 LayerImpl* root = impl->active_tree()->root_layer(); |
1041 LayerImpl* scroll_layer = root->children()[0]; | 1041 LayerImpl* scroll_layer = root->children()[0]; |
1042 scroll_layer->SetScrollClipLayer(root->id()); | 1042 scroll_layer->SetScrollClipLayer(root->id()); |
1043 | 1043 |
1044 // Set max_scroll_offset = (100, 100). | 1044 // Set max_scroll_offset = (100, 100). |
1045 scroll_layer->SetBounds( | 1045 scroll_layer->SetBounds( |
1046 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); | 1046 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); |
1047 EXPECT_EQ(InputHandler::ScrollStarted, | 1047 EXPECT_EQ( |
1048 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), | 1048 InputHandler::ScrollStarted, |
1049 InputHandler::Gesture)); | 1049 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture, |
| 1050 ScrollBlocksOnNone)); |
1050 | 1051 |
1051 // Set max_scroll_offset = (0, 0). | 1052 // Set max_scroll_offset = (0, 0). |
1052 scroll_layer->SetBounds(root->bounds()); | 1053 scroll_layer->SetBounds(root->bounds()); |
1053 EXPECT_EQ(InputHandler::ScrollIgnored, | 1054 EXPECT_EQ( |
1054 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), | 1055 InputHandler::ScrollIgnored, |
1055 InputHandler::Gesture)); | 1056 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture, |
| 1057 ScrollBlocksOnNone)); |
1056 | 1058 |
1057 // Set max_scroll_offset = (-100, -100). | 1059 // Set max_scroll_offset = (-100, -100). |
1058 scroll_layer->SetBounds(gfx::Size()); | 1060 scroll_layer->SetBounds(gfx::Size()); |
1059 EXPECT_EQ(InputHandler::ScrollIgnored, | 1061 EXPECT_EQ( |
1060 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), | 1062 InputHandler::ScrollIgnored, |
1061 InputHandler::Gesture)); | 1063 scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture, |
| 1064 ScrollBlocksOnNone)); |
1062 | 1065 |
1063 EndTest(); | 1066 EndTest(); |
1064 } | 1067 } |
1065 | 1068 |
1066 void AfterTest() override {} | 1069 void AfterTest() override {} |
1067 }; | 1070 }; |
1068 | 1071 |
1069 SINGLE_AND_MULTI_THREAD_TEST_F( | 1072 SINGLE_AND_MULTI_THREAD_TEST_F( |
1070 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); | 1073 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); |
1071 | 1074 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 RunTest(true, false, true); | 1234 RunTest(true, false, true); |
1232 } | 1235 } |
1233 | 1236 |
1234 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1237 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
1235 scroll_destroy_whole_tree_ = true; | 1238 scroll_destroy_whole_tree_ = true; |
1236 RunTest(true, false, true); | 1239 RunTest(true, false, true); |
1237 } | 1240 } |
1238 | 1241 |
1239 } // namespace | 1242 } // namespace |
1240 } // namespace cc | 1243 } // namespace cc |
OLD | NEW |