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

Side by Side 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, 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 unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 break; 773 break;
774 } 774 }
775 } 775 }
776 776
777 void AfterTest() override {} 777 void AfterTest() override {}
778 int index_; 778 int index_;
779 }; 779 };
780 780
781 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); 781 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
782 782
783 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest {
784 protected:
785 void SetupTree() override {
786 scoped_refptr<Layer> root = Layer::Create();
787 scoped_refptr<Layer> child = Layer::Create();
788 mask_layer = Layer::Create();
789 child->SetMaskLayer(mask_layer.get());
790 root->AddChild(std::move(child));
791 layer_tree_host()->SetRootLayer(root);
792 LayerTreeHostTest::SetupTree();
793 }
794
795 void BeginTest() override {
796 index_ = 0;
797 PostSetNeedsCommitToMainThread();
798 }
799
800 void DidCommit() override {
801 switch (layer_tree_host()->source_frame_number()) {
802 case 1:
803 layer_tree_host()->root_layer()->RemoveAllChildren();
804 layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get());
805 break;
806 }
807 }
808
809 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
810 switch (index_) {
811 case 0:
812 index_++;
813 EXPECT_FALSE(impl->sync_tree()->root_layer()->mask_layer());
814 break;
815 case 1:
816 EXPECT_TRUE(impl->sync_tree()->root_layer()->mask_layer());
817 EndTest();
818 break;
819 }
820 }
821
822 void AfterTest() override {}
823
824 scoped_refptr<Layer> mask_layer;
825 int index_;
826 };
827
828 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSwitchMaskLayer);
829
783 // 1 setNeedsRedraw after the first commit has completed should lead to 1 830 // 1 setNeedsRedraw after the first commit has completed should lead to 1
784 // additional draw. 831 // additional draw.
785 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { 832 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest {
786 public: 833 public:
787 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} 834 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {}
788 835
789 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 836 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
790 837
791 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 838 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
792 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); 839 EXPECT_EQ(0, impl->active_tree()->source_frame_number());
(...skipping 5765 matching lines...) Expand 10 before | Expand all | Expand 10 after
6558 EndTest(); 6605 EndTest();
6559 } 6606 }
6560 6607
6561 void AfterTest() override {} 6608 void AfterTest() override {}
6562 }; 6609 };
6563 6610
6564 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6611 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6565 6612
6566 } // namespace 6613 } // namespace
6567 } // namespace cc 6614 } // namespace cc
OLDNEW
« 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