| 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 0fff5ffc332c261241c2f23a03188c0f65549013..560f8d078bc63c30c50dc9073eeeae137e868b17 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -5951,6 +5951,79 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
|
| }
|
| }
|
|
|
| +TEST_F(LayerTreeHostImplTest, ScrollUnknownNotOnAncestorChain) {
|
| + // If we ray cast a scroller that is not on the first layer's ancestor chain,
|
| + // we should return ScrollUnknown.
|
| + gfx::Size content_size(100, 100);
|
| + SetupScrollAndContentsLayers(content_size);
|
| +
|
| + int scroll_layer_id = 2;
|
| + LayerImpl* scroll_layer =
|
| + host_impl_->active_tree()->LayerById(scroll_layer_id);
|
| + scroll_layer->SetDrawsContent(true);
|
| +
|
| + int page_scale_layer_id = 5;
|
| + LayerImpl* page_scale_layer =
|
| + host_impl_->active_tree()->LayerById(page_scale_layer_id);
|
| +
|
| + int occluder_layer_id = 6;
|
| + scoped_ptr<LayerImpl> occluder_layer =
|
| + LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id);
|
| + occluder_layer->SetDrawsContent(true);
|
| + occluder_layer->SetBounds(content_size);
|
| + occluder_layer->SetContentBounds(content_size);
|
| + occluder_layer->SetPosition(gfx::PointF());
|
| + occluder_layer->SetAnchorPoint(gfx::PointF());
|
| +
|
| + // The parent of the occluder is *above* the scroller.
|
| + page_scale_layer->AddChild(occluder_layer.Pass());
|
| +
|
| + DrawFrame();
|
| +
|
| + EXPECT_EQ(InputHandler::ScrollUnknown,
|
| + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
|
| +}
|
| +
|
| +TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
|
| + // If we ray cast a scroller this is on the first layer's ancestor chain, but
|
| + // is not the first scroller we encounter when walking up from the layer, we
|
| + // should also return ScrollUnknown.
|
| + gfx::Size content_size(100, 100);
|
| + SetupScrollAndContentsLayers(content_size);
|
| +
|
| + int scroll_layer_id = 2;
|
| + LayerImpl* scroll_layer =
|
| + host_impl_->active_tree()->LayerById(scroll_layer_id);
|
| + scroll_layer->SetDrawsContent(true);
|
| +
|
| + int occluder_layer_id = 6;
|
| + scoped_ptr<LayerImpl> occluder_layer =
|
| + LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id);
|
| + occluder_layer->SetDrawsContent(true);
|
| + occluder_layer->SetBounds(content_size);
|
| + occluder_layer->SetContentBounds(content_size);
|
| + occluder_layer->SetPosition(gfx::PointF());
|
| + occluder_layer->SetAnchorPoint(gfx::PointF());
|
| +
|
| + int child_scroll_clip_layer_id = 7;
|
| + scoped_ptr<LayerImpl> child_scroll_clip =
|
| + LayerImpl::Create(host_impl_->active_tree(), child_scroll_clip_layer_id);
|
| +
|
| + int child_scroll_layer_id = 8;
|
| + scoped_ptr<LayerImpl> child_scroll = CreateScrollableLayer(
|
| + child_scroll_layer_id, content_size, child_scroll_clip.get());
|
| +
|
| + child_scroll->SetDrawsContent(false);
|
| +
|
| + child_scroll->AddChild(occluder_layer.Pass());
|
| + scroll_layer->AddChild(child_scroll.Pass());
|
| +
|
| + DrawFrame();
|
| +
|
| + EXPECT_EQ(InputHandler::ScrollUnknown,
|
| + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
|
| +}
|
| +
|
| // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed
|
| // to CompositorFrameMetadata after SwapBuffers();
|
| TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
|
|
|