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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1949253006: cc: Ensure damage in property tree nodes gets propagated to descendants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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 | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index a31ec95ffbf6f900b162f8e3503ad913b465a260..5829fe44ddad630ec790d4f4956e732fdf6b4347 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -780,6 +780,79 @@ class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest {
SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
+// Verify damage status is updated even when the transform tree doesn't need
+// to be updated at draw time.
+class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest {
+ protected:
+ void SetupTree() override {
+ root_ = Layer::Create();
+ child_ = Layer::Create();
+ grand_child_ = Layer::Create();
+
+ root_->SetBounds(gfx::Size(50, 50));
+
+ // Make sure child and grand_child have transform nodes.
+ gfx::Transform rotation;
+ rotation.RotateAboutZAxis(45.0);
+ child_->SetTransform(rotation);
+ grand_child_->SetTransform(rotation);
+
+ root_->AddChild(child_);
+ child_->AddChild(grand_child_);
+ layer_tree_host()->SetRootLayer(root_);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void DidCommit() override {
+ if (layer_tree_host()->source_frame_number() == 1) {
+ gfx::Transform scale;
+ scale.Scale(2.0, 2.0);
+ child_->OnTransformAnimated(scale);
+ }
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
+ if (impl->sync_tree()->source_frame_number() == 0)
+ PostSetNeedsCommitToMainThread();
+ }
+
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawResult draw_result) override {
+ if (impl->active_tree()->source_frame_number() == 1) {
+ EXPECT_FALSE(
+ impl->active_tree()->LayerById(root_->id())->LayerPropertyChanged());
+ EXPECT_TRUE(
+ impl->active_tree()->LayerById(child_->id())->LayerPropertyChanged());
+ EXPECT_TRUE(impl->active_tree()
+ ->LayerById(grand_child_->id())
+ ->LayerPropertyChanged());
+ EndTest();
+ }
+
+ return draw_result;
+ }
+
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
+ if (impl->active_tree()->source_frame_number() == 0) {
+ gfx::Transform scale;
+ scale.Scale(2.0, 2.0);
+ impl->active_tree()->LayerById(child_->id())->OnTransformAnimated(scale);
+ }
+ }
+
+ void AfterTest() override {}
+
+ private:
+ scoped_refptr<Layer> root_;
+ scoped_refptr<Layer> child_;
+ scoped_refptr<Layer> grand_child_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeDamageIsUpdated);
+
// Test that when mask layers switches layers, this gets pushed onto impl.
// Also test that mask layer is in the layer update list even if its owning
// layer isn't.
« no previous file with comments | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698