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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2416273002: Enable some remote LTH tests in layer_tree_host_unittests. (Closed)
Patch Set: Polish some comments. Created 4 years, 2 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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 using testing::AtLeast; 74 using testing::AtLeast;
75 using testing::Mock; 75 using testing::Mock;
76 76
77 namespace cc { 77 namespace cc {
78 namespace { 78 namespace {
79 79
80 class LayerTreeHostTest : public LayerTreeTest {}; 80 class LayerTreeHostTest : public LayerTreeTest {};
81 81
82 class LayerTreeHostTestHasImplThreadTest : public LayerTreeHostTest { 82 class LayerTreeHostTestHasImplThreadTest : public LayerTreeHostTest {
83 public: 83 public:
84 LayerTreeHostTestHasImplThreadTest() : threaded_(false) {} 84 LayerTreeHostTestHasImplThreadTest() : single_threaded_(false) {}
85 85
86 void RunTest(CompositorMode mode) override { 86 void RunTest(CompositorMode mode) override {
87 threaded_ = mode == CompositorMode::THREADED; 87 single_threaded_ = mode == CompositorMode::SINGLE_THREADED;
88 LayerTreeHostTest::RunTest(mode); 88 LayerTreeHostTest::RunTest(mode);
89 } 89 }
90 90
91 void BeginTest() override { 91 void BeginTest() override {
92 EXPECT_EQ(threaded_, HasImplThread()); 92 EXPECT_EQ(single_threaded_, !HasImplThread());
93 EndTest(); 93 EndTest();
94 } 94 }
95 95
96 void AfterTest() override { EXPECT_EQ(threaded_, HasImplThread()); } 96 void AfterTest() override { EXPECT_EQ(single_threaded_, !HasImplThread()); }
97 97
98 private: 98 private:
99 bool threaded_; 99 bool single_threaded_;
100 }; 100 };
101 101
102 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHasImplThreadTest); 102 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHasImplThreadTest);
Khushal 2016/10/14 20:12:31 Looks like we didn't actually enable it for remote
xingliu 2016/10/17 16:26:49 My bad. Done.
103 103
104 class LayerTreeHostTestSetNeedsCommitInsideLayout : public LayerTreeHostTest { 104 class LayerTreeHostTestSetNeedsCommitInsideLayout : public LayerTreeHostTest {
105 protected: 105 protected:
106 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 106 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
107 107
108 void UpdateLayerTreeHost() override { 108 void UpdateLayerTreeHost() override {
109 // This shouldn't cause a second commit to happen. 109 // This shouldn't cause a second commit to happen.
110 layer_tree_host()->SetNeedsCommit(); 110 layer_tree_host()->SetNeedsCommit();
111 } 111 }
112 112
113 void DidCommit() override { 113 void DidCommit() override {
114 EXPECT_EQ(1, layer_tree_host()->SourceFrameNumber()); 114 EXPECT_EQ(1, layer_tree_host()->SourceFrameNumber());
115 EndTest(); 115 EndTest();
116 } 116 }
117 117
118 void AfterTest() override {} 118 void AfterTest() override {}
119 }; 119 };
120 120
121 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommitInsideLayout); 121 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestSetNeedsCommitInsideLayout);
122 122
123 class LayerTreeHostTestFrameOrdering : public LayerTreeHostTest { 123 class LayerTreeHostTestFrameOrdering : public LayerTreeHostTest {
124 protected: 124 protected:
125 enum MainOrder : int { 125 enum MainOrder : int {
126 MAIN_START = 1, 126 MAIN_START = 1,
127 MAIN_LAYOUT, 127 MAIN_LAYOUT,
128 MAIN_COMMIT_COMPLETE, 128 MAIN_COMMIT_COMPLETE,
129 MAIN_DID_BEGIN_FRAME, 129 MAIN_DID_BEGIN_FRAME,
130 MAIN_END, 130 MAIN_END,
131 }; 131 };
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 void AfterTest() override { 187 void AfterTest() override {
188 EXPECT_TRUE(CheckStep(MAIN_END, &main_)); 188 EXPECT_TRUE(CheckStep(MAIN_END, &main_));
189 EXPECT_TRUE(CheckStep(IMPL_END, &impl_)); 189 EXPECT_TRUE(CheckStep(IMPL_END, &impl_));
190 } 190 }
191 191
192 MainOrder main_ = MAIN_START; 192 MainOrder main_ = MAIN_START;
193 ImplOrder impl_ = IMPL_START; 193 ImplOrder impl_ = IMPL_START;
194 }; 194 };
195 195
196 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameOrdering); 196 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestFrameOrdering);
197 197
198 class LayerTreeHostTestSetNeedsUpdateInsideLayout : public LayerTreeHostTest { 198 class LayerTreeHostTestSetNeedsUpdateInsideLayout : public LayerTreeHostTest {
199 protected: 199 protected:
200 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 200 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
201 201
202 void UpdateLayerTreeHost() override { 202 void UpdateLayerTreeHost() override {
203 // This shouldn't cause a second commit to happen. 203 // This shouldn't cause a second commit to happen.
204 layer_tree_host()->SetNeedsUpdateLayers(); 204 layer_tree_host()->SetNeedsUpdateLayers();
205 } 205 }
206 206
207 void DidCommit() override { 207 void DidCommit() override {
208 EXPECT_EQ(1, layer_tree_host()->SourceFrameNumber()); 208 EXPECT_EQ(1, layer_tree_host()->SourceFrameNumber());
209 EndTest(); 209 EndTest();
210 } 210 }
211 211
212 void AfterTest() override {} 212 void AfterTest() override {}
213 }; 213 };
214 214
215 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsUpdateInsideLayout); 215 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestSetNeedsUpdateInsideLayout);
216 216
217 // Test if the LTHI receives ReadyToActivate notifications from the TileManager 217 // Test if the LTHI receives ReadyToActivate notifications from the TileManager
218 // when no raster tasks get scheduled. 218 // when no raster tasks get scheduled.
219 class LayerTreeHostTestReadyToActivateEmpty : public LayerTreeHostTest { 219 class LayerTreeHostTestReadyToActivateEmpty : public LayerTreeHostTest {
220 public: 220 public:
221 LayerTreeHostTestReadyToActivateEmpty() 221 LayerTreeHostTestReadyToActivateEmpty()
222 : did_notify_ready_to_activate_(false), 222 : did_notify_ready_to_activate_(false),
223 all_tiles_required_for_activation_are_ready_to_draw_(false), 223 all_tiles_required_for_activation_are_ready_to_draw_(false),
224 required_for_activation_count_(0) {} 224 required_for_activation_count_(0) {}
225 225
(...skipping 23 matching lines...) Expand all
249 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 249 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
250 EXPECT_EQ(size_t(0), required_for_activation_count_); 250 EXPECT_EQ(size_t(0), required_for_activation_count_);
251 } 251 }
252 252
253 protected: 253 protected:
254 bool did_notify_ready_to_activate_; 254 bool did_notify_ready_to_activate_;
255 bool all_tiles_required_for_activation_are_ready_to_draw_; 255 bool all_tiles_required_for_activation_are_ready_to_draw_;
256 size_t required_for_activation_count_; 256 size_t required_for_activation_count_;
257 }; 257 };
258 258
259 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateEmpty); 259 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestReadyToActivateEmpty);
260 260
261 // Test if the LTHI receives ReadyToActivate notifications from the TileManager 261 // Test if the LTHI receives ReadyToActivate notifications from the TileManager
262 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled. 262 // when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled.
263 class LayerTreeHostTestReadyToActivateNonEmpty 263 class LayerTreeHostTestReadyToActivateNonEmpty
264 : public LayerTreeHostTestReadyToActivateEmpty { 264 : public LayerTreeHostTestReadyToActivateEmpty {
265 public: 265 public:
266 void SetupTree() override { 266 void SetupTree() override {
267 client_.set_fill_with_nonsolid_color(true); 267 client_.set_fill_with_nonsolid_color(true);
268 scoped_refptr<FakePictureLayer> root_layer = 268 scoped_refptr<FakePictureLayer> root_layer =
269 FakePictureLayer::Create(&client_); 269 FakePictureLayer::Create(&client_);
270 root_layer->SetBounds(gfx::Size(1024, 1024)); 270 root_layer->SetBounds(gfx::Size(1024, 1024));
271 root_layer->SetIsDrawable(true); 271 root_layer->SetIsDrawable(true);
272 272
273 layer_tree()->SetRootLayer(root_layer); 273 layer_tree()->SetRootLayer(root_layer);
274 LayerTreeHostTest::SetupTree(); 274 LayerTreeHostTest::SetupTree();
275 client_.set_bounds(root_layer->bounds()); 275 client_.set_bounds(root_layer->bounds());
276 } 276 }
277 277
278 void AfterTest() override { 278 void AfterTest() override {
279 EXPECT_TRUE(did_notify_ready_to_activate_); 279 EXPECT_TRUE(did_notify_ready_to_activate_);
280 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 280 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
281 EXPECT_LE(size_t(1), required_for_activation_count_); 281 EXPECT_LE(size_t(1), required_for_activation_count_);
282 } 282 }
283 283
284 private: 284 private:
285 FakeContentLayerClient client_; 285 FakeContentLayerClient client_;
286 }; 286 };
287 287
288 // Multi-thread only because in single thread the commit goes directly to the 288 // No single thread test because the commit goes directly to the active tree in
289 // active tree, so notify ready to activate is skipped. 289 // single thread mode, so notify ready to activate is skipped.
290 MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty); 290 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty);
291 291
292 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when 292 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when
293 // no raster tasks get scheduled. 293 // no raster tasks get scheduled.
294 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { 294 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest {
295 public: 295 public:
296 LayerTreeHostTestReadyToDrawEmpty() 296 LayerTreeHostTestReadyToDrawEmpty()
297 : did_notify_ready_to_draw_(false), 297 : did_notify_ready_to_draw_(false),
298 all_tiles_required_for_draw_are_ready_to_draw_(false), 298 all_tiles_required_for_draw_are_ready_to_draw_(false),
299 required_for_draw_count_(0) {} 299 required_for_draw_count_(0) {}
300 300
(...skipping 19 matching lines...) Expand all
320 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); 320 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_);
321 EXPECT_EQ(size_t(0), required_for_draw_count_); 321 EXPECT_EQ(size_t(0), required_for_draw_count_);
322 } 322 }
323 323
324 protected: 324 protected:
325 bool did_notify_ready_to_draw_; 325 bool did_notify_ready_to_draw_;
326 bool all_tiles_required_for_draw_are_ready_to_draw_; 326 bool all_tiles_required_for_draw_are_ready_to_draw_;
327 size_t required_for_draw_count_; 327 size_t required_for_draw_count_;
328 }; 328 };
329 329
330 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToDrawEmpty); 330 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestReadyToDrawEmpty);
331 331
332 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when 332 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when
333 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled. 333 // some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled.
334 class LayerTreeHostTestReadyToDrawNonEmpty 334 class LayerTreeHostTestReadyToDrawNonEmpty
335 : public LayerTreeHostTestReadyToDrawEmpty { 335 : public LayerTreeHostTestReadyToDrawEmpty {
336 public: 336 public:
337 void SetupTree() override { 337 void SetupTree() override {
338 client_.set_fill_with_nonsolid_color(true); 338 client_.set_fill_with_nonsolid_color(true);
339 scoped_refptr<FakePictureLayer> root_layer = 339 scoped_refptr<FakePictureLayer> root_layer =
340 FakePictureLayer::Create(&client_); 340 FakePictureLayer::Create(&client_);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 FakeContentLayerClient client_; 427 FakeContentLayerClient client_;
428 bool toggled_visibility_; 428 bool toggled_visibility_;
429 bool did_notify_ready_to_draw_; 429 bool did_notify_ready_to_draw_;
430 bool did_draw_; 430 bool did_draw_;
431 }; 431 };
432 432
433 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in 433 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in
434 // single threaded mode. 434 // single threaded mode.
435 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility); 435 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility);
436 436
437 class LayerTreeHostContextCacheTest : public LayerTreeHostTest { 437 class LayerTreeHostContextCacheTest : public LayerTreeHostTest {
Khushal 2016/10/14 20:12:31 Can you add a comment on this saying that "Since t
xingliu 2016/10/17 16:26:49 Done.
438 public: 438 public:
439 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( 439 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink(
440 scoped_refptr<ContextProvider> compositor_context_provider, 440 scoped_refptr<ContextProvider> compositor_context_provider,
441 scoped_refptr<ContextProvider> worker_context_provider) override { 441 scoped_refptr<ContextProvider> worker_context_provider) override {
442 // Create the main ContextProvider with a MockContextSupport. 442 // Create the main ContextProvider with a MockContextSupport.
443 auto main_support = base::MakeUnique<MockContextSupport>(); 443 auto main_support = base::MakeUnique<MockContextSupport>();
444 mock_main_context_support_ = main_support.get(); 444 mock_main_context_support_ = main_support.get();
445 auto test_main_context_provider = TestContextProvider::Create( 445 auto test_main_context_provider = TestContextProvider::Create(
446 TestWebGraphicsContext3D::Create(), std::move(main_support)); 446 TestWebGraphicsContext3D::Create(), std::move(main_support));
447 447
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 void AfterTest() override { 647 void AfterTest() override {
648 EXPECT_LE(1, num_commits_); 648 EXPECT_LE(1, num_commits_);
649 EXPECT_LE(1, num_draws_); 649 EXPECT_LE(1, num_draws_);
650 } 650 }
651 651
652 private: 652 private:
653 int num_commits_; 653 int num_commits_;
654 int num_draws_; 654 int num_draws_;
655 }; 655 };
656 656
657 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit1); 657 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestSetNeedsCommit1);
658 658
659 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that 659 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that
660 // first committed frame draws should lead to another commit. 660 // first committed frame draws should lead to another commit.
661 class LayerTreeHostTestSetNeedsCommit2 : public LayerTreeHostTest { 661 class LayerTreeHostTestSetNeedsCommit2 : public LayerTreeHostTest {
662 public: 662 public:
663 LayerTreeHostTestSetNeedsCommit2() : num_commits_(0), num_draws_(0) {} 663 LayerTreeHostTestSetNeedsCommit2() : num_commits_(0), num_draws_(0) {}
664 664
665 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 665 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
666 666
667 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { ++num_draws_; } 667 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { ++num_draws_; }
(...skipping 15 matching lines...) Expand all
683 void AfterTest() override { 683 void AfterTest() override {
684 EXPECT_EQ(2, num_commits_); 684 EXPECT_EQ(2, num_commits_);
685 EXPECT_LE(1, num_draws_); 685 EXPECT_LE(1, num_draws_);
686 } 686 }
687 687
688 private: 688 private:
689 int num_commits_; 689 int num_commits_;
690 int num_draws_; 690 int num_draws_;
691 }; 691 };
692 692
693 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); 693 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2);
694 694
695 // Verify that we pass property values in PushPropertiesTo. 695 // Verify that we pass property values in PushPropertiesTo.
696 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { 696 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest {
697 protected: 697 protected:
698 void SetupTree() override { 698 void SetupTree() override {
699 scoped_refptr<Layer> root = Layer::Create(); 699 scoped_refptr<Layer> root = Layer::Create();
700 root->SetBounds(gfx::Size(10, 10)); 700 root->SetBounds(gfx::Size(10, 10));
701 layer_tree()->SetRootLayer(root); 701 layer_tree()->SetRootLayer(root);
702 LayerTreeHostTest::SetupTree(); 702 LayerTreeHostTest::SetupTree();
703 } 703 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 break; 778 break;
779 case DRAWS_CONTENT: 779 case DRAWS_CONTENT:
780 layer->SetIsDrawable(true); 780 layer->SetIsDrawable(true);
781 break; 781 break;
782 } 782 }
783 } 783 }
784 784
785 int index_; 785 int index_;
786 }; 786 };
787 787
788 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); 788 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestPushPropertiesTo);
789 789
790 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { 790 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest {
791 protected: 791 protected:
792 void SetupTree() override { 792 void SetupTree() override {
793 root_ = Layer::Create(); 793 root_ = Layer::Create();
794 child_ = Layer::Create(); 794 child_ = Layer::Create();
795 root_->AddChild(child_); 795 root_->AddChild(child_);
796 layer_tree()->SetRootLayer(root_); 796 layer_tree()->SetRootLayer(root_);
797 LayerTreeHostTest::SetupTree(); 797 LayerTreeHostTest::SetupTree();
798 } 798 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 900 }
901 } 901 }
902 902
903 void AfterTest() override {} 903 void AfterTest() override {}
904 904
905 private: 905 private:
906 scoped_refptr<Layer> root_; 906 scoped_refptr<Layer> root_;
907 scoped_refptr<Layer> child_; 907 scoped_refptr<Layer> child_;
908 }; 908 };
909 909
910 // The remote LTH doesn't build property tree, see if we need to
911 // compare the property trees between LTH in process and impl side tree for
912 // remote LTH test. See crbug/655795.
910 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); 913 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap);
Khushal 2016/10/14 20:12:31 Can you make the comment a bit more descriptive ab
xingliu 2016/10/17 16:26:49 Done.
911 914
912 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { 915 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest {
913 protected: 916 protected:
914 void SetupTree() override { 917 void SetupTree() override {
915 root_ = Layer::Create(); 918 root_ = Layer::Create();
916 child_ = Layer::Create(); 919 child_ = Layer::Create();
917 grand_child_ = Layer::Create(); 920 grand_child_ = Layer::Create();
918 921
919 layer_tree()->SetRootLayer(root_); 922 layer_tree()->SetRootLayer(root_);
920 root_->AddChild(child_); 923 root_->AddChild(child_);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 984 }
982 985
983 void AfterTest() override {} 986 void AfterTest() override {}
984 987
985 private: 988 private:
986 scoped_refptr<Layer> root_; 989 scoped_refptr<Layer> root_;
987 scoped_refptr<Layer> child_; 990 scoped_refptr<Layer> child_;
988 scoped_refptr<Layer> grand_child_; 991 scoped_refptr<Layer> grand_child_;
989 }; 992 };
990 993
994 // Remote LTH test always re-sync tree hierachy, so render surface will always
995 // be damaged, see crbug/605170.
991 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceDamage); 996 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceDamage);
Khushal 2016/10/14 20:12:31 Again, a little more descriptive comment helps in
xingliu 2016/10/17 16:26:49 Done.
992 997
993 // Verify damage status of property trees is preserved after commit. 998 // Verify damage status of property trees is preserved after commit.
994 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { 999 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest {
995 protected: 1000 protected:
996 void SetupTree() override { 1001 void SetupTree() override {
997 root_ = Layer::Create(); 1002 root_ = Layer::Create();
998 child_ = Layer::Create(); 1003 child_ = Layer::Create();
999 // This is to force the child to create a transform and effect node. 1004 // This is to force the child to create a transform and effect node.
1000 child_->SetForceRenderSurfaceForTesting(true); 1005 child_->SetForceRenderSurfaceForTesting(true);
1001 root_->AddChild(child_); 1006 root_->AddChild(child_);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 } 1087 }
1083 1088
1084 void AfterTest() override {} 1089 void AfterTest() override {}
1085 1090
1086 private: 1091 private:
1087 int index_; 1092 int index_;
1088 scoped_refptr<Layer> root_; 1093 scoped_refptr<Layer> root_;
1089 scoped_refptr<Layer> child_; 1094 scoped_refptr<Layer> child_;
1090 }; 1095 };
1091 1096
1092 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); 1097 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
Khushal 2016/10/14 20:12:32 +ajuma, is there a reason this is not enabled for
Khushal 2016/10/18 00:59:06 Also, ping on this one to Ali.
ajuma 2016/10/18 04:03:04 No good reason that I can see. To make it work wit
1093 1098
1094 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest { 1099 class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest {
1095 protected: 1100 protected:
1096 void SetupTree() override { 1101 void SetupTree() override {
1097 root_ = Layer::Create(); 1102 root_ = Layer::Create();
1098 layer_tree()->SetRootLayer(root_); 1103 layer_tree()->SetRootLayer(root_);
1099 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f)); 1104 blur_filter_.Append(FilterOperation::CreateBlurFilter(0.5f));
1100 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f)); 1105 brightness_filter_.Append(FilterOperation::CreateBrightnessFilter(0.25f));
1101 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f)); 1106 sepia_filter_.Append(FilterOperation::CreateSepiaFilter(0.75f));
1102 LayerTreeHostTest::SetupTree(); 1107 LayerTreeHostTest::SetupTree();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1197
1193 void AfterTest() override {} 1198 void AfterTest() override {}
1194 1199
1195 private: 1200 private:
1196 scoped_refptr<Layer> root_; 1201 scoped_refptr<Layer> root_;
1197 FilterOperations blur_filter_; 1202 FilterOperations blur_filter_;
1198 FilterOperations brightness_filter_; 1203 FilterOperations brightness_filter_;
1199 FilterOperations sepia_filter_; 1204 FilterOperations sepia_filter_;
1200 }; 1205 };
1201 1206
1207 // Remote LTH won't work because it doesn't build property tree. See
1208 // crbug/655795.
1202 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); 1209 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync);
Khushal 2016/10/14 20:12:32 Update the comment, "This test verifies that corre
1203 1210
1204 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { 1211 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest {
1205 protected: 1212 protected:
1206 void SetupTree() override { 1213 void SetupTree() override {
1207 root_ = Layer::Create(); 1214 root_ = Layer::Create();
1208 layer_tree()->SetRootLayer(root_); 1215 layer_tree()->SetRootLayer(root_);
1209 LayerTreeHostTest::SetupTree(); 1216 LayerTreeHostTest::SetupTree();
1210 } 1217 }
1211 1218
1212 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1219 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 EndTest(); 1276 EndTest();
1270 } 1277 }
1271 } 1278 }
1272 1279
1273 void AfterTest() override {} 1280 void AfterTest() override {}
1274 1281
1275 private: 1282 private:
1276 scoped_refptr<Layer> root_; 1283 scoped_refptr<Layer> root_;
1277 }; 1284 };
1278 1285
1286 // Remote LTH won't work because it doesn't build property tree. See
1287 // crbug/655795.
1279 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeSync); 1288 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeSync);
1280 1289
1281 // Verify damage status is updated even when the transform tree doesn't need 1290 // Verify damage status is updated even when the transform tree doesn't need
1282 // to be updated at draw time. 1291 // to be updated at draw time.
1283 class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest { 1292 class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest {
1284 protected: 1293 protected:
1285 void SetupTree() override { 1294 void SetupTree() override {
1286 root_ = Layer::Create(); 1295 root_ = Layer::Create();
1287 child_ = Layer::Create(); 1296 child_ = Layer::Create();
1288 grand_child_ = Layer::Create(); 1297 grand_child_ = Layer::Create();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1352 }
1344 1353
1345 void AfterTest() override {} 1354 void AfterTest() override {}
1346 1355
1347 private: 1356 private:
1348 scoped_refptr<Layer> root_; 1357 scoped_refptr<Layer> root_;
1349 scoped_refptr<Layer> child_; 1358 scoped_refptr<Layer> child_;
1350 scoped_refptr<Layer> grand_child_; 1359 scoped_refptr<Layer> grand_child_;
1351 }; 1360 };
1352 1361
1362 // LTH remote test is not needed since we don't do animation.
Khushal 2016/10/14 20:12:31 And here.
1353 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeDamageIsUpdated); 1363 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeDamageIsUpdated);
1354 1364
1355 // Test that when mask layers switches layers, this gets pushed onto impl. 1365 // Test that when mask layers switches layers, this gets pushed onto impl.
1356 // Also test that mask layer is in the layer update list even if its owning 1366 // Also test that mask layer is in the layer update list even if its owning
1357 // layer isn't. 1367 // layer isn't.
1358 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { 1368 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest {
1359 protected: 1369 protected:
1360 void SetupTree() override { 1370 void SetupTree() override {
1361 scoped_refptr<Layer> root = Layer::Create(); 1371 scoped_refptr<Layer> root = Layer::Create();
1362 root->SetBounds(gfx::Size(10, 10)); 1372 root->SetBounds(gfx::Size(10, 10));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 break; 1423 break;
1414 } 1424 }
1415 } 1425 }
1416 1426
1417 void AfterTest() override {} 1427 void AfterTest() override {}
1418 1428
1419 scoped_refptr<Layer> mask_layer; 1429 scoped_refptr<Layer> mask_layer;
1420 int index_; 1430 int index_;
1421 }; 1431 };
1422 1432
1433 // Remote LTH won't work because we update all layers in BeginMainFrame, some
1434 // layers are not pushed into the update list in LTH in process.
1435 // see crbug.com/650885.
1423 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSwitchMaskLayer); 1436 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSwitchMaskLayer);
Khushal 2016/10/14 20:12:32 "This test also verifies that the Layers updated i
xingliu 2016/10/17 16:26:49 Done.
1424 1437
1425 // 1 setNeedsRedraw after the first commit has completed should lead to 1 1438 // 1 setNeedsRedraw after the first commit has completed should lead to 1
1426 // additional draw. 1439 // additional draw.
1427 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { 1440 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest {
1428 public: 1441 public:
1429 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} 1442 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {}
1430 1443
1431 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1444 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1432 1445
1433 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1446 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
(...skipping 15 matching lines...) Expand all
1449 void AfterTest() override { 1462 void AfterTest() override {
1450 EXPECT_GE(2, num_draws_); 1463 EXPECT_GE(2, num_draws_);
1451 EXPECT_EQ(1, num_commits_); 1464 EXPECT_EQ(1, num_commits_);
1452 } 1465 }
1453 1466
1454 private: 1467 private:
1455 int num_commits_; 1468 int num_commits_;
1456 int num_draws_; 1469 int num_draws_;
1457 }; 1470 };
1458 1471
1459 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); 1472 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw);
1460 1473
1461 // After setNeedsRedrawRect(invalid_rect) the final damage_rect 1474 // After setNeedsRedrawRect(invalid_rect) the final damage_rect
1462 // must contain invalid_rect. 1475 // must contain invalid_rect.
1463 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { 1476 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
1464 public: 1477 public:
1465 LayerTreeHostTestSetNeedsRedrawRect() 1478 LayerTreeHostTestSetNeedsRedrawRect()
1466 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 1479 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
1467 1480
1468 void BeginTest() override { 1481 void BeginTest() override {
1469 root_layer_ = FakePictureLayer::Create(&client_); 1482 root_layer_ = FakePictureLayer::Create(&client_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 void AfterTest() override { EXPECT_EQ(2, num_draws_); } 1520 void AfterTest() override { EXPECT_EQ(2, num_draws_); }
1508 1521
1509 private: 1522 private:
1510 int num_draws_; 1523 int num_draws_;
1511 const gfx::Size bounds_; 1524 const gfx::Size bounds_;
1512 const gfx::Rect invalid_rect_; 1525 const gfx::Rect invalid_rect_;
1513 FakeContentLayerClient client_; 1526 FakeContentLayerClient client_;
1514 scoped_refptr<FakePictureLayer> root_layer_; 1527 scoped_refptr<FakePictureLayer> root_layer_;
1515 }; 1528 };
1516 1529
1517 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect); 1530 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestSetNeedsRedrawRect);
1518 1531
1519 // Ensure the texture size of the pending and active trees are identical when a 1532 // Ensure the texture size of the pending and active trees are identical when a
1520 // layer is not in the viewport and a resize happens on the viewport 1533 // layer is not in the viewport and a resize happens on the viewport
1521 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { 1534 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest {
1522 public: 1535 public:
1523 LayerTreeHostTestGpuRasterDeviceSizeChanged() 1536 LayerTreeHostTestGpuRasterDeviceSizeChanged()
1524 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {} 1537 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {}
1525 1538
1526 void BeginTest() override { 1539 void BeginTest() override {
1527 client_.set_fill_with_nonsolid_color(true); 1540 client_.set_fill_with_nonsolid_color(true);
(...skipping 5480 matching lines...) Expand 10 before | Expand all | Expand 10 after
7008 EndTest(); 7021 EndTest();
7009 } 7022 }
7010 7023
7011 void AfterTest() override {} 7024 void AfterTest() override {}
7012 }; 7025 };
7013 7026
7014 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7027 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7015 7028
7016 } // namespace 7029 } // namespace
7017 } // namespace cc 7030 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698