Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 19075002: cc: layer_or_descendant_has_copy_request is inherited by siblings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copy-output-request-sibling-inherits: templatez Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 3365721235862c6bd5eb156e7093e494900b1e66..5b607c8129d62895cc2aed63e8b8185f4e30c352 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -8205,14 +8205,38 @@ TEST(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
false);
copy_child->SetIsDrawable(true);
+ scoped_refptr<Layer> copy_grand_parent_sibling_before = Layer::Create();
+ SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(),
+ identity_matrix,
+ identity_matrix,
+ gfx::PointF(),
+ gfx::PointF(),
+ gfx::Size(40, 40),
+ false);
+ copy_grand_parent_sibling_before->SetIsDrawable(true);
+
+ scoped_refptr<Layer> copy_grand_parent_sibling_after = Layer::Create();
+ SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(),
+ identity_matrix,
+ identity_matrix,
+ gfx::PointF(),
+ gfx::PointF(),
+ gfx::Size(40, 40),
+ false);
+ copy_grand_parent_sibling_after->SetIsDrawable(true);
+
copy_layer->AddChild(copy_child);
copy_parent->AddChild(copy_layer);
copy_grand_parent->AddChild(copy_parent);
+ root->AddChild(copy_grand_parent_sibling_before);
root->AddChild(copy_grand_parent);
+ root->AddChild(copy_grand_parent_sibling_after);
// Hide the copy_grand_parent and its subtree. But make a copy request in that
// hidden subtree on copy_layer.
copy_grand_parent->SetHideLayerAndSubtree(true);
+ copy_grand_parent_sibling_before->SetHideLayerAndSubtree(true);
+ copy_grand_parent_sibling_after->SetHideLayerAndSubtree(true);
copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest(
base::Bind(&EmptyCopyOutputCallback)));
EXPECT_TRUE(copy_layer->HasCopyRequest());
@@ -8230,6 +8254,20 @@ TEST(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
true, // can_adjust_raster_scale
&render_surface_layer_list);
+ EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request);
+ EXPECT_TRUE(copy_grand_parent->draw_properties().
+ layer_or_descendant_has_copy_request);
+ EXPECT_TRUE(copy_parent->draw_properties().
+ layer_or_descendant_has_copy_request);
+ EXPECT_TRUE(copy_layer->draw_properties().
+ layer_or_descendant_has_copy_request);
+ EXPECT_FALSE(copy_child->draw_properties().
+ layer_or_descendant_has_copy_request);
+ EXPECT_FALSE(copy_grand_parent_sibling_before->draw_properties().
+ layer_or_descendant_has_copy_request);
+ EXPECT_FALSE(copy_grand_parent_sibling_after->draw_properties().
+ layer_or_descendant_has_copy_request);
+
// We should have three render surfaces, one for the root, one for the parent
// since it owns a surface, and one for the copy_layer.
ASSERT_EQ(3u, render_surface_layer_list.size());
@@ -8238,8 +8276,9 @@ TEST(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
EXPECT_EQ(copy_layer->id(), render_surface_layer_list[2]->id());
// The root render surface should have 2 contributing layers. The
- // copy_grand_parent is hidden, but the copy_parent will appear since
- // something in its subtree needs to be drawn for a copy request.
+ // copy_grand_parent is hidden along with its siblings, but the copy_parent
+ // will appear since something in its subtree needs to be drawn for a copy
+ // request.
ASSERT_EQ(2u, root->render_surface()->layer_list().size());
EXPECT_EQ(root->id(), root->render_surface()->layer_list()[0]->id());
EXPECT_EQ(copy_parent->id(), root->render_surface()->layer_list()[1]->id());
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698