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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1850453002: cc : Fix bug in tree synchronization when mask layer changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 years, 9 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/layers/layer_impl.cc ('k') | cc/trees/tree_synchronizer.cc » ('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 f4ca58c7c31a16482bf54e134cf5b5afad68e29b..40ea39cf1218cccebcdc6519bd589388a15e2dc6 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -780,6 +780,53 @@ class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest {
SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
+class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest {
+ protected:
+ void SetupTree() override {
+ scoped_refptr<Layer> root = Layer::Create();
+ scoped_refptr<Layer> child = Layer::Create();
+ mask_layer = Layer::Create();
+ child->SetMaskLayer(mask_layer.get());
+ root->AddChild(std::move(child));
+ layer_tree_host()->SetRootLayer(root);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override {
+ index_ = 0;
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void DidCommit() override {
+ switch (layer_tree_host()->source_frame_number()) {
+ case 1:
+ layer_tree_host()->root_layer()->RemoveAllChildren();
+ layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get());
+ break;
+ }
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
+ switch (index_) {
+ case 0:
+ index_++;
+ EXPECT_FALSE(impl->sync_tree()->root_layer()->mask_layer());
+ break;
+ case 1:
+ EXPECT_TRUE(impl->sync_tree()->root_layer()->mask_layer());
+ EndTest();
+ break;
+ }
+ }
+
+ void AfterTest() override {}
+
+ scoped_refptr<Layer> mask_layer;
+ int index_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSwitchMaskLayer);
+
// 1 setNeedsRedraw after the first commit has completed should lead to 1
// additional draw.
class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest {
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698