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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2866733002: Remove owning_id from EffectNode and replace it by an opaque stable_id (Closed)
Patch Set: none Created 3 years, 7 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_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bf60a074e87f600b6c33f21f251f9e3be1c06bb7..c6c799621331793c5a908b0446f5e834c06434f0 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3136,7 +3136,7 @@ class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
EffectNode* active_tree_node =
host_impl_->active_tree()->property_trees()->effect_tree.Node(
active_scrollbar_layer->effect_tree_index());
- EXPECT_FLOAT_EQ(active_scrollbar_layer->Opacity(),
+ EXPECT_FLOAT_EQ(OpacityForLayer(active_scrollbar_layer),
active_tree_node->opacity);
if (expecting_animations) {
@@ -3166,13 +3166,14 @@ class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
pending_scrollbar_layer->effect_tree_index());
host_impl_->pending_tree()
->property_trees()
- ->always_use_active_tree_opacity_effect_ids.push_back(400);
+ ->always_use_active_tree_opacity_effect_ids.push_back(
+ ElementId(500, 0));
if (expecting_animations) {
EXPECT_FLOAT_EQ(1.f, active_tree_node->opacity);
- EXPECT_FLOAT_EQ(1.f, active_scrollbar_layer->Opacity());
+ EXPECT_FLOAT_EQ(1.f, OpacityForLayer(active_scrollbar_layer));
} else {
EXPECT_FLOAT_EQ(0.f, active_tree_node->opacity);
- EXPECT_FLOAT_EQ(0.f, active_scrollbar_layer->Opacity());
+ EXPECT_FLOAT_EQ(0.f, OpacityForLayer(active_scrollbar_layer));
}
EXPECT_FLOAT_EQ(0.f, pending_tree_node->opacity);
host_impl_->ActivateSyncTree();
@@ -3181,10 +3182,10 @@ class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
active_scrollbar_layer->effect_tree_index());
if (expecting_animations) {
EXPECT_FLOAT_EQ(1.f, active_tree_node->opacity);
- EXPECT_FLOAT_EQ(1.f, active_scrollbar_layer->Opacity());
+ EXPECT_FLOAT_EQ(1.f, OpacityForLayer(active_scrollbar_layer));
} else {
EXPECT_FLOAT_EQ(0.f, active_tree_node->opacity);
- EXPECT_FLOAT_EQ(0.f, active_scrollbar_layer->Opacity());
+ EXPECT_FLOAT_EQ(0.f, OpacityForLayer(active_scrollbar_layer));
}
}
};
@@ -7249,12 +7250,16 @@ class BlendStateCheckLayer : public LayerImpl {
gfx::Size(1, 1), false, false);
test_blending_draw_quad->visible_rect = quad_visible_rect_;
EXPECT_EQ(blend_, test_blending_draw_quad->ShouldDrawWithBlending());
- EXPECT_EQ(has_render_surface_, !!GetRenderSurface(this));
+ EXPECT_EQ(has_render_surface_,
+ GetRenderSurface(this) != GetRenderSurface(comparison_layer_));
}
- void SetExpectation(bool blend, bool has_render_surface) {
+ void SetExpectation(bool blend,
+ bool has_render_surface,
+ LayerImpl* comparison_layer) {
blend_ = blend;
has_render_surface_ = has_render_surface;
+ comparison_layer_ = comparison_layer;
quads_appended_ = false;
}
@@ -7273,6 +7278,7 @@ class BlendStateCheckLayer : public LayerImpl {
: LayerImpl(tree_impl, id),
blend_(false),
has_render_surface_(false),
+ comparison_layer_(nullptr),
quads_appended_(false),
quad_rect_(5, 5, 5, 5),
quad_visible_rect_(5, 5, 5, 5),
@@ -7288,6 +7294,7 @@ class BlendStateCheckLayer : public LayerImpl {
bool blend_;
bool has_render_surface_;
+ LayerImpl* comparison_layer_;
bool quads_appended_;
gfx::Rect quad_rect_;
gfx::Rect opaque_content_rect_;
@@ -7316,7 +7323,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Opaque layer, drawn without blending.
layer1->SetContentsOpaque(true);
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7326,7 +7333,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Layer with translucent content and painting, so drawn with blending.
layer1->SetContentsOpaque(false);
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7339,7 +7346,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->test_properties()->opacity = 0.5f;
layer1->NoteLayerPropertyChanged();
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7351,7 +7358,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->test_properties()->opacity = 0.5f;
layer1->NoteLayerPropertyChanged();
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7369,12 +7376,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->test_properties()->opacity = 1.f;
layer1->NoteLayerPropertyChanged();
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(true);
layer2->test_properties()->opacity = 1.f;
layer2->NoteLayerPropertyChanged();
- layer2->SetExpectation(false, false);
+ layer2->SetExpectation(false, false, root);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7387,9 +7394,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// Parent layer with translucent content, drawn with blending.
// Child layer with opaque content, drawn without blending.
layer1->SetContentsOpaque(false);
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
- layer2->SetExpectation(false, false);
+ layer2->SetExpectation(false, false, root);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7403,9 +7410,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// blending.
// Child layer with opaque content, drawn without blending.
layer1->SetContentsOpaque(true);
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
- layer2->SetExpectation(false, false);
+ layer2->SetExpectation(false, false, root);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7423,9 +7430,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->test_properties()->opacity = 0.5f;
layer1->NoteLayerPropertyChanged();
layer1->test_properties()->force_render_surface = true;
- layer1->SetExpectation(false, true);
+ layer1->SetExpectation(false, true, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
- layer2->SetExpectation(false, false);
+ layer2->SetExpectation(false, false, layer1);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7440,12 +7447,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->test_properties()->opacity = 1.f;
layer1->NoteLayerPropertyChanged();
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(true);
layer2->test_properties()->opacity = 0.5f;
layer2->NoteLayerPropertyChanged();
- layer2->SetExpectation(true, false);
+ layer2->SetExpectation(true, false, layer1);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7458,12 +7465,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->test_properties()->opacity = 1.f;
layer1->NoteLayerPropertyChanged();
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(false);
layer2->test_properties()->opacity = 1.f;
layer2->NoteLayerPropertyChanged();
- layer2->SetExpectation(true, false);
+ layer2->SetExpectation(true, false, root);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7477,12 +7484,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->test_properties()->opacity = 1.f;
layer1->NoteLayerPropertyChanged();
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
layer2->SetContentsOpaque(true);
layer2->test_properties()->opacity = 1.f;
layer2->NoteLayerPropertyChanged();
- layer2->SetExpectation(false, false);
+ layer2->SetExpectation(false, false, root);
layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -7496,7 +7503,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7510,7 +7517,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7524,7 +7531,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
- layer1->SetExpectation(true, false);
+ layer1->SetExpectation(true, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7539,7 +7546,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5));
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5));
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
- layer1->SetExpectation(false, false);
+ layer1->SetExpectation(false, false, root);
layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
host_impl_->active_tree()->BuildPropertyTreesForTesting();
host_impl_->active_tree()->set_needs_update_draw_properties();
@@ -7629,7 +7636,8 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
->root_layer_for_testing()
->test_properties()
->children[0]);
- child_->SetExpectation(false, false);
+ child_->SetExpectation(false, false,
+ host_impl_->active_tree()->root_layer_for_testing());
child_->SetContentsOpaque(true);
}
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698