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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2822303003: cc : Compute subtree has copy requests before property tree building (Closed)
Patch Set: . Created 3 years, 8 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
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 e6f69f6dd998ff37a70881111a190ff2fd6ec5ae..51ef650997dcd8bed83a2cde931694d836b9c304 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -5538,10 +5538,10 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
inputs.can_adjust_raster_scales = true;
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
- EXPECT_GT(root_layer->num_copy_requests_in_target_subtree(), 0);
- EXPECT_GT(copy_grand_parent_layer->num_copy_requests_in_target_subtree(), 0);
- EXPECT_GT(copy_parent_layer->num_copy_requests_in_target_subtree(), 0);
- EXPECT_GT(copy_layer->num_copy_requests_in_target_subtree(), 0);
+ EXPECT_TRUE(root_layer->has_copy_requests_in_target_subtree());
+ EXPECT_TRUE(copy_grand_parent_layer->has_copy_requests_in_target_subtree());
+ EXPECT_TRUE(copy_parent_layer->has_copy_requests_in_target_subtree());
+ EXPECT_TRUE(copy_layer->has_copy_requests_in_target_subtree());
// We should have four render surfaces, one for the root, one for the grand
// parent since it has opacity and two drawing descendants, one for the parent
@@ -9344,14 +9344,7 @@ TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) {
static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
-TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) {
- // If the layer has a node in effect_tree, the return value of
- // num_copy_requests_in_target_subtree() must be equal to the actual number
- // of copy requests in the sub-layer_tree; Otherwise, the number is expected
- // to be the value of its nearest ancestor that owns an effect node and
- // greater than or equal to the actual number of copy requests in the
- // sub-layer_tree.
-
+TEST_F(LayerTreeHostCommonTest, HasCopyRequestsInTargetSubtree) {
scoped_refptr<Layer> root = Layer::Create();
scoped_refptr<Layer> child1 = Layer::Create();
scoped_refptr<Layer> child2 = Layer::Create();
@@ -9371,11 +9364,11 @@ TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) {
child2->SetOpacity(0.f);
ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get());
- EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2);
- EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2);
- EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0);
- EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2);
- EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1);
+ EXPECT_TRUE(root->has_copy_requests_in_target_subtree());
+ EXPECT_TRUE(child1->has_copy_requests_in_target_subtree());
+ EXPECT_FALSE(child2->has_copy_requests_in_target_subtree());
+ EXPECT_TRUE(grandchild->has_copy_requests_in_target_subtree());
+ EXPECT_TRUE(greatgrandchild->has_copy_requests_in_target_subtree());
}
TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) {
@@ -9781,10 +9774,10 @@ TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) {
CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get());
- EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0);
+ EXPECT_TRUE(root->has_copy_requests_in_target_subtree());
ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get());
- EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0);
+ EXPECT_TRUE(root->has_copy_requests_in_target_subtree());
}
TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) {

Powered by Google App Engine
This is Rietveld 408576698