Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc |
| index 925993108a384d217951602c1ccae3945ff3af7a..09e34e74328d0f55a140d7d8bf3eb7663b32509a 100644 |
| --- a/cc/trees/layer_tree_host_impl_unittest.cc |
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc |
| @@ -6270,6 +6270,42 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) { |
| } |
| } |
| +TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) { |
| + InputHandlerScrollResult scroll_result; |
| + LayerTreeSettings settings = DefaultSettings(); |
| + CreateHostImpl(settings, CreateOutputSurface()); |
| + |
| + LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50)); |
|
bokan
2016/07/01 19:02:28
Use CreateBasicVirtualViewportLayers to build the
Eric Seckler
2016/07/04 08:33:26
Done.
|
| + scroll_layer->set_main_thread_scrolling_reasons( |
| + MainThreadScrollingReason::kThreadedScrollingDisabled); |
| + |
| + LayerImpl* clip_layer = |
| + scroll_layer->test_properties()->parent->test_properties()->parent; |
|
bokan
2016/07/01 19:02:28
Use active_tree()->InnerViewportContainerLayer()
Eric Seckler
2016/07/04 08:33:26
Removed this part, should now be handled by Create
|
| + clip_layer->SetBounds(gfx::Size(50, 50)); |
| + host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| + host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| + host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); |
| + DrawFrame(); |
| + |
| + // Overscroll initiated outside layers will be handled by the main thread. |
| + EXPECT_EQ(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint( |
| + gfx::PointF(0, 60))); |
| + EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, |
| + host_impl_ |
| + ->ScrollBegin(BeginState(gfx::Point(0, 60)).get(), |
| + InputHandler::WHEEL) |
| + .thread); |
| + |
| + // Overscroll initiated inside layers will be handled by the main thread. |
|
bokan
2016/07/01 19:02:28
Could you add a similar test that doesn't set the
Eric Seckler
2016/07/04 08:33:26
Done.
|
| + EXPECT_NE(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint( |
| + gfx::PointF(0, 0))); |
| + EXPECT_EQ( |
| + InputHandler::SCROLL_ON_MAIN_THREAD, |
| + host_impl_ |
| + ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), InputHandler::WHEEL) |
| + .thread); |
| +} |
| + |
| class BlendStateCheckLayer : public LayerImpl { |
| public: |
| static std::unique_ptr<LayerImpl> Create( |