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

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: Minor comment polish again.. 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
« no previous file with comments | « cc/test/layer_tree_host_remote_for_testing.cc ('k') | no next file » | 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 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_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestHasImplThreadTest);
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 // Since the LayerTreeHostContextCacheTests exclusively tests the behavior of
438 // LayerTreeHostImpl, they don't need to run for the remote mode.
437 class LayerTreeHostContextCacheTest : public LayerTreeHostTest { 439 class LayerTreeHostContextCacheTest : public LayerTreeHostTest {
438 public: 440 public:
439 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( 441 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink(
440 scoped_refptr<ContextProvider> compositor_context_provider, 442 scoped_refptr<ContextProvider> compositor_context_provider,
441 scoped_refptr<ContextProvider> worker_context_provider) override { 443 scoped_refptr<ContextProvider> worker_context_provider) override {
442 // Create the main ContextProvider with a MockContextSupport. 444 // Create the main ContextProvider with a MockContextSupport.
443 auto main_support = base::MakeUnique<MockContextSupport>(); 445 auto main_support = base::MakeUnique<MockContextSupport>();
444 mock_main_context_support_ = main_support.get(); 446 mock_main_context_support_ = main_support.get();
445 auto test_main_context_provider = TestContextProvider::Create( 447 auto test_main_context_provider = TestContextProvider::Create(
446 TestWebGraphicsContext3D::Create(), std::move(main_support)); 448 TestWebGraphicsContext3D::Create(), std::move(main_support));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 void AfterTest() override { 649 void AfterTest() override {
648 EXPECT_LE(1, num_commits_); 650 EXPECT_LE(1, num_commits_);
649 EXPECT_LE(1, num_draws_); 651 EXPECT_LE(1, num_draws_);
650 } 652 }
651 653
652 private: 654 private:
653 int num_commits_; 655 int num_commits_;
654 int num_draws_; 656 int num_draws_;
655 }; 657 };
656 658
657 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit1); 659 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestSetNeedsCommit1);
658 660
659 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that 661 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that
660 // first committed frame draws should lead to another commit. 662 // first committed frame draws should lead to another commit.
661 class LayerTreeHostTestSetNeedsCommit2 : public LayerTreeHostTest { 663 class LayerTreeHostTestSetNeedsCommit2 : public LayerTreeHostTest {
662 public: 664 public:
663 LayerTreeHostTestSetNeedsCommit2() : num_commits_(0), num_draws_(0) {} 665 LayerTreeHostTestSetNeedsCommit2() : num_commits_(0), num_draws_(0) {}
664 666
665 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 667 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
666 668
667 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { ++num_draws_; } 669 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { ++num_draws_; }
(...skipping 15 matching lines...) Expand all
683 void AfterTest() override { 685 void AfterTest() override {
684 EXPECT_EQ(2, num_commits_); 686 EXPECT_EQ(2, num_commits_);
685 EXPECT_LE(1, num_draws_); 687 EXPECT_LE(1, num_draws_);
686 } 688 }
687 689
688 private: 690 private:
689 int num_commits_; 691 int num_commits_;
690 int num_draws_; 692 int num_draws_;
691 }; 693 };
692 694
693 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); 695 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2);
694 696
695 // Verify that we pass property values in PushPropertiesTo. 697 // Verify that we pass property values in PushPropertiesTo.
696 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { 698 class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest {
697 protected: 699 protected:
698 void SetupTree() override { 700 void SetupTree() override {
699 scoped_refptr<Layer> root = Layer::Create(); 701 scoped_refptr<Layer> root = Layer::Create();
700 root->SetBounds(gfx::Size(10, 10)); 702 root->SetBounds(gfx::Size(10, 10));
701 layer_tree()->SetRootLayer(root); 703 layer_tree()->SetRootLayer(root);
702 LayerTreeHostTest::SetupTree(); 704 LayerTreeHostTest::SetupTree();
703 } 705 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 break; 780 break;
779 case DRAWS_CONTENT: 781 case DRAWS_CONTENT:
780 layer->SetIsDrawable(true); 782 layer->SetIsDrawable(true);
781 break; 783 break;
782 } 784 }
783 } 785 }
784 786
785 int index_; 787 int index_;
786 }; 788 };
787 789
788 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); 790 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestPushPropertiesTo);
789 791
790 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest { 792 class LayerTreeHostTestPushNodeOwnerToNodeIdMap : public LayerTreeHostTest {
791 protected: 793 protected:
792 void SetupTree() override { 794 void SetupTree() override {
793 root_ = Layer::Create(); 795 root_ = Layer::Create();
794 child_ = Layer::Create(); 796 child_ = Layer::Create();
795 root_->AddChild(child_); 797 root_->AddChild(child_);
796 layer_tree()->SetRootLayer(root_); 798 layer_tree()->SetRootLayer(root_);
797 LayerTreeHostTest::SetupTree(); 799 LayerTreeHostTest::SetupTree();
798 } 800 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 902 }
901 } 903 }
902 904
903 void AfterTest() override {} 905 void AfterTest() override {}
904 906
905 private: 907 private:
906 scoped_refptr<Layer> root_; 908 scoped_refptr<Layer> root_;
907 scoped_refptr<Layer> child_; 909 scoped_refptr<Layer> child_;
908 }; 910 };
909 911
912 // This test compares the value of tree indexes from Layers on the engine to the
913 // resulting PropertyTrees copied to the pending tree after the commit on the
914 // client. This will result in a failure for LTH remote test since while the
915 // client side Layers would have the correct values for these indexes, but the
916 // engine will never build PropertyTrees in LTH remote. See crbug.com/655795.
910 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap); 917 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushNodeOwnerToNodeIdMap);
911 918
912 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest { 919 class LayerTreeHostTestSurfaceDamage : public LayerTreeHostTest {
913 protected: 920 protected:
914 void SetupTree() override { 921 void SetupTree() override {
915 root_ = Layer::Create(); 922 root_ = Layer::Create();
916 child_ = Layer::Create(); 923 child_ = Layer::Create();
917 grand_child_ = Layer::Create(); 924 grand_child_ = Layer::Create();
918 925
919 layer_tree()->SetRootLayer(root_); 926 layer_tree()->SetRootLayer(root_);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 988 }
982 989
983 void AfterTest() override {} 990 void AfterTest() override {}
984 991
985 private: 992 private:
986 scoped_refptr<Layer> root_; 993 scoped_refptr<Layer> root_;
987 scoped_refptr<Layer> child_; 994 scoped_refptr<Layer> child_;
988 scoped_refptr<Layer> grand_child_; 995 scoped_refptr<Layer> grand_child_;
989 }; 996 };
990 997
998 // This test changes properties on the Layer and ensures that the subtree damage
999 // is tracked correctly on the resulting RenderSurfaceImpl for the corresponding
1000 // LayerImpl. Since the remote code path currently synchronizes the hierarchy
1001 // between the engine and client for every frame, all Layers on the client end
1002 // up being marked as damaged.
1003 // Enable this when crbug.com/605170 is fixed.
991 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceDamage); 1004 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSurfaceDamage);
992 1005
993 // Verify damage status of property trees is preserved after commit. 1006 // Verify damage status of property trees is preserved after commit.
994 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { 1007 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest {
995 protected: 1008 protected:
996 void SetupTree() override { 1009 void SetupTree() override {
997 root_ = Layer::Create(); 1010 root_ = Layer::Create();
998 child_ = Layer::Create(); 1011 child_ = Layer::Create();
999 // This is to force the child to create a transform and effect node. 1012 // This is to force the child to create a transform and effect node.
1000 child_->SetForceRenderSurfaceForTesting(true); 1013 child_->SetForceRenderSurfaceForTesting(true);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1205
1193 void AfterTest() override {} 1206 void AfterTest() override {}
1194 1207
1195 private: 1208 private:
1196 scoped_refptr<Layer> root_; 1209 scoped_refptr<Layer> root_;
1197 FilterOperations blur_filter_; 1210 FilterOperations blur_filter_;
1198 FilterOperations brightness_filter_; 1211 FilterOperations brightness_filter_;
1199 FilterOperations sepia_filter_; 1212 FilterOperations sepia_filter_;
1200 }; 1213 };
1201 1214
1215 // This test verifies that correct values are retained on the impl thread in
1216 // cases where they are animated on that thread. Since remote mode doesn't
1217 // support threaded animations, we don't need to run this in remote mode.
1202 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync); 1218 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestEffectTreeSync);
1203 1219
1204 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest { 1220 class LayerTreeHostTestTransformTreeSync : public LayerTreeHostTest {
1205 protected: 1221 protected:
1206 void SetupTree() override { 1222 void SetupTree() override {
1207 root_ = Layer::Create(); 1223 root_ = Layer::Create();
1208 layer_tree()->SetRootLayer(root_); 1224 layer_tree()->SetRootLayer(root_);
1209 LayerTreeHostTest::SetupTree(); 1225 LayerTreeHostTest::SetupTree();
1210 } 1226 }
1211 1227
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 EndTest(); 1285 EndTest();
1270 } 1286 }
1271 } 1287 }
1272 1288
1273 void AfterTest() override {} 1289 void AfterTest() override {}
1274 1290
1275 private: 1291 private:
1276 scoped_refptr<Layer> root_; 1292 scoped_refptr<Layer> root_;
1277 }; 1293 };
1278 1294
1295 // This test verifies that correct values are retained on the impl thread in
1296 // cases where they are animated on that thread. Since remote mode doesn't
1297 // support threaded animations, we don't need to run this in remote mode.
1279 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeSync); 1298 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeSync);
1280 1299
1281 // Verify damage status is updated even when the transform tree doesn't need 1300 // Verify damage status is updated even when the transform tree doesn't need
1282 // to be updated at draw time. 1301 // to be updated at draw time.
1283 class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest { 1302 class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest {
1284 protected: 1303 protected:
1285 void SetupTree() override { 1304 void SetupTree() override {
1286 root_ = Layer::Create(); 1305 root_ = Layer::Create();
1287 child_ = Layer::Create(); 1306 child_ = Layer::Create();
1288 grand_child_ = Layer::Create(); 1307 grand_child_ = Layer::Create();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1362 }
1344 1363
1345 void AfterTest() override {} 1364 void AfterTest() override {}
1346 1365
1347 private: 1366 private:
1348 scoped_refptr<Layer> root_; 1367 scoped_refptr<Layer> root_;
1349 scoped_refptr<Layer> child_; 1368 scoped_refptr<Layer> child_;
1350 scoped_refptr<Layer> grand_child_; 1369 scoped_refptr<Layer> grand_child_;
1351 }; 1370 };
1352 1371
1372 // This test verifies that correct values are retained on the impl thread in
1373 // cases where they are animated on that thread. Since remote mode doesn't
1374 // support threaded animations, we don't need to run this in remote mode.
1353 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeDamageIsUpdated); 1375 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTransformTreeDamageIsUpdated);
1354 1376
1355 // Test that when mask layers switches layers, this gets pushed onto impl. 1377 // 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 1378 // Also test that mask layer is in the layer update list even if its owning
1357 // layer isn't. 1379 // layer isn't.
1358 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { 1380 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest {
1359 protected: 1381 protected:
1360 void SetupTree() override { 1382 void SetupTree() override {
1361 scoped_refptr<Layer> root = Layer::Create(); 1383 scoped_refptr<Layer> root = Layer::Create();
1362 root->SetBounds(gfx::Size(10, 10)); 1384 root->SetBounds(gfx::Size(10, 10));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 break; 1435 break;
1414 } 1436 }
1415 } 1437 }
1416 1438
1417 void AfterTest() override {} 1439 void AfterTest() override {}
1418 1440
1419 scoped_refptr<Layer> mask_layer; 1441 scoped_refptr<Layer> mask_layer;
1420 int index_; 1442 int index_;
1421 }; 1443 };
1422 1444
1445 // This test also verifies that the Layers updated in a main frame correspond
1446 // only to the Layers that need updates computed using
1447 // draw_property_utils::FindLayersThatNeedUpdates. Since LayerTreeHostRemote
1448 // currently updates all Layers during the main frame, the test fails for remote
1449 // mode.
1450 // TODO(xingliu): Revisit enabling this when crbug.com/650885 is resolved.
1423 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSwitchMaskLayer); 1451 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSwitchMaskLayer);
1424 1452
1425 // 1 setNeedsRedraw after the first commit has completed should lead to 1 1453 // 1 setNeedsRedraw after the first commit has completed should lead to 1
1426 // additional draw. 1454 // additional draw.
1427 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { 1455 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest {
1428 public: 1456 public:
1429 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} 1457 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {}
1430 1458
1431 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1459 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1432 1460
(...skipping 16 matching lines...) Expand all
1449 void AfterTest() override { 1477 void AfterTest() override {
1450 EXPECT_GE(2, num_draws_); 1478 EXPECT_GE(2, num_draws_);
1451 EXPECT_EQ(1, num_commits_); 1479 EXPECT_EQ(1, num_commits_);
1452 } 1480 }
1453 1481
1454 private: 1482 private:
1455 int num_commits_; 1483 int num_commits_;
1456 int num_draws_; 1484 int num_draws_;
1457 }; 1485 };
1458 1486
1459 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); 1487 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw);
1460 1488
1461 // After setNeedsRedrawRect(invalid_rect) the final damage_rect 1489 // After setNeedsRedrawRect(invalid_rect) the final damage_rect
1462 // must contain invalid_rect. 1490 // must contain invalid_rect.
1463 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { 1491 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
1464 public: 1492 public:
1465 LayerTreeHostTestSetNeedsRedrawRect() 1493 LayerTreeHostTestSetNeedsRedrawRect()
1466 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 1494 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
1467 1495
1468 void BeginTest() override { 1496 void BeginTest() override {
1469 root_layer_ = FakePictureLayer::Create(&client_); 1497 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_); } 1535 void AfterTest() override { EXPECT_EQ(2, num_draws_); }
1508 1536
1509 private: 1537 private:
1510 int num_draws_; 1538 int num_draws_;
1511 const gfx::Size bounds_; 1539 const gfx::Size bounds_;
1512 const gfx::Rect invalid_rect_; 1540 const gfx::Rect invalid_rect_;
1513 FakeContentLayerClient client_; 1541 FakeContentLayerClient client_;
1514 scoped_refptr<FakePictureLayer> root_layer_; 1542 scoped_refptr<FakePictureLayer> root_layer_;
1515 }; 1543 };
1516 1544
1517 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect); 1545 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestSetNeedsRedrawRect);
1518 1546
1519 // Ensure the texture size of the pending and active trees are identical when a 1547 // 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 1548 // layer is not in the viewport and a resize happens on the viewport
1521 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { 1549 class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest {
1522 public: 1550 public:
1523 LayerTreeHostTestGpuRasterDeviceSizeChanged() 1551 LayerTreeHostTestGpuRasterDeviceSizeChanged()
1524 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {} 1552 : num_draws_(0), bounds_(500, 64), invalid_rect_(10, 10, 20, 20) {}
1525 1553
1526 void BeginTest() override { 1554 void BeginTest() override {
1527 client_.set_fill_with_nonsolid_color(true); 1555 client_.set_fill_with_nonsolid_color(true);
(...skipping 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after
7009 EndTest(); 7037 EndTest();
7010 } 7038 }
7011 7039
7012 void AfterTest() override {} 7040 void AfterTest() override {}
7013 }; 7041 };
7014 7042
7015 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7043 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7016 7044
7017 } // namespace 7045 } // namespace
7018 } // namespace cc 7046 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_remote_for_testing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698