Chromium Code Reviews| 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..85ad92b48b39fb1a8ede552fea6336ca4ce7b761 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; |
|
vmpstr
2015/01/16 19:14:00
One variable per statement, please.
|
| + gfx::Point3F transform_origin; |
| + gfx::PointF position; |
| + gfx::Size bounds(100, 100); |
| + gfx::Rect viewport = gfx::Rect(0, 0, 200, 200), |
|
vmpstr
2015/01/16 19:14:01
Same here.
|
| + rect1 = gfx::Rect(0, 0, 100, 100), |
|
vmpstr
2015/01/16 19:14:00
If you name these something like "viewport_rect_fo
|
| + 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 LTHI'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 |