| Index: cc/trees/layer_tree_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
|
| index 2c5dd05be0372135e4c84b3acdd4d16f95993761..c50cb5cec8c20256b30c036b2defdda548c5d18a 100644
|
| --- a/cc/trees/layer_tree_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_impl_unittest.cc
|
| @@ -2093,5 +2093,44 @@ TEST_F(LayerTreeImplTest, NumLayersSmallTree) {
|
| EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
|
| }
|
|
|
| +TEST_F(LayerTreeImplTest, ViewportRectForTilePriorityIsCached) {
|
| + bool resourceless_software_draw = false;
|
| +
|
| + gfx::Transform transform, transform_for_tile_priority;
|
| + gfx::Point3F transform_origin;
|
| + gfx::PointF position;
|
| + gfx::Size bounds(100, 100);
|
| + gfx::Rect viewport = gfx::Rect(0, 0, 200, 200),
|
| + rect1 = gfx::Rect(0, 0, 100, 100),
|
| + rect2 = gfx::Rect(10, 10, 123, 123);
|
| +
|
| + scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
|
| + SetLayerPropertiesForTesting(root.get(), transform, transform_origin,
|
| + position, bounds, true, false, true);
|
| + root->SetDrawsContent(true);
|
| + host_impl().SetViewportSize(root->bounds());
|
| + host_impl().active_tree()->SetRootLayer(root.Pass());
|
| + host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
|
| +
|
| + host_impl().SetExternalDrawConstraints(
|
| + transform, viewport, viewport,
|
| + rect1, /* viewport_rect_for_tile_priority */
|
| + transform_for_tile_priority, resourceless_software_draw);
|
| + host_impl().active_tree()->UpdateDrawProperties();
|
| + EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect1);
|
| +
|
| + host_impl().SetExternalDrawConstraints(
|
| + transform, viewport, viewport,
|
| + rect2, /* viewport_rect_for_tile_priority */
|
| + transform_for_tile_priority, resourceless_software_draw);
|
| +
|
| + // Test that even when the LTH's viewport rect for tile priority has
|
| + // changed, the ViewportRectForTilePriority will not change to most recent
|
| + // value until UpdateDrawProperties is called.
|
| + EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect1);
|
| + host_impl().active_tree()->UpdateDrawProperties();
|
| + EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect2);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|